diff options
author | Reto Kramer <kramer@acm.org> | 2019-08-24 09:31:10 -0700 |
---|---|---|
committer | Reto Kramer <kramer@acm.org> | 2019-08-24 09:31:10 -0700 |
commit | 36835421cc1743136b9d106cc1fe1a4b13168cd6 (patch) | |
tree | 76b99c2d2ae64dd237b320aec9602fac27ff7fb8 | |
parent | 05c09bedc191a8f72681470b23a97468e7971b6f (diff) |
Add .dfu file creation in workshop_rgb.py
-rw-r--r-- | litex/workshop_rgb.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/litex/workshop_rgb.py b/litex/workshop_rgb.py index 345c294..d98badf 100644 --- a/litex/workshop_rgb.py +++ b/litex/workshop_rgb.py @@ -7,7 +7,7 @@ LX_DEPENDENCIES = ["icestorm", "yosys", "nextpnr-ice40"] LX_CONFIG = "skip-git" # Import lxbuildenv to integrate the deps/ directory -import os,sys +import os,os.path,shutil,sys,subprocess sys.path.insert(0, os.path.dirname(__file__)) import lxbuildenv @@ -108,6 +108,12 @@ class BaseSoC(SoCCore): if placer is not None: platform.toolchain.nextpnr_build_template[1] += " --placer {}".format(placer) +def add_dfu_suffix(fn): + fn_base, ext = os.path.splitext(fn) + fn_dfu = fn_base + '.dfu' + shutil.copyfile(fn, fn_dfu) + subprocess.check_call(['dfu-suffix', '--pid', '1209', '--vid', '5bf0', '--add', fn_dfu]) + def main(): parser = argparse.ArgumentParser( description="Build Fomu Main Gateware") @@ -139,6 +145,7 @@ def main(): compile_software=False) vns = builder.build() soc.do_exit(vns) + add_dfu_suffix(os.path.join('build', 'gateware', 'top.bin')) if __name__ == "__main__": main() |