|
|
|
@ -87,6 +87,10 @@ if sys.version_info[0] < 3:
@@ -87,6 +87,10 @@ if sys.version_info[0] < 3:
|
|
|
|
|
else: |
|
|
|
|
runningPython3 = True |
|
|
|
|
|
|
|
|
|
# dictionary of bootloader {boardID: (firmware boardID, boardname), ...} |
|
|
|
|
# designating firmware builds compatible with multiple boardIDs |
|
|
|
|
compatible_IDs = {33: (9, 'AUAVX2.1')} |
|
|
|
|
|
|
|
|
|
class firmware(object): |
|
|
|
|
'''Loads a firmware file''' |
|
|
|
|
|
|
|
|
@ -504,13 +508,25 @@ class uploader(object):
@@ -504,13 +508,25 @@ class uploader(object):
|
|
|
|
|
def upload(self, fw, force=False, boot_delay=None): |
|
|
|
|
# Make sure we are doing the right thing |
|
|
|
|
if self.board_type != fw.property('board_id'): |
|
|
|
|
msg = "Firmware not suitable for this board (board_type=%u board_id=%u)" % ( |
|
|
|
|
self.board_type, fw.property('board_id')) |
|
|
|
|
print("WARNING: %s" % msg) |
|
|
|
|
if force: |
|
|
|
|
print("FORCED WRITE, FLASHING ANYWAY!") |
|
|
|
|
else: |
|
|
|
|
raise IOError(msg) |
|
|
|
|
# ID mismatch: check compatibility |
|
|
|
|
incomp = True |
|
|
|
|
if self.board_type in compatible_IDs: |
|
|
|
|
comp_fw_id = compatible_IDs[self.board_type][0] |
|
|
|
|
board_name = compatible_IDs[self.board_type][1] |
|
|
|
|
if comp_fw_id == fw.property('board_id'): |
|
|
|
|
msg = "Target %s (board_id: %d) is compatible with firmware for board_id=%u)" % ( |
|
|
|
|
board_name, self.board_type, fw.property('board_id')) |
|
|
|
|
print("INFO: %s" % msg) |
|
|
|
|
incomp = False |
|
|
|
|
if incomp: |
|
|
|
|
msg = "Firmware not suitable for this board (board_type=%u board_id=%u)" % ( |
|
|
|
|
self.board_type, fw.property('board_id')) |
|
|
|
|
print("WARNING: %s" % msg) |
|
|
|
|
|
|
|
|
|
if force: |
|
|
|
|
print("FORCED WRITE, FLASHING ANYWAY!") |
|
|
|
|
else: |
|
|
|
|
raise IOError(msg) |
|
|
|
|
if self.fw_maxsize < fw.property('image_size'): |
|
|
|
|
raise RuntimeError("Firmware image is too large for this board") |
|
|
|
|
|
|
|
|
|