xilinx/programmer: add source of vivado's settings (need to be tested on a linux machine)

This commit is contained in:
Florent Kermarrec 2015-02-28 03:38:47 +01:00
parent e82531cdf8
commit 87d8ff2de7
1 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import subprocess import subprocess
from mibuild.generic_programmer import GenericProgrammer from mibuild.generic_programmer import GenericProgrammer
from mibuild.xilinx import common
def _run_urjtag(cmds): def _run_urjtag(cmds):
with subprocess.Popen("jtag", stdin=subprocess.PIPE) as process: with subprocess.Popen("jtag", stdin=subprocess.PIPE) as process:
@ -62,6 +63,12 @@ class FpgaProg(GenericProgrammer):
subprocess.call(["fpgaprog", "-v", "-sa", "-r", "-b", flash_proxy, subprocess.call(["fpgaprog", "-v", "-sa", "-r", "-b", flash_proxy,
"-f", data_file]) "-f", data_file])
def _source_vivado(vivado_path, ver=None):
if sys.platform == "win32" or sys.platform == "cygwin":
pass
else:
settings = common.settings(vivado_path, ver)
subprocess.call(["source", settings])
def _run_vivado(cmds): def _run_vivado(cmds):
with subprocess.Popen("vivado -mode tcl", stdin=subprocess.PIPE, shell=True) as process: with subprocess.Popen("vivado -mode tcl", stdin=subprocess.PIPE, shell=True) as process:
@ -70,6 +77,9 @@ def _run_vivado(cmds):
class VivadoProgrammer(GenericProgrammer): class VivadoProgrammer(GenericProgrammer):
needs_bitreverse = False needs_bitreverse = False
def __init__(self, vivado_path="/opt/Xilinx/Vivado"):
GenericProgrammer.__init__(self)
_source_vivado(vivado_path)
def load_bitstream(self, bitstream_file): def load_bitstream(self, bitstream_file):
cmds = """open_hw cmds = """open_hw