diff --git a/litex/build/lattice/trellis.py b/litex/build/lattice/trellis.py index fa19b9192..bc908a942 100644 --- a/litex/build/lattice/trellis.py +++ b/litex/build/lattice/trellis.py @@ -118,10 +118,10 @@ _build_template = [ "yosys -l {build_name}.rpt {build_name}.ys", "nextpnr-ecp5 --json {build_name}.json --lpf {build_name}.lpf --textcfg {build_name}.config \ --{architecture} --package {package} --speed {speed_grade} {timefailarg} {ignoreloops}", - "ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit" + "ecppack {build_name}.config --svf {build_name}.svf --bit {build_name}.bit --bootaddr={bootaddr}" ] -def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict, ignoreloops): +def _build_script(source, build_template, build_name, architecture, package, speed_grade, timingstrict, ignoreloops, bootaddr): if sys.platform in ("win32", "cygwin"): script_ext = ".bat" script_contents = "@echo off\nrem Autogenerated by LiteX / git: " + tools.get_litex_git_revision() + "\n\n" @@ -140,6 +140,7 @@ def _build_script(source, build_template, build_name, architecture, package, spe speed_grade = speed_grade, timefailarg = "--timing-allow-fail" if not timingstrict else "", ignoreloops = "--ignore-loops" if ignoreloops else "", + bootaddr = bootaddr, fail_stmt = fail_stmt) script_file = "build_" + build_name + script_ext @@ -186,6 +187,7 @@ class LatticeTrellisToolchain: nowidelut = False, timingstrict = False, ignoreloops = False, + bootaddr = 0, **kwargs): # Create build directory @@ -217,7 +219,7 @@ class LatticeTrellisToolchain: # Generate build script script = _build_script(False, self.build_template, build_name, architecture, package, - speed_grade, timingstrict, ignoreloops) + speed_grade, timingstrict, ignoreloops, bootaddr) # Run if run: @@ -244,10 +246,13 @@ def trellis_args(parser): help="fail if timing not met, i.e., do NOT pass '--timing-allow-fail' to nextpnr") parser.add_argument("--nextpnr-ignoreloops", action="store_true", help="ignore combinational loops in timing analysis, i.e. pass '--ignore-loops' to nextpnr") + parser.add_argument("--ecppack-bootaddr", default=0, + help="Set boot address for next image, i.e. pass '--bootaddr xxx' to ecppack") def trellis_argdict(args): return { "nowidelut": args.yosys_nowidelut, "timingstrict": args.nextpnr_timingstrict, "ignoreloops": args.nextpnr_ignoreloops, + "bootaddr": args.ecppack_bootaddr }