Implemented SC6531C flashing support

This commit is contained in:
Luxferre
2021-12-28 01:43:12 +02:00
parent a07d91aa0f
commit eb034239db
2 changed files with 9 additions and 5 deletions
+7 -1
View File
@@ -10,6 +10,7 @@ import unicmd
UNISOC_VID = 0x1782
UNISOC_PID = 0x4d00
UNISOC_FLASH_BASE_ADDR = 0x10000000
UNISOC_FLASH_BASE_ADDR_OLD = 0x30000000
MAX_PKT_SIZE = 1024
bSize = 512 # read block size
genTimeout = 120000
@@ -98,7 +99,7 @@ def send_file_to_addr(fname, faddr, fdlBooted = False, flashMode = False, fbs =
print('\nEnding data transfer...')
resp = reqresp(unicmd.cmd_data_end(), fdlBooted)
rcode, rlen, r = unicmd.resp_decode(resp, fdlBooted)
if not flashMode or (rcode != unicmd.BSL_FLASH_CFG_ERROR and rcode != unicmd.BSL_WRITE_ERROR): # on flashing, ignore 0xA2 and 0xA4 errors
if not flashMode or (rcode != unicmd.BSL_FLASH_CFG_ERROR and rcode != unicmd.BSL_WRITE_ERROR and rcode != 0xFF): # on flashing, ignore 0xA2, 0xA4 and 0xFF errors
assert rcode == unicmd.BSL_REP_ACK, 'Could not finalize data transfer, response code is %X' % rcode
print('Data transfer successful')
@@ -237,6 +238,11 @@ if __name__ == '__main__': # main app start
fdl1Label = 'FDL1'
fdl2Label = 'FDL2'
# override flash base addr based on the target
if target.startswith('sc6530'):
UNISOC_FLASH_BASE_ADDR = UNISOC_FLASH_BASE_ADDR_OLD
if args.flash_noremap == True:
print('Flash remapping disabled')
UNISOC_FLASH_BASE_ADDR = 0