Line 5... |
Line 5... |
import guiparent
|
import guiparent
|
|
|
import os # se usa para el dialogo de abrir fichero
|
import os # se usa para el dialogo de abrir fichero
|
import subprocess # para interactuar con el shell
|
import subprocess # para interactuar con el shell
|
import thread # to prevent gui blocking
|
import thread # to prevent gui blocking
|
|
from sys import platform as _platform # para detectar el sistema operativo
|
|
|
|
|
class phrgui (guiparent.guiParent):
|
class phrgui (guiparent.guiParent):
|
def __init__(self, *args, **kwds):
|
def __init__(self, *args, **kwds):
|
guiparent.guiParent.__init__(self, *args, **kwds)
|
guiparent.guiParent.__init__(self, *args, **kwds)
|
Line 34... |
Line 35... |
description = """
|
description = """
|
PHR GUI es una interfaz gráfica que permite interactuar con
|
PHR GUI es una interfaz gráfica que permite interactuar con
|
la Plataforma de Hardware Reconfigurable (CUDAR) a través
|
la Plataforma de Hardware Reconfigurable (CUDAR) a través
|
del software xc3sprog.
|
del software xc3sprog.
|
|
|
$Rev: 333 $
|
$Rev: 336 $
|
$Date: 2014-06-10 03:09:27 +0200 (Tue, 10 Jun 2014) $
|
$Date: 2014-06-11 03:58:02 +0200 (Wed, 11 Jun 2014) $
|
"""
|
"""
|
licence = """
|
licence = """
|
PHR GUI is free software; you can redistribute it and/or modify
|
PHR GUI is free software; you can redistribute it and/or modify
|
it under the terms of the GNU General Public License as
|
it under the terms of the GNU General Public License as
|
published by the Free Software Foundation; either version 2
|
published by the Free Software Foundation; either version 2
|
Line 73... |
Line 74... |
mensaje = """
|
mensaje = """
|
Procedimiento general para utilizar este programa:
|
Procedimiento general para utilizar este programa:
|
|
|
1. Conecte el programador y presione en el botón \"Detectar\".
|
1. Conecte el programador y presione en el botón \"Detectar\".
|
Se listaran los dispositivos encontrados en la cadena JTAG.
|
Se listaran los dispositivos encontrados en la cadena JTAG.
|
|
|
2. Seleccione el dispositivo que desea programar o configurar.
|
2. Seleccione el dispositivo que desea programar o configurar.
|
|
|
3. Elija un fichero de configuración/programación.
|
3. Elija un fichero de configuración/programación.
|
*.BIT para FPGA
|
*.BIT para FPGA
|
*.JED para CPLD
|
*.JED para CPLD
|
|
|
4. Presione el botón \"Transferir\".
|
4. Presione el botón \"Transferir\".
|
|
|
Considere las recomendaciones de la placa específica que esté
|
Considere las recomendaciones de la placa específica que esté
|
utilizando.
|
utilizando.
|
"""
|
"""
|
Line 136... |
Line 134... |
if len (device_list_selection) > 0:
|
if len (device_list_selection) > 0:
|
position = str(device_list_selection[0])
|
position = str(device_list_selection[0])
|
else:
|
else:
|
position = ""
|
position = ""
|
|
|
## accion
|
if _platform == "linux" or _platform == "linux2":
|
# se copia el fichero de programacion al directorio local
|
# linux
|
#subprocess.call ("copy \"" + self.text_ctrl_file.GetValue() + "\" fpgaFile", shell=True)
|
|
|
|
# se ejecuta el xc3sprog
|
|
command = "./xc3sprog/xc3sprog -v -c ftdi -p " + position + " \""+ self.text_ctrl_fichero.GetValue() + "\""
|
command = "./xc3sprog/xc3sprog -v -c ftdi -p " + position + " \""+ self.text_ctrl_fichero.GetValue() + "\""
|
|
else:
|
|
# windows
|
|
subprocess.call ("copy \"" + self.text_ctrl_fichero.GetValue() + "\" fpgaFile", shell=True)
|
|
command = "xc3sprog\\xc3sprog.exe -v -L -c ftdi -p " + position + " fpgaFile:w:0:BIT"
|
|
|
wx.CallAfter(self.text_ctrl_console.AppendText, command + "\n")
|
wx.CallAfter(self.text_ctrl_console.AppendText, command + "\n")
|
|
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
|
|
|
|
|
|
if _platform == "linux" or _platform == "linux2":
|
|
# linux
|
for line in iter(process.stdout.readline, ''):
|
for line in iter(process.stdout.readline, ''):
|
wx.CallAfter(self.text_ctrl_console.AppendText, line)
|
wx.CallAfter(self.text_ctrl_console.AppendText, line)
|
process.stdout.close()
|
process.stdout.close()
|
|
else:
|
|
# Windows
|
|
line = ''
|
|
while True:
|
|
out = process.stdout.read(1)
|
|
if out == '' and process.poll() != None:
|
|
break
|
|
if out != '' and out != '\x0a':
|
|
line = line + out
|
|
if out == '\x0d':
|
|
wx.CallAfter(self.text_ctrl_console.AppendText, line)
|
|
line = ''
|
|
|
wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
|
wx.CallAfter(self.text_ctrl_console.AppendText, "\nPHR>>> ")
|
|
|
## restaurar entorno
|
## restaurar entorno
|
wx.CallAfter(self.after_run)
|
wx.CallAfter(self.after_run)
|
Line 168... |
Line 182... |
## preparar entorno
|
## preparar entorno
|
wx.CallAfter(self.before_run, )
|
wx.CallAfter(self.before_run, )
|
wx.CallAfter(self.list_box_dispositivos_conectados.Clear)
|
wx.CallAfter(self.list_box_dispositivos_conectados.Clear)
|
|
|
## accion
|
## accion
|
command = "./xc3sprog/xc3sprog -c ftdi" # the shell command
|
|
|
if _platform == "linux" or _platform == "linux2":
|
|
# linux
|
|
command = "./xc3sprog/xc3sprog -c ftdi"
|
|
else:
|
|
# windows
|
|
command = "xc3sprog\\xc3sprog -c ftdi -L -j -v"
|
|
|
wx.CallAfter(self.text_ctrl_console.AppendText, command + "\n")
|
wx.CallAfter(self.text_ctrl_console.AppendText, command + "\n")
|
|
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
|
|
|