diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-10-26 18:48:00 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-10-26 18:48:00 -0400 |
commit | 1a69f38e6e2783f0c6e46f4fbc03aad92ddfebd4 (patch) | |
tree | 8072f27dd06b4d48be32825e0eb7be70a015a754 /scripts/flash_usb.py | |
parent | 538d6ac3a278ae7e3f7ff55ea67c17012d063733 (diff) | |
download | kutter-1a69f38e6e2783f0c6e46f4fbc03aad92ddfebd4.tar.gz kutter-1a69f38e6e2783f0c6e46f4fbc03aad92ddfebd4.tar.xz kutter-1a69f38e6e2783f0c6e46f4fbc03aad92ddfebd4.zip |
flash_usb: Pass -t $CONFIG_MCU to flash_usb on all targets
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts/flash_usb.py')
-rwxr-xr-x | scripts/flash_usb.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/scripts/flash_usb.py b/scripts/flash_usb.py index 13fa51b3..bead418c 100755 --- a/scripts/flash_usb.py +++ b/scripts/flash_usb.py @@ -211,9 +211,9 @@ def flash_stm32f4(options, binfile): sys.exit(-1) MCUTYPES = { - 'atsam3': flash_atsam3, 'atsam4': flash_atsam4, 'atsamd': flash_atsamd, - 'lpc176x': flash_lpc176x, 'stm32f1': flash_stm32f1, - 'stm32f4': flash_stm32f4, 'stm32f0': flash_stm32f4, + 'sam3': flash_atsam3, 'sam4': flash_atsam4, 'samd': flash_atsamd, + 'lpc176': flash_lpc176x, 'stm32f103': flash_stm32f1, + 'stm32f4': flash_stm32f4, 'stm32f042': flash_stm32f4, } @@ -235,12 +235,19 @@ def main(): options, args = opts.parse_args() if len(args) != 1: opts.error("Incorrect number of arguments") - if options.mcutype not in MCUTYPES: - opts.error("Not a valid mcu type") + flash_func = None + if options.mcutype: + for prefix, func in MCUTYPES.items(): + if options.mcutype.startswith(prefix): + flash_func = func + break + if flash_func is None: + opts.error("USB flashing is not supported for MCU '%s'" + % (options.mcutype,)) if not options.device: sys.stderr.write("\nPlease specify FLASH_DEVICE\n\n") sys.exit(-1) - MCUTYPES[options.mcutype](options, args[0]) + flash_func(options, args[0]) if __name__ == '__main__': main() |