From 8abae908388939ef5b1cebf8ba1ea16554e72e00 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 10 Jul 2026 10:18:09 -0500 Subject: [PATCH] Give the 4MB T3-S3 boards an app partition that fits (#10978) * fix(device-install): flash littlefs at the offset from firmware metadata device-install.sh read the spiffs offset out of the .mt.json metadata into SPIFFS_OFFSET, but flashed the littlefs image at $OFFSET -- a separate variable still holding the hardcoded 0x300000 default. The metadata value was never used, so any board with a non-default partition table had its filesystem written to the wrong place. Unify on SPIFFS_OFFSET, and guard both metadata overrides so a table that omits ota_1 or spiffs falls back to the built-in default instead of handing esptool an empty offset. Quote both offsets at the call site: the spiffs one is newly consumed from jq, and a multi-line result would otherwise word-split into esptool's argv and silently mis-pair address with file. device-install.bat already does all of this correctly; this brings the shell script to parity. * fix(tlora-t3s3): give the 4MB T3-S3 boards an app partition that fits tlora-t3s3-v1 and tlora-t3s3-epaper have overflowed the shared 4MB partition-table.csv app slot (ota_0 = 0x250000 = 2,424,832 bytes) on every develop build since 22072c5f4 (2026-06-20). The last green build, ca7d82629, cleared it by 881 bytes; develop is now ~38.7KB over. These envs have no board_level, so they only build in the full matrix on push to develop -- which is why no PR ever caught it. Add partition-table-t3s3.csv, dedicated to the 4MB ESP32-S3FH4R2 T3-S3 boards, and point all three t3s3 envs at it: app ota_0 0x010000 0x290000 (was 0x250000, +256KB) flashApp ota_1 0x2A0000 0x0A0000 (unchanged size) spiffs 0x340000 0x0C0000 (was 0x100000, -256KB) The headroom comes out of spiffs, not flashApp: the unified BLE OTA image is 636,544 bytes against a 655,360 byte slot, so ota_1 has nothing to give. The table is contiguous, ends exactly on the 4MB boundary, keeps both app partitions 64KB-aligned, and leaves the littlefs image these boards ship well inside the remaining 768KB. Verified with a Docker build of all three envs: tlora-t3s3-v1 2,463,504 91.7% tlora-t3s3-epaper 2,458,487 91.5% tlora-t3s3-epaper-inkhud 2,400,851 89.4% Trimming was considered and rejected. The entire emoji set is 6,304 bytes (measured A/B build), and cutting traffic management plus the paxcounter, storeforward, rangetest and atak modules recovers 46,636 -- enough to land at 99.7% full, i.e. weeks of headroom at develop's observed growth rate, in exchange for shipping a feature-reduced board. The slot was simply mis-sized for a board this full. Note this changes flash layout: existing T3-S3 units must be erased and factory-flashed once to pick up the new offsets. They already cannot run a current develop build, so no working configuration regresses. --- bin/device-install.sh | 23 ++++++++++++------- partition-table-t3s3.csv | 11 +++++++++ .../esp32s3/tlora_t3s3_epaper/platformio.ini | 4 +++- variants/esp32s3/tlora_t3s3_v1/platformio.ini | 3 ++- 4 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 partition-table-t3s3.csv diff --git a/bin/device-install.sh b/bin/device-install.sh index 52a848c38..3d20376bc 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -7,9 +7,9 @@ MCU="" # Constants RESET_BAUD=1200 FIRMWARE_OFFSET=0x00 -# Default littlefs* offset. -OFFSET=0x300000 -# Default OTA Offset +# Fallback offsets, used only when firmware metadata carries no partition table. +# These track partition-table.csv; boards with their own table override them below. +SPIFFS_OFFSET=0x300000 OTA_OFFSET=0x260000 # Determine the correct esptool command to use @@ -122,8 +122,15 @@ if [[ -f "$FILENAME" && "$FILENAME" == *.factory.bin ]]; then jq . "$METAFILE" # Extract relevant fields from metadata if [[ $(jq -r '.part' "$METAFILE") != "null" ]]; then - OTA_OFFSET=$(jq -r '.part[] | select(.subtype == "ota_1") | .offset' "$METAFILE") - SPIFFS_OFFSET=$(jq -r '.part[] | select(.subtype == "spiffs") | .offset' "$METAFILE") + META_OTA_OFFSET=$(jq -r '.part[] | select(.subtype == "ota_1") | .offset' "$METAFILE") + META_SPIFFS_OFFSET=$(jq -r '.part[] | select(.subtype == "spiffs") | .offset' "$METAFILE") + # A partition table may omit either entry; keep the built-in default then. + if [[ -n "$META_OTA_OFFSET" && "$META_OTA_OFFSET" != "null" ]]; then + OTA_OFFSET="$META_OTA_OFFSET" + fi + if [[ -n "$META_SPIFFS_OFFSET" && "$META_SPIFFS_OFFSET" != "null" ]]; then + SPIFFS_OFFSET="$META_SPIFFS_OFFSET" + fi fi MCU=$(jq -r '.mcu' "$METAFILE") else @@ -154,9 +161,9 @@ if [[ -f "$FILENAME" && "$FILENAME" == *.factory.bin ]]; then $ESPTOOL_CMD ${ESPTOOL_ERASE_FLASH} $ESPTOOL_CMD ${ESPTOOL_WRITE_FLASH} $FIRMWARE_OFFSET "${FILENAME}" echo "Trying to flash ${OTAFILE} at offset ${OTA_OFFSET}" - $ESPTOOL_CMD ${ESPTOOL_WRITE_FLASH} $OTA_OFFSET "${OTAFILE}" - echo "Trying to flash ${SPIFFSFILE}, at offset ${OFFSET}" - $ESPTOOL_CMD ${ESPTOOL_WRITE_FLASH} $OFFSET "${SPIFFSFILE}" + $ESPTOOL_CMD ${ESPTOOL_WRITE_FLASH} "$OTA_OFFSET" "${OTAFILE}" + echo "Trying to flash ${SPIFFSFILE}, at offset ${SPIFFS_OFFSET}" + $ESPTOOL_CMD ${ESPTOOL_WRITE_FLASH} "$SPIFFS_OFFSET" "${SPIFFSFILE}" else show_help diff --git a/partition-table-t3s3.csv b/partition-table-t3s3.csv new file mode 100644 index 000000000..603e2fdac --- /dev/null +++ b/partition-table-t3s3.csv @@ -0,0 +1,11 @@ +# Layout for 4MB LILYGO T3-S3 boards (ESP32-S3FH4R2). +# Reclaims 256KB from spiffs to give the app slot real headroom. +# flashApp (ota_1) keeps its full 0xA0000 (655,360 B): the unified BLE OTA image +# (meshtastic/esp32-unified-ota v1.0.1, mt-esp32s3-ota.bin) is 636,544 B, so this +# slot cannot be shrunk to fund the app slot instead. +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x009000, 0x005000, +otadata, data, ota, 0x00e000, 0x002000, +app, app, ota_0, 0x010000, 0x290000, +flashApp, app, ota_1, 0x2A0000, 0x0A0000, +spiffs, data, spiffs, 0x340000, 0x0C0000, diff --git a/variants/esp32s3/tlora_t3s3_epaper/platformio.ini b/variants/esp32s3/tlora_t3s3_epaper/platformio.ini index 0830cf303..93cd4d68d 100644 --- a/variants/esp32s3/tlora_t3s3_epaper/platformio.ini +++ b/variants/esp32s3/tlora_t3s3_epaper/platformio.ini @@ -13,9 +13,10 @@ custom_meshtastic_has_ink_hud = true extends = esp32s3_base board = tlora-t3s3-v1 board_check = true +board_build.partitions = partition-table-t3s3.csv upload_protocol = esptool -build_flags = +build_flags = ${esp32s3_base.build_flags} -D TLORA_T3S3_EPAPER -I variants/esp32s3/tlora_t3s3_epaper @@ -40,6 +41,7 @@ lib_deps = extends = esp32s3_base, inkhud board = tlora-t3s3-v1 board_check = true +board_build.partitions = partition-table-t3s3.csv upload_protocol = esptool custom_sdkconfig = ${esp32s3_base.custom_sdkconfig} diff --git a/variants/esp32s3/tlora_t3s3_v1/platformio.ini b/variants/esp32s3/tlora_t3s3_v1/platformio.ini index 95686e417..96103df82 100644 --- a/variants/esp32s3/tlora_t3s3_v1/platformio.ini +++ b/variants/esp32s3/tlora_t3s3_v1/platformio.ini @@ -12,9 +12,10 @@ custom_meshtastic_requires_dfu = true extends = esp32s3_base board = tlora-t3s3-v1 board_check = true +board_build.partitions = partition-table-t3s3.csv upload_protocol = esptool -build_flags = +build_flags = ${esp32s3_base.build_flags} -D TLORA_T3S3_V1 -I variants/esp32s3/tlora_t3s3_v1