From 918020202d495fc764bb998056175f2977c5c063 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 5 May 2024 22:17:10 +0200 Subject: [PATCH] Safeboot show correct flash partition size (#21366) --- pio-tools/name-firmware.py | 8 ++++++++ platformio_tasmota_env32.ini | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/pio-tools/name-firmware.py b/pio-tools/name-firmware.py index 6b32b771f..d26cd7da1 100644 --- a/pio-tools/name-firmware.py +++ b/pio-tools/name-firmware.py @@ -5,6 +5,7 @@ import shutil import pathlib import tasmotapiolib from os.path import join +from colorama import Fore, Back, Style def bin_map_copy(source, target, env): @@ -17,6 +18,13 @@ def bin_map_copy(source, target, env): firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin") if env["PIOPLATFORM"] == "espressif32": + if("safeboot" in firmware_name): + SAFEBOOT_SIZE = firsttarget.stat().st_size + if SAFEBOOT_SIZE > 851967: + print(Fore.RED + "!!! Tasmota safeboot size is too big with {} bytes. Max size is 851967 bytes !!! ".format( + SAFEBOOT_SIZE + ) + ) if("safeboot" not in firmware_name): factory_tmp = pathlib.Path(firsttarget).with_suffix("") factory = factory_tmp.with_suffix(factory_tmp.suffix + ".factory.bin") diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index 89f50669d..38f0145ba 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -29,6 +29,7 @@ custom_files_upload = no_files [env:tasmota32-safeboot] extends = env:tasmota32_base board = esp32_solo1 +board_build.app_partition_name = safeboot build_flags = ${env:tasmota32_base.build_flags} -DFRAMEWORK_ARDUINO_SOLO1 -DFIRMWARE_SAFEBOOT @@ -39,6 +40,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32solo1-safeboot] extends = env:tasmota32_base board = esp32_solo1 +board_build.app_partition_name = safeboot build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_SAFEBOOT -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32solo1-safeboot.bin"' @@ -48,6 +50,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32s2-safeboot] extends = env:tasmota32_base board = esp32s2 +board_build.app_partition_name = safeboot build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_SAFEBOOT -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32s2-safeboot.bin"' @@ -57,6 +60,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32s2cdc-safeboot] extends = env:tasmota32_base board = esp32s2cdc +board_build.app_partition_name = safeboot build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_SAFEBOOT -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32s2cdc-safeboot.bin"' @@ -66,6 +70,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32c2-safeboot] extends = env:tasmota32_base board = esp32c2 +board_build.app_partition_name = safeboot build_unflags = ${env:tasmota32_base.build_unflags} -mtarget-align build_flags = ${env:tasmota32_base.build_flags} @@ -77,6 +82,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32c3-safeboot] extends = env:tasmota32_base board = esp32c3 +board_build.app_partition_name = safeboot build_unflags = ${env:tasmota32_base.build_unflags} -mtarget-align build_flags = ${env:tasmota32_base.build_flags} @@ -88,6 +94,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32c3ser-safeboot] extends = env:tasmota32_base board = esp32c3ser +board_build.app_partition_name = safeboot build_unflags = ${env:tasmota32_base.build_unflags} -mtarget-align build_flags = ${env:tasmota32_base.build_flags} @@ -99,6 +106,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32s3-safeboot] extends = env:tasmota32_base board = esp32s3-qio_qspi +board_build.app_partition_name = safeboot build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_SAFEBOOT -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32s3-safeboot.bin"' @@ -108,6 +116,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32c6-safeboot] extends = env:tasmota32_base board = esp32c6 +board_build.app_partition_name = safeboot build_unflags = ${env:tasmota32_base.build_unflags} -mtarget-align build_flags = ${env:tasmota32_base.build_flags} @@ -119,6 +128,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32c6ser-safeboot] extends = env:tasmota32_base board = esp32c6ser +board_build.app_partition_name = safeboot build_unflags = ${env:tasmota32_base.build_unflags} -mtarget-align build_flags = ${env:tasmota32_base.build_flags} @@ -130,6 +140,7 @@ lib_ignore = ${safeboot_flags.lib_ignore} [env:tasmota32s3ser-safeboot] extends = env:tasmota32_base board = esp32s3ser-qio_qspi +board_build.app_partition_name = safeboot build_flags = ${env:tasmota32_base.build_flags} -DFIRMWARE_SAFEBOOT -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32s3ser-safeboot.bin"'