Make a wrong size of the flashcrc struct an error becuase it might lead to misaligned CRCs in the structure

This commit is contained in:
Mario Hüttel 2021-10-23 21:26:01 +02:00
parent 288b19c4fc
commit e3a552248d

View File

@ -89,7 +89,8 @@ with open(filename, 'r+b') as f:
print('Section for flash CRC missing!') print('Section for flash CRC missing!')
sys.exit(-1) sys.exit(-1)
if flashcrc_sec.data_size != 6*4: if flashcrc_sec.data_size != 6*4:
print("Warning!!! .flashcrc section has wrong size:",flashcrc_sec.data_size) print("Error: .flashcrc section has wrong size:",flashcrc_sec.data_size)
sys.exit(-1);
crc_sec_data = bytearray(flashcrc_sec.data()) crc_sec_data = bytearray(flashcrc_sec.data())
magic1 = struct.unpack('<I'*1, bytes(crc_sec_data[0:4]))[0] magic1 = struct.unpack('<I'*1, bytes(crc_sec_data[0:4]))[0]