def _run_ise(build_name, ise_path, source, mode, ngdbuild_opt,
bitgen_opt, ise_commands, map_opt, par_opt, ver=None):
if sys.platform == "win32" or sys.platform == "cygwin":
- source = False
- build_script_contents = "# Autogenerated by mibuild\nset -e\n"
- if source:
- settings = common.settings(ise_path, ver, "ISE_DS")
- build_script_contents += "source " + settings + "\n"
+ source_cmd = "call "
+ script_ext = ".bat"
+ shell = ["cmd", "/c"]
+ build_script_contents = "@echo off\nrem Autogenerated by mibuild\n"
+ else:
+ source_cmd = "source "
+ script_ext = ".sh"
+ shell = ["bash"]
+ build_script_contents = "# Autogenerated by mibuild\nset -e\n"
+
+ settings = common.settings(ise_path, ver, "ISE_DS")
+ build_script_contents += source_cmd + settings + "\n"
if mode == "edif":
ext = "edif"
else:
ngdbuild_opt=ngdbuild_opt, bitgen_opt=bitgen_opt, ext=ext,
par_opt=par_opt, map_opt=map_opt)
build_script_contents += ise_commands.format(build_name=build_name)
- build_script_file = "build_" + build_name + ".sh"
- tools.write_to_file(build_script_file, build_script_contents, force_unix=True)
-
- r = subprocess.call(["bash", build_script_file])
+ build_script_file = "build_" + build_name + script_ext
+ tools.write_to_file(build_script_file, build_script_contents, force_unix=False)
+ command = shell + [build_script_file]
+ r = subprocess.call(command)
if r != 0:
raise OSError("Subprocess failed")
self.ngdbuild_opt = ""
self.bitgen_opt = "-g LCK_cycle:6 -g Binary:Yes -w"
self.ise_commands = ""
+ if sys.platform == "win32":
+ self.default_ise_path = "C:\\Xilinx"
+ elif sys.platform == "cygwin":
+ self.default_ise_path = "/cygdrive/c/Xilinx"
+ else:
+ self.default_ise_path = "/opt/Xilinx"
+
def build(self, platform, fragment, build_dir="build", build_name="top",
- ise_path="/opt/Xilinx", source=True, run=True, mode="xst"):
+ ise_path=None, source=True, run=True, mode="xst"):
+ # Default path differs depending on the platform Python is run.
+ # Use None as default input argument to figure out the default path.
+ if ise_path is None:
+ ise_path = self.default_ise_path
+
tools.mkdir_noerror(build_dir)
os.chdir(build_dir)