mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
Add support for a range of bootloader protocols.
This commit is contained in:
@@ -103,7 +103,8 @@ class uploader(object):
|
|||||||
REBOOT = chr(0x30)
|
REBOOT = chr(0x30)
|
||||||
|
|
||||||
INFO_BL_REV = chr(1) # bootloader protocol revision
|
INFO_BL_REV = chr(1) # bootloader protocol revision
|
||||||
BL_REV = 2 # supported bootloader protocol
|
BL_REV_MIN = 2 # minimum supported bootloader protocol
|
||||||
|
BL_REV_MAX = 3 # maximum supported bootloader protocol
|
||||||
INFO_BOARD_ID = chr(2) # board type
|
INFO_BOARD_ID = chr(2) # board type
|
||||||
INFO_BOARD_REV = chr(3) # board revision
|
INFO_BOARD_REV = chr(3) # board revision
|
||||||
INFO_FLASH_SIZE = chr(4) # max firmware size in bytes
|
INFO_FLASH_SIZE = chr(4) # max firmware size in bytes
|
||||||
@@ -240,7 +241,8 @@ class uploader(object):
|
|||||||
|
|
||||||
# get the bootloader protocol ID first
|
# get the bootloader protocol ID first
|
||||||
bl_rev = self.__getInfo(uploader.INFO_BL_REV)
|
bl_rev = self.__getInfo(uploader.INFO_BL_REV)
|
||||||
if bl_rev != uploader.BL_REV:
|
if (bl_rev < uploader.BL_REV_MIN) or (bl_rev > uploader.BL_REV_MAX):
|
||||||
|
print("Unsupported bootloader protocol %d" % uploader.INFO_BL_REV)
|
||||||
raise RuntimeError("Bootloader protocol mismatch")
|
raise RuntimeError("Bootloader protocol mismatch")
|
||||||
|
|
||||||
self.board_type = self.__getInfo(uploader.INFO_BOARD_ID)
|
self.board_type = self.__getInfo(uploader.INFO_BOARD_ID)
|
||||||
|
|||||||
Reference in New Issue
Block a user