stm32/mboot/fwupdate.py: Simplify calculation of CRC32.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
bf89e336b9
commit
80055c2cdc
ports/stm32/mboot
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue