stm32/mboot: Fix fwupdate by replacing zlib with new deflate module.

Since commit 3533924c36 the zlib module has
been replaced by the new deflate module.  This commit updates the script
fwupdate.py to use the new deflate module.

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
pull/12335/head
Oliver Joos 2023-08-25 00:09:27 +02:00 zatwierdzone przez Damien George
rodzic 32db4c58f7
commit a175f98a65
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -3,7 +3,7 @@
from micropython import const from micropython import const
import struct, time import struct, time
import zlib, machine, stm import deflate, machine, stm
# Constants to be used with update_mpy # Constants to be used with update_mpy
VFS_FAT = 1 VFS_FAT = 1
@ -36,7 +36,7 @@ def dfu_read(filename):
if hdr == b"Dfu": if hdr == b"Dfu":
pass pass
elif hdr == b"\x1f\x8b\x08": elif hdr == b"\x1f\x8b\x08":
f = zlib.DecompIO(f, 16 + 15) f = deflate.DeflateIO(f, deflate.GZIP)
else: else:
print("Invalid firmware", filename) print("Invalid firmware", filename)
return None return None
@ -231,7 +231,7 @@ def update_app_elements(
# Check firmware is of .dfu or .dfu.gz type # Check firmware is of .dfu or .dfu.gz type
try: try:
with open(filename, "rb") as f: with open(filename, "rb") as f:
hdr = zlib.DecompIO(f, 16 + 15).read(6) hdr = deflate.DeflateIO(f, deflate.GZIP).read(6)
except Exception: except Exception:
with open(filename, "rb") as f: with open(filename, "rb") as f:
hdr = f.read(6) hdr = f.read(6)