Shrink LittleFS partition, grow OTA app slots

Web assets only use ~489 KB but the default 1.375 MB spiffs
partition wasted the rest. Rebalance to 768 KB spiffs / 1.56 MB
per app slot (was 1.25 MB), giving the tight esp32 build real
headroom (99.6% -> 79.7% flash used) while preserving dual-slot
OTA. Wire the custom layout into both the local PlatformIO build
(new partitions.csv + platformio.ini) and the Arduino-CLI CI/release
pipeline (PartitionScheme=custom, matching littlefs image size and
merge_bin offset).
This commit is contained in:
Frédéric Metrich 2026-09-05 23:15:29 +02:00
parent db22c16bb3
commit 182d859870
4 changed files with 83 additions and 16 deletions

View file

@ -44,7 +44,7 @@ jobs:
- name: Create LittleFS - name: Create LittleFS
run: | run: |
./mklittlefs/mklittlefs --create data --size 1441792 SomfyController.littlefs.bin ./mklittlefs/mklittlefs --create data --size 786432 SomfyController.littlefs.bin
- name: Upload binaries - name: Upload binaries
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@ -65,22 +65,22 @@ jobs:
- board: esp32 - board: esp32
addr_bootloader: 0x1000 addr_bootloader: 0x1000
chip: ESP32 chip: ESP32
fqbn: esp32:esp32:esp32 fqbn: esp32:esp32:esp32:PartitionScheme=custom
name: ESP32 name: ESP32
- board: lolin_c3_mini - board: lolin_c3_mini
addr_bootloader: 0x0 addr_bootloader: 0x0
chip: ESP32-C3 chip: ESP32-C3
fqbn: esp32:esp32:lolin_c3_mini fqbn: esp32:esp32:lolin_c3_mini:PartitionScheme=custom
name: LOLIN-C3-mini name: LOLIN-C3-mini
- board: lolin_s2_mini - board: lolin_s2_mini
addr_bootloader: 0x1000 addr_bootloader: 0x1000
chip: ESP32-S2 chip: ESP32-S2
fqbn: esp32:esp32:lolin_s2_mini fqbn: esp32:esp32:lolin_s2_mini:PartitionScheme=custom
name: LOLIN-S2-mini name: LOLIN-S2-mini
- board: lolin_s3_mini - board: lolin_s3_mini
addr_bootloader: 0x0 addr_bootloader: 0x0
chip: ESP32-S3 chip: ESP32-S3
fqbn: esp32:esp32:lolin_s3_mini fqbn: esp32:esp32:lolin_s3_mini:PartitionScheme=custom
name: LOLIN-S3-mini name: LOLIN-S3-mini
steps: steps:
@ -137,7 +137,7 @@ jobs:
${{ matrix.addr_bootloader }} build/SomfyController.ino.bootloader.bin \ ${{ matrix.addr_bootloader }} build/SomfyController.ino.bootloader.bin \
0x8000 build/SomfyController.ino.partitions.bin \ 0x8000 build/SomfyController.ino.partitions.bin \
0x10000 build/SomfyController.ino.bin \ 0x10000 build/SomfyController.ino.bin \
0x290000 SomfyController.littlefs.bin 0x330000 SomfyController.littlefs.bin
- name: Upload ${{ matrix.name }} - name: Upload ${{ matrix.name }}
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View file

@ -52,7 +52,7 @@ jobs:
- name: Create LittleFS - name: Create LittleFS
run: | run: |
./mklittlefs/mklittlefs --create data --size 1441792 SomfyController.littlefs.bin ./mklittlefs/mklittlefs --create data --size 786432 SomfyController.littlefs.bin
- name: Upload binaries - name: Upload binaries
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -83,32 +83,32 @@ jobs:
- board: esp32 - board: esp32
addr_bootloader: 0x1000 addr_bootloader: 0x1000
chip: ESP32 chip: ESP32
fqbn: esp32:esp32:esp32wrover:PartitionScheme=default,FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=none,EraseFlash=none fqbn: esp32:esp32:esp32wrover:PartitionScheme=custom,FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
# esp32:esp32:esp32wrover:PartitionScheme=default,FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=none,EraseFlash=none # esp32:esp32:esp32wrover:PartitionScheme=custom,FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
name: ESP32 name: ESP32
obname: SomfyController.onboard.esp32.bin obname: SomfyController.onboard.esp32.bin
fwname: SomfyController.ino.esp32.bin fwname: SomfyController.ino.esp32.bin
- board: esp32c3 - board: esp32c3
addr_bootloader: 0x0 addr_bootloader: 0x0
chip: ESP32-C3 chip: ESP32-C3
fqbn: esp32:esp32:esp32c3:JTAGAdapter=default,CDCOnBoot=cdc,PartitionScheme=default,CPUFreq=160,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none fqbn: esp32:esp32:esp32c3:JTAGAdapter=default,CDCOnBoot=cdc,PartitionScheme=custom,CPUFreq=160,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
# esp32:esp32:esp32c3:JTAGAdapter=default,CDCOnBoot=default,PartitionScheme=default,CPUFreq=160,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none # esp32:esp32:esp32c3:JTAGAdapter=default,CDCOnBoot=default,PartitionScheme=custom,CPUFreq=160,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
name: ESP32C3 name: ESP32C3
obname: SomfyController.onboard.esp32c3.bin obname: SomfyController.onboard.esp32c3.bin
fwname: SomfyController.ino.esp32c3.bin fwname: SomfyController.ino.esp32c3.bin
- board: esp32s2 - board: esp32s2
addr_bootloader: 0x1000 addr_bootloader: 0x1000
chip: ESP32-S2 chip: ESP32-S2
fqbn: esp32:esp32:esp32s2:JTAGAdapter=default,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none fqbn: esp32:esp32:esp32s2:JTAGAdapter=default,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PSRAM=disabled,PartitionScheme=custom,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
# esp32:esp32:esp32s2:JTAGAdapter=default,CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none # esp32:esp32:esp32s2:JTAGAdapter=default,CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PSRAM=disabled,PartitionScheme=custom,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
name: ESP32S2 name: ESP32S2
obname: SomfyController.onboard.esp32s2.bin obname: SomfyController.onboard.esp32s2.bin
fwname: SomfyController.ino.esp32s2.bin fwname: SomfyController.ino.esp32s2.bin
- board: esp32s3 - board: esp32s3
addr_bootloader: 0x0 addr_bootloader: 0x0
chip: ESP32-S3 chip: ESP32-S3
fqbn: esp32:esp32:esp32s3:JTAGAdapter=default,PSRAM=disabled,FlashMode=qio,FlashSize=4M,LoopCore=1,EventsCore=1,USBMode=hwcdc,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PartitionScheme=default,CPUFreq=240,UploadSpeed=921600,DebugLevel=none,EraseFlash=none fqbn: esp32:esp32:esp32s3:JTAGAdapter=default,PSRAM=disabled,FlashMode=qio,FlashSize=4M,LoopCore=1,EventsCore=1,USBMode=hwcdc,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PartitionScheme=custom,CPUFreq=240,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
# esp32:esp32:esp32s3:JTAGAdapter=default,PSRAM=disabled,FlashMode=qio,FlashSize=4M,LoopCore=1,EventsCore=1,USBMode=hwcdc,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PartitionScheme=default,CPUFreq=240,UploadSpeed=921600,DebugLevel=none,EraseFlash=none # esp32:esp32:esp32s3:JTAGAdapter=default,PSRAM=disabled,FlashMode=qio,FlashSize=4M,LoopCore=1,EventsCore=1,USBMode=hwcdc,CDCOnBoot=cdc,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PartitionScheme=custom,CPUFreq=240,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
name: ESP32S3 name: ESP32S3
fwname: SomfyController.ino.esp32s3.bin fwname: SomfyController.ino.esp32s3.bin
obname: SomfyController.onboard.esp32s3.bin obname: SomfyController.onboard.esp32s3.bin
@ -172,7 +172,7 @@ jobs:
${{ matrix.addr_bootloader }} build${{ matrix.name }}/SomfyController.ino.bootloader.bin \ ${{ matrix.addr_bootloader }} build${{ matrix.name }}/SomfyController.ino.bootloader.bin \
0x8000 build${{ matrix.name }}/SomfyController.ino.partitions.bin \ 0x8000 build${{ matrix.name }}/SomfyController.ino.partitions.bin \
0x10000 build${{ matrix.name }}/SomfyController.ino.bin \ 0x10000 build${{ matrix.name }}/SomfyController.ino.bin \
0x290000 SomfyController.littlefs.bin 0x330000 SomfyController.littlefs.bin
- name: Upload Firmware ${{ matrix.name }} - name: Upload Firmware ${{ matrix.name }}
uses: shogo82148/actions-upload-release-asset@v1.7.5 uses: shogo82148/actions-upload-release-asset@v1.7.5

7
partitions.csv Normal file
View file

@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x190000,
app1, app, ota_1, 0x1A0000,0x190000,
spiffs, data, spiffs, 0x330000,0xC0000,
coredump, data, coredump,0x3F0000,0x10000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x190000
5 app1 app ota_1 0x1A0000 0x190000
6 spiffs data spiffs 0x330000 0xC0000
7 coredump data coredump 0x3F0000 0x10000

60
platformio.ini Normal file
View file

@ -0,0 +1,60 @@
; PlatformIO configuration for ESPSomfy-RTS
; Compatible with Arduino IDE (source files remain in project root)
[platformio]
src_dir = .
default_envs = esp32
[env]
framework = arduino
platform = espressif32@6.9.0
monitor_speed = 115200
upload_speed = 921600
board_build.filesystem = littlefs
board_build.flash_mode = qio
board_build.partitions = partitions.csv
lib_deps =
bblanchon/ArduinoJson@6.21.5
knolleary/PubSubClient@2.8.0
LSatan/SmartRC-CC1101-Driver-Lib@2.5.7
https://github.com/Links2004/arduinoWebSockets.git#2.4.0
build_src_filter =
+<*.ino>
+<*.cpp>
+<*.h>
-<.github/>
-<icons/>
[env:esp32]
board = esp32dev
[env:esp32c3]
board = esp32-c3-devkitc-02
board_build.mcu = esp32c3
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
[env:esp32s2]
board = esp32-s2-saola-1
board_build.mcu = esp32s2
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
; ESP32-C6 requires Arduino ESP32 core 3.x (pioarduino platform fork).
; Core 3.x has breaking API changes (ETH, tcpip_adapter removed, etc.)
; that require source code modifications before this will compile.
; [env:esp32c6]
; platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip
; board = esp32-c6-devkitc-1
; board_build.mcu = esp32c6
; build_flags =
; -DARDUINO_USB_MODE=1
; -DARDUINO_USB_CDC_ON_BOOT=1
[env:esp32s3]
board = esp32-s3-devkitc-1
board_build.mcu = esp32s3
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1