From 1a69f38e6e2783f0c6e46f4fbc03aad92ddfebd4 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 26 Oct 2019 18:48:00 -0400 Subject: flash_usb: Pass -t $CONFIG_MCU to flash_usb on all targets Signed-off-by: Kevin O'Connor --- scripts/flash_usb.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'scripts/flash_usb.py') 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() -- cgit v1.2.3-70-g09d2