integration/builder: add gateware toolchain path command line switch
authorSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 4 Nov 2015 06:57:48 +0000 (14:57 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Wed, 4 Nov 2015 06:57:48 +0000 (14:57 +0800)
misoc/integration/builder.py

index bf8aff82b32b2da5bcd174e9096bd6b823c8275f..6594673ddfd437875ca7ded9f8a207096e06893a 100644 (file)
@@ -30,6 +30,7 @@ def _makefile_escape(s):
 class Builder:
     def __init__(self, soc, output_dir=None,
                  compile_software=True, compile_gateware=True,
+                 gateware_toolchain_path=None,
                  csr_csv=None):
         self.soc = soc
         if output_dir is None:
@@ -41,6 +42,7 @@ class Builder:
         self.output_dir = os.path.abspath(output_dir)
         self.compile_software = compile_software
         self.compile_gateware = compile_gateware
+        self.gateware_toolchain_path = gateware_toolchain_path
         self.csr_csv = csr_csv
 
         self.software_packages = []
@@ -130,8 +132,12 @@ class Builder:
         self._generate_includes()
         self._generate_software()
         self._initialize_rom()
+        if self.gateware_toolchain_path is None:
+            kwargs = dict()
+        else:
+            kwargs = {"toolchain_path": self.gateware_toolchain_path}
         self.soc.build(build_dir=os.path.join(self.output_dir, "gateware"),
-                       run=self.compile_gateware)
+                       run=self.compile_gateware, **kwargs)
 
 
 def builder_args(parser):
@@ -144,6 +150,9 @@ def builder_args(parser):
     parser.add_argument("--no-compile-gateware", action="store_true",
                         help="do not compile the gateware, only generate "
                              "HDL source files and build scripts")
+    parser.add_argument("--gateware-toolchain-path", default=None,
+                        help="set gateware toolchain (ISE, Quartus, etc.) "
+                             "installation path")
     parser.add_argument("--csr-csv", default=None,
                         help="store CSR map in CSV format into the "
                              "specified file")
@@ -154,5 +163,6 @@ def builder_argdict(args):
         "output_dir": args.output_dir,
         "compile_software": not args.no_compile_software,
         "compile_gateware": not args.no_compile_gateware,
+        "gateware_toolchain_path": args.gateware_toolchain_path,
         "csr_csv": args.csr_csv
     }