Merge pull request #262 from jersey99/master

vivado just needs to be in the path for the programmer as well
This commit is contained in:
enjoy-digital 2019-09-20 06:25:57 +02:00 committed by GitHub
commit 4f659ba422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 13 deletions

View File

@ -7,6 +7,7 @@
import os import os
import sys import sys
import subprocess import subprocess
from distutils.spawn import find_executable
from litex.build.generic_programmer import GenericProgrammer from litex.build.generic_programmer import GenericProgrammer
from litex.build.xilinx import common from litex.build.xilinx import common
@ -116,22 +117,25 @@ quit
def _run_vivado(path, ver, cmds): def _run_vivado(path, ver, cmds):
vivado_cmd = "echo 0"
if sys.platform == "win32" or sys.platform == "cygwin": if sys.platform == "win32" or sys.platform == "cygwin":
vivado_cmd = "vivado -mode tcl" vivado_cmd = "vivado -mode tcl"
else: else:
# For backwards compatibility with ISE paths, also if not find_executable("vivado"):
# look for a version in a subdirectory named "Vivado" # For backwards compatibility with ISE paths, also
# under the current directory. # look for a version in a subdirectory named "Vivado"
paths_to_try = [path, os.path.join(path, "Vivado")] # under the current directory.
for p in paths_to_try: paths_to_try = [path, os.path.join(path, "Vivado")]
try: for p in paths_to_try:
settings = common.settings(p, ver) try:
except OSError: settings = common.settings(p, ver)
continue except OSError:
break continue
else: break
raise OSError("Unable to locate Vivado directory or settings.") else:
vivado_cmd = "bash -c \"source " + settings + "&& vivado -mode tcl\"" raise OSError("Unable to locate Vivado directory or settings.")
vivado_cmd += "source " + settings
vivado_cmd += " && vivado -mode tcl"
with subprocess.Popen(vivado_cmd, stdin=subprocess.PIPE, shell=True) as process: with subprocess.Popen(vivado_cmd, stdin=subprocess.PIPE, shell=True) as process:
process.stdin.write(cmds.encode("ASCII")) process.stdin.write(cmds.encode("ASCII"))
process.communicate() process.communicate()