artiq_flash: do not suppress useful backtrace information

This commit is contained in:
Sebastien Bourdeauducq 2018-03-22 17:11:21 +08:00
parent f2cc2a5ff2
commit eeedcfbdd7
1 changed files with 36 additions and 39 deletions

View File

@ -327,46 +327,43 @@ def main():
atexit.register(lambda: os.unlink(bin_filename)) atexit.register(lambda: os.unlink(bin_filename))
return bin_filename return bin_filename
try: for action in args.action:
for action in args.action: if action == "gateware":
if action == "gateware": gateware_bin = convert_gateware(
gateware_bin = convert_gateware( artifact_path(variant, "gateware", "top.bit"))
artifact_path(variant, "gateware", "top.bit")) programmer.write_binary(*config["gateware"], gateware_bin)
programmer.write_binary(*config["gateware"], gateware_bin) if args.target == "sayma":
if args.target == "sayma": rtm_gateware_bin = convert_gateware(
rtm_gateware_bin = convert_gateware( artifact_path("rtm_gateware", "rtm.bit"), header=True)
artifact_path("rtm_gateware", "rtm.bit"), header=True) programmer.write_binary(*config["rtm_gateware"],
programmer.write_binary(*config["rtm_gateware"], rtm_gateware_bin)
rtm_gateware_bin) elif action == "bootloader":
elif action == "bootloader": bootloader_bin = artifact_path(variant, "software", "bootloader", "bootloader.bin")
bootloader_bin = artifact_path(variant, "software", "bootloader", "bootloader.bin") programmer.write_binary(*config["bootloader"], bootloader_bin)
programmer.write_binary(*config["bootloader"], bootloader_bin) elif action == "storage":
elif action == "storage": storage_img = args.storage
storage_img = args.storage programmer.write_binary(*config["storage"], storage_img)
programmer.write_binary(*config["storage"], storage_img) elif action == "firmware":
elif action == "firmware": if variant == "satellite":
if variant == "satellite": firmware = "satman"
firmware = "satman"
else:
firmware = "runtime"
firmware_fbi = artifact_path(variant, "software", firmware, firmware + ".fbi")
programmer.write_binary(*config["firmware"], firmware_fbi)
elif action == "load":
if args.target == "sayma":
rtm_gateware_bit = artifact_path("rtm_gateware", "rtm.bit")
programmer.load(rtm_gateware_bit, 0)
gateware_bit = artifact_path(variant, "gateware", "top.bit")
programmer.load(gateware_bit, 1)
else:
gateware_bit = artifact_path(variant, "gateware", "top.bit")
programmer.load(gateware_bit, 0)
elif action == "start":
programmer.start()
else: else:
raise ValueError("invalid action", action) firmware = "runtime"
except FileNotFoundError as e:
raise SystemExit(e) firmware_fbi = artifact_path(variant, "software", firmware, firmware + ".fbi")
programmer.write_binary(*config["firmware"], firmware_fbi)
elif action == "load":
if args.target == "sayma":
rtm_gateware_bit = artifact_path("rtm_gateware", "rtm.bit")
programmer.load(rtm_gateware_bit, 0)
gateware_bit = artifact_path(variant, "gateware", "top.bit")
programmer.load(gateware_bit, 1)
else:
gateware_bit = artifact_path(variant, "gateware", "top.bit")
programmer.load(gateware_bit, 0)
elif action == "start":
programmer.start()
else:
raise ValueError("invalid action", action)
if args.dry_run: if args.dry_run:
print("\n".join(programmer.script())) print("\n".join(programmer.script()))