stm32/mboot/fwupdate.py: Simplify calculation of CRC32.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-03-22 11:42:52 +11:00
parent bf89e336b9
commit 80055c2cdc

View File

@ -75,12 +75,10 @@ def dfu_read(filename):
return None
hdr = f.read(16)
crc = crc32(hdr[:-4], crc)
hdr = struct.unpack("<HHHH3sBI", hdr)
crc = crc32(hdr, crc)
crc = ~crc & 0xFFFFFFFF
if crc != hdr[-1]:
print("CRC failed", crc, hdr[-1])
if crc != 0:
print("CRC failed", crc)
return None
return elems