From da2353006aa7522410e85f0d03f90a196bc38f77 Mon Sep 17 00:00:00 2001 From: James O'Shannessy <12959316+joshanne@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:23:10 +1100 Subject: [PATCH] scripts: Update uploader to read git hash from bootloader --- Tools/scripts/uploader.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tools/scripts/uploader.py b/Tools/scripts/uploader.py index b926b26c23279..1f620b92c2e01 100755 --- a/Tools/scripts/uploader.py +++ b/Tools/scripts/uploader.py @@ -239,11 +239,12 @@ class uploader(object): INFO_BL_REV = b'\x01' # bootloader protocol revision BL_REV_MIN = 2 # minimum supported bootloader protocol - BL_REV_MAX = 5 # maximum supported bootloader protocol + BL_REV_MAX = 6 # maximum supported bootloader protocol INFO_BOARD_ID = b'\x02' # board type INFO_BOARD_REV = b'\x03' # board revision INFO_FLASH_SIZE = b'\x04' # max firmware size in bytes INFO_EXTF_SIZE = b'\x06' # available external flash size + INFO_GIT_HASH = b'\x07' # git hash of bootloader build PROG_MULTI_MAX = 252 # protocol max is 255, must be multiple of 4 READ_MULTI_MAX = 252 # protocol max is 255 @@ -737,6 +738,10 @@ def identify(self): self.board_rev = self.__getInfo(uploader.INFO_BOARD_REV) self.fw_maxsize = self.__getInfo(uploader.INFO_FLASH_SIZE) + # Git SHA introduced added in v6 + if self.bl_rev > 5: + self.git_hash = self.__getInfo(uploader.INFO_GIT_HASH) + def dump_board_info(self): # OTP added in v4: print("Bootloader Protocol: %u" % self.bl_rev) @@ -839,6 +844,9 @@ def dump_board_info(self): print(" board_type: %u" % self.board_type) print(" board_rev: %u" % self.board_rev) + git_hash = "%x" % (self.git_hash) if self.bl_rev > 5 else "UNKNOWN" + print(" git hash: %s" % git_hash) + print("Identification complete") def board_name_for_board_id(self, board_id):