Skip to content

Commit

Permalink
Tools: uploader.py: verify correct install
Browse files Browse the repository at this point in the history
- Implement functionality to verify correct firmware installation
- Utilize existing code with an additional argument for verification
  • Loading branch information
rafasaurus authored and peterbarker committed Feb 6, 2025
1 parent 034a760 commit 7ef59ff
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tools/scripts/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,20 @@ def board_name_for_board_id(self, board_id):
print("Failed to get name: %s" % str(e))
return None

# Verify firmware version on board matches provided version
def verify_firmware_is(self, fw, boot_delay=None):
if self.bl_rev == 2:
self.__verify_v2("Verify ", fw)
else:
self.__verify_v3("Verify ", fw)

if boot_delay is not None:
self.__set_boot_delay(boot_delay)

print("\nRebooting.\n")
self.__reboot()
self.port.close()

# upload the firmware
def upload(self, fw, force=False, boot_delay=None):
# Make sure we are doing the right thing
Expand Down Expand Up @@ -1120,6 +1134,8 @@ def main():
)
parser.add_argument('--download', action='store_true', default=False, help='download firmware from board')
parser.add_argument('--identify', action="store_true", help="Do not flash firmware; simply dump information about board")
parser.add_argument('--verify-firmware-is', action="store_true",
help="Do not flash firmware; verify that the firmware on the board matches the supplied firmware")
parser.add_argument('--no-extf', action="store_true", help="Do not attempt external flash operations")
parser.add_argument('--erase-extflash', type=lambda x: int(x, 0), default=None,
help="Erase sectors containing specified amount of bytes from ext flash")
Expand Down Expand Up @@ -1183,6 +1199,8 @@ def main():
up.dump_board_info()
elif args.download:
up.download(args.firmware)
elif args.verify_firmware_is:
up.verify_firmware_is(fw, boot_delay=args.boot_delay)
elif args.erase_extflash:
up.erase_extflash('Erase ExtF', args.erase_extflash)
print("\nExtF Erase Finished")
Expand Down

0 comments on commit 7ef59ff

Please sign in to comment.