Browse Source

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

Signed-off-by: Damien George <damien@micropython.org>
pull/8441/head
Damien George 3 years ago
parent
commit
80055c2cdc
  1. 8
      ports/stm32/mboot/fwupdate.py

8
ports/stm32/mboot/fwupdate.py

@ -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…
Cancel
Save