integration/builder: add gateware toolchain path command line switch

This commit is contained in:
Sebastien Bourdeauducq 2015-11-04 14:57:48 +08:00
parent db111a6eb0
commit 71fd951df2
1 changed files with 11 additions and 1 deletions

View File

@ -30,6 +30,7 @@ def _makefile_escape(s):
class Builder: class Builder:
def __init__(self, soc, output_dir=None, def __init__(self, soc, output_dir=None,
compile_software=True, compile_gateware=True, compile_software=True, compile_gateware=True,
gateware_toolchain_path=None,
csr_csv=None): csr_csv=None):
self.soc = soc self.soc = soc
if output_dir is None: if output_dir is None:
@ -41,6 +42,7 @@ class Builder:
self.output_dir = os.path.abspath(output_dir) self.output_dir = os.path.abspath(output_dir)
self.compile_software = compile_software self.compile_software = compile_software
self.compile_gateware = compile_gateware self.compile_gateware = compile_gateware
self.gateware_toolchain_path = gateware_toolchain_path
self.csr_csv = csr_csv self.csr_csv = csr_csv
self.software_packages = [] self.software_packages = []
@ -130,8 +132,12 @@ class Builder:
self._generate_includes() self._generate_includes()
self._generate_software() self._generate_software()
self._initialize_rom() 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"), 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): def builder_args(parser):
@ -144,6 +150,9 @@ def builder_args(parser):
parser.add_argument("--no-compile-gateware", action="store_true", parser.add_argument("--no-compile-gateware", action="store_true",
help="do not compile the gateware, only generate " help="do not compile the gateware, only generate "
"HDL source files and build scripts") "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, parser.add_argument("--csr-csv", default=None,
help="store CSR map in CSV format into the " help="store CSR map in CSV format into the "
"specified file") "specified file")
@ -154,5 +163,6 @@ def builder_argdict(args):
"output_dir": args.output_dir, "output_dir": args.output_dir,
"compile_software": not args.no_compile_software, "compile_software": not args.no_compile_software,
"compile_gateware": not args.no_compile_gateware, "compile_gateware": not args.no_compile_gateware,
"gateware_toolchain_path": args.gateware_toolchain_path,
"csr_csv": args.csr_csv "csr_csv": args.csr_csv
} }