From: Florent Kermarrec Date: Mon, 30 Apr 2018 22:44:13 +0000 (+0200) Subject: xilinx/programmer: fix programmer X-Git-Tag: 24jan2021_ls180~1714 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=39ffa532b0cebb0bd6bd98393b53e23eb6257cb2;p=litex.git xilinx/programmer: fix programmer --- diff --git a/litex/build/xilinx/programmer.py b/litex/build/xilinx/programmer.py index d1ae01bc..38c95364 100644 --- a/litex/build/xilinx/programmer.py +++ b/litex/build/xilinx/programmer.py @@ -112,7 +112,18 @@ def _run_vivado(path, ver, cmds): if sys.platform == "win32" or sys.platform == "cygwin": vivado_cmd = "vivado -mode tcl" else: - settings = common.settings(path, "", ver, first="name") + # For backwards compatibility with ISE paths, also + # look for a version in a subdirectory named "Vivado" + # under the current directory. + paths_to_try = [path, os.path.join(path, "Vivado")] + for p in paths_to_try: + try: + settings = common.settings(p, ver) + except OSError: + continue + break + else: + raise OSError("Unable to locate Vivado directory or settings.") vivado_cmd = "bash -c \"source " + settings + "&& vivado -mode tcl\"" with subprocess.Popen(vivado_cmd, stdin=subprocess.PIPE, shell=True) as process: process.stdin.write(cmds.encode("ASCII"))