From fdef240ea484a31a53e6e0966896cb683deb0bfb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 30 Oct 2023 18:07:24 +0100 Subject: [PATCH] fix resize for FS >16MB (#19880) --- pio-tools/post_esp32.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pio-tools/post_esp32.py b/pio-tools/post_esp32.py index 8cbc2809f..dbc1651ff 100644 --- a/pio-tools/post_esp32.py +++ b/pio-tools/post_esp32.py @@ -113,9 +113,12 @@ def patch_partitions_bin(size_string): binary_data = file.read(0xb0) import hashlib bin_list = list(binary_data) - size = codecs.decode(size_string[2:], 'hex_codec') # 0xc50000 -> [c5,00,00] - bin_list[0x8a] = size[0] - bin_list[0x8b] = size[1] + size_string = int(size_string[2:],16) + size_string = f"{size_string:08X}" + size = codecs.decode(size_string, 'hex_codec') # 0xc50000 -> [00,c5,00,00] + bin_list[0x89] = size[2] + bin_list[0x8a] = size[1] + bin_list[0x8b] = size[0] result = hashlib.md5(bytes(bin_list[0:0xa0])) partition_data = bytes(bin_list) + result.digest() file.seek(0)