Skip to content

Commit

Permalink
scripts: Update uploader to read git hash from bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
joshanne committed Oct 29, 2024
1 parent 4367132 commit da23530
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Tools/scripts/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit da23530

Please sign in to comment.