From a175f98a65173e254d4185e51f49b11cab20ffac Mon Sep 17 00:00:00 2001 From: Oliver Joos Date: Fri, 25 Aug 2023 00:09:27 +0200 Subject: [PATCH] stm32/mboot: Fix fwupdate by replacing zlib with new deflate module. Since commit 3533924c36ae85ce6e8bf8598dd71cf16bbdb10b 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 --- ports/stm32/mboot/fwupdate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/stm32/mboot/fwupdate.py b/ports/stm32/mboot/fwupdate.py index 78a8d7365..47ceb19ba 100644 --- a/ports/stm32/mboot/fwupdate.py +++ b/ports/stm32/mboot/fwupdate.py @@ -3,7 +3,7 @@ from micropython import const import struct, time -import zlib, machine, stm +import deflate, machine, stm # Constants to be used with update_mpy VFS_FAT = 1 @@ -36,7 +36,7 @@ def dfu_read(filename): if hdr == b"Dfu": pass elif hdr == b"\x1f\x8b\x08": - f = zlib.DecompIO(f, 16 + 15) + f = deflate.DeflateIO(f, deflate.GZIP) else: print("Invalid firmware", filename) return None @@ -231,7 +231,7 @@ def update_app_elements( # Check firmware is of .dfu or .dfu.gz type try: with open(filename, "rb") as f: - hdr = zlib.DecompIO(f, 16 + 15).read(6) + hdr = deflate.DeflateIO(f, deflate.GZIP).read(6) except Exception: with open(filename, "rb") as f: hdr = f.read(6)