diff --git a/flashing/flash_firmware.py b/flashing/flash_firmware.py index 4d0790b..be1e138 100644 --- a/flashing/flash_firmware.py +++ b/flashing/flash_firmware.py @@ -9,10 +9,10 @@ from pyocd.flash.file_programmer import FileProgrammer from mac_address_reader import MacAddressReader parser = argparse.ArgumentParser() -parser.add_argument("-a", "--all", action="store_true", help="Flash softdevice and firmware.") -parser.add_argument("--only-mac", action="store_true", help="Read only the mac address from controller.") -parser.add_argument("-s", "--softdevice", action="store", help="File path to softdevice file.", default="../sdk/s140nrf52720/s140_nrf52_7.2.0_softdevice.hex", type=Path) -parser.add_argument("-f", "--firmware", action="store", help="File path to firmware file.", default="../code/b-parasite/_build/nrf52840_xxaa.hex", type=Path) +parser.add_argument("-s", "--softdevice", action="store", help="Optional file path to softdevice file.", default="../sdk/s140nrf52720/s140_nrf52_7.2.0_softdevice.hex", type=Path) +parser.add_argument("-f", "--firmware", action="store", help="Optional file path to firmware file.", default="../code/b-parasite/_build/nrf52840_xxaa.hex", type=Path) +parser.add_argument("--skip-softdevice", action="store_true", help="Skip flashing of the softdevice.") +parser.add_argument("--skip-firmware", action="store_true", help="Skip flashing of firmware.") args = parser.parse_args() @@ -21,15 +21,15 @@ with ConnectHelper.session_with_chosen_probe() as session: board = session.board target: Target = board.target - if not args.only_mac: - if args.all: - softdevice_path: Path = args.softdevice - print(f"Flashing softdevice {softdevice_path.name}...") - FileProgrammer(session).program(str(softdevice_path)) + if not args.skip_softdevice: + softdevice_path: Path = args.softdevice + print(f"Flashing softdevice {softdevice_path.name}...") + FileProgrammer(session).program(str(softdevice_path)) - target.reset_and_halt() - target.resume() + target.reset_and_halt() + target.resume() + if not args.skip_firmware: firmware_path: Path = args.firmware print(f"Flashing firmware {firmware_path.name}...") FileProgrammer(session).program(str(firmware_path))