lattice: use pnmainc on windows

This commit is contained in:
Shawn Hoffman 2021-03-27 04:36:02 -07:00
parent e56268d419
commit fc75e57d9a
1 changed files with 7 additions and 4 deletions

View File

@ -115,7 +115,8 @@ def _build_tcl(device, sources, vincpaths, build_name):
# Script -------------------------------------------------------------------------------------------
def _build_script(build_name, device):
if sys.platform in ("win32", "cygwin"):
on_windows = sys.platform in ("win32", "cygwin")
if on_windows:
script_ext = ".bat"
script_contents = "@echo off\nrem Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n\n"
copy_stmt = "copy"
@ -126,7 +127,8 @@ def _build_script(build_name, device):
copy_stmt = "cp"
fail_stmt = ""
script_contents += "diamondc {tcl_script}{fail_stmt}\n".format(
script_contents += "{tool} {tcl_script}{fail_stmt}\n".format(
tool = "pnmainc" if on_windows else "diamondc",
tcl_script = build_name + ".tcl",
fail_stmt = fail_stmt)
for ext in (".bit", ".jed"):
@ -143,12 +145,13 @@ def _build_script(build_name, device):
return build_script_file
def _run_script(script):
if sys.platform in ("win32", "cygwin"):
on_windows = sys.platform in ("win32", "cygwin")
if on_windows:
shell = ["cmd", "/c"]
else:
shell = ["bash"]
if which("diamondc") is None:
if which("pnmainc" if on_windows else "diamondc") is None:
msg = "Unable to find Diamond toolchain, please:\n"
msg += "- Add Diamond toolchain to your $PATH.\n"
raise OSError(msg)