mirror of
https://github.com/m-labs/artiq.git
synced 2025-01-14 12:58:56 +08:00
coremgmt flashing: detect risc-v or zynq targets
This commit is contained in:
parent
de349e4c39
commit
e36916b931
@ -93,10 +93,6 @@ def get_argparser():
|
|||||||
t_flash = tools.add_parser("flash",
|
t_flash = tools.add_parser("flash",
|
||||||
help="flash the running system")
|
help="flash the running system")
|
||||||
|
|
||||||
p_zynq = t_flash.add_argument("-z", "--zynq", default=False,
|
|
||||||
help="target zynq device",
|
|
||||||
action="store_true")
|
|
||||||
|
|
||||||
p_directory = t_flash.add_argument("directory",
|
p_directory = t_flash.add_argument("directory",
|
||||||
metavar="DIRECTORY", type=str,
|
metavar="DIRECTORY", type=str,
|
||||||
help="directory that contains the "
|
help="directory that contains the "
|
||||||
@ -167,15 +163,36 @@ def main():
|
|||||||
mgmt.config_erase()
|
mgmt.config_erase()
|
||||||
|
|
||||||
if args.tool == "flash":
|
if args.tool == "flash":
|
||||||
if args.zynq:
|
retrieved_bins = []
|
||||||
boot = os.path.join(args.directory, "boot.bin")
|
bin_dict = {
|
||||||
bins = [boot]
|
"zynq":[
|
||||||
else:
|
["boot"]
|
||||||
gateware = fetch_bin(args.directory, "gateware", args.srcbuild)
|
],
|
||||||
bootloader = fetch_bin(args.directory, "bootloader", args.srcbuild)
|
"riscv": [
|
||||||
firmware = fetch_bin(args.directory, ["runtime", "satman"], args.srcbuild)
|
["gateware"],
|
||||||
bins = [gateware, bootloader, firmware]
|
["bootloader"],
|
||||||
|
["runtime", "satman"],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
for bin_list in bin_dict.values():
|
||||||
|
try:
|
||||||
|
bins = []
|
||||||
|
for bin_name in bin_list:
|
||||||
|
bins.append(fetch_bin(
|
||||||
|
args.directory, bin_name, args.srcbuild))
|
||||||
|
retrieved_bins.append(bins)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if retrieved_bins is None:
|
||||||
|
raise FileNotFoundError("both risc-v and zynq binaries not found")
|
||||||
|
|
||||||
|
if len(retrieved_bins) > 1:
|
||||||
|
raise ValueError("both risc-v and zynq binaries were found, "
|
||||||
|
"please clean up your build directory. ")
|
||||||
|
|
||||||
|
bins = retrieved_bins[0]
|
||||||
mgmt.flash(bins)
|
mgmt.flash(bins)
|
||||||
|
|
||||||
if args.tool == "reboot":
|
if args.tool == "reboot":
|
||||||
|
Loading…
Reference in New Issue
Block a user