Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icebreaker-bitsy: Increase the programming routine flexibility. #187

Merged
merged 1 commit into from Dec 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions amaranth_boards/icebreaker_bitsy.py
Expand Up @@ -40,10 +40,24 @@ class ICEBreakerBitsyPlatform(LatticeICE40Platform):
)
]

def toolchain_program(self, products, name):
def toolchain_program(self, products, name, run_vid=None, run_pid=None, dfu_vid="1d50", dfu_pid="6146", reset=True):
dfu_util = os.environ.get("DFU_UTIL", "dfu-util")

# Construct the device runtime and DFU vid pid string
dev_str = ""
if run_vid or run_pid:
dev_str = "{}:{}".format(run_vid or "", run_pid or "")
dev_str += ",{}:{}".format(dfu_vid or "", dfu_pid or "")

# Construct the argument list for dfu-util
args = [dfu_util, "-d", dev_str, "-a", "0"]
if reset: args.append("-R")
args.append("-D")

# Run dfu-util
with products.extract("{}.bin".format(name)) as bitstream_filename:
subprocess.check_call([dfu_util, "-d", "1209:6146", "-a", "0", "-D", bitstream_filename])
args.append(bitstream_filename)
subprocess.check_call(args)


if __name__ == "__main__":
Expand Down