BREAKING CHANGE: repartition: double sketch size

this updates the partition scheme for devices with 4 MB of flash memory
to have only a single app partition, doubling its size, but sacrificing
their OTA update capability. the replacement environment for
"generic_esop32" is called "generic_esp32_4mb_no_ota".

the new default partition scheme is targeted for devices with at least 8
MB of flash memory. the previous two app partitions are merged into one,
and one additional app partition of the same new size is added to the
back of the table. the change preserves the littlefs partition (position
and size), allowing for upgrades without loosing the configuration.

another new environment is added, called "generic_esp32_8mb", which uses
the new default partition layout.

environment "generic" is removed. it was merely a variant of
"generic_esp32" with some pins pre-defined. we want users to install a
pin_mapping.json and use the generic firmwares.

environments for boards that have no version with at least 8 MB of flash
memory are setup using the 4 MB partition layout (no OTA updates).

all users must flash the factory.bin for their respective environment
using esptool (or compatible software) using the USB port of their
board. in other words: updating to the new partition scheme using an OTA
update is NOT possible.

hint: the ESP32-S3 builds have a smaller code footprint. this means
ESP32-S3 boards can be updated using OTA without updating the partition
layout on the devices for some unspecified time longer, i.e., until
their firmware binary actually becomes too large for the old sketch
partition size.

the non-factory binary for generic_esp32_4mb_no_ota is NOT collected as
an artifact. going forward, users must update using the factory binary
and using the USB connection to their boards.
This commit is contained in:
Bernhard Kirchen 2024-06-23 20:43:38 +02:00
parent 79214d750f
commit 2cc086335f
4 changed files with 39 additions and 34 deletions

View File

@ -1,4 +1,4 @@
name: OpenDTU-onBattery Build name: OpenDTU-OnBattery Build
on: on:
push: push:
@ -120,6 +120,7 @@ jobs:
name: opendtu-onbattery-${{ matrix.environment }} name: opendtu-onbattery-${{ matrix.environment }}
path: | path: |
.pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.bin .pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.bin
!.pio/build/generic_esp32_4mb_no_ota/opendtu-onbattery-generic_esp32_4mb_no_ota.bin
.pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.factory.bin .pio/build/${{ matrix.environment }}/opendtu-onbattery-${{ matrix.environment }}.factory.bin
release: release:

View File

@ -1,6 +1,5 @@
# Name, Type, SubType, Offset, Size, Flags # Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000, nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000, otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x1E0000, app0, app, ota_0, 0x10000, 0x3C0000,
app1, app, ota_1, 0x1F0000, 0x1E0000,
spiffs, data, spiffs, 0x3D0000, 0x30000, spiffs, data, spiffs, 0x3D0000, 0x30000,
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 0x1E0000 0x3C0000
app1 app ota_1 0x1F0000 0x1E0000
5 spiffs data spiffs 0x3D0000 0x30000

View File

@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x3C0000,
spiffs, data, spiffs, 0x3D0000, 0x30000,
app1, app, ota_1, 0x400000, 0x3C0000,
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 0x3C0000
5 spiffs data spiffs 0x3D0000 0x30000
6 app1 app ota_1 0x400000 0x3C0000

View File

@ -9,17 +9,14 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[platformio] [platformio]
default_envs = generic_esp32 default_envs = generic_esp32s3_usb
extra_configs = extra_configs =
platformio_override.ini platformio_override.ini
[env] [env]
; Make sure to NOT add any spaces in the custom_ci_action property ; Make sure to NOT add any spaces in the custom_ci_action property
; (also the position in the file is important) ; (also the position in the file is important)
; disabling generic and generic_esp32 until we decided on how to handle custom_ci_action = generic_esp32_4mb_no_ota,generic_esp32_8mb,generic_esp32s3,generic_esp32s3_usb
; the overflowing sketch partition for all ESP32 with 4MB flash.
; custom_ci_action = generic,generic_esp32,generic_esp32s3,generic_esp32s3_usb
custom_ci_action = generic_esp32s3,generic_esp32s3_usb
framework = arduino framework = arduino
platform = espressif32@6.7.0 platform = espressif32@6.7.0
@ -57,7 +54,7 @@ extra_scripts =
pre:pio-scripts/patch_apply.py pre:pio-scripts/patch_apply.py
post:pio-scripts/create_factory_bin.py post:pio-scripts/create_factory_bin.py
board_build.partitions = partitions_custom_4mb.csv board_build.partitions = partitions_custom_8mb.csv
board_build.filesystem = littlefs board_build.filesystem = littlefs
board_build.embed_files = board_build.embed_files =
webapp_dist/index.html.gz webapp_dist/index.html.gz
@ -78,7 +75,13 @@ upload_protocol = esptool
; upload_port = COM4 ; upload_port = COM4
[env:generic_esp32] [env:generic_esp32_4mb_no_ota]
board = esp32dev
build_flags = ${env.build_flags}
board_build.partitions = partitions_custom_4mb.csv
[env:generic_esp32_8mb]
board = esp32dev board = esp32dev
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
@ -95,12 +98,14 @@ build_flags = ${env.build_flags}
[env:generic_esp32c3] [env:generic_esp32c3]
board = esp32-c3-devkitc-02 board = esp32-c3-devkitc-02
board_build.partitions = partitions_custom_4mb.csv
custom_patches = ${env.custom_patches} custom_patches = ${env.custom_patches}
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
[env:generic_esp32c3_usb] [env:generic_esp32c3_usb]
board = esp32-c3-devkitc-02 board = esp32-c3-devkitc-02
board_build.partitions = partitions_custom_4mb.csv
custom_patches = ${env.custom_patches} custom_patches = ${env.custom_patches}
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DARDUINO_USB_MODE=1 -DARDUINO_USB_MODE=1
@ -120,17 +125,6 @@ build_flags = ${env.build_flags}
-DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_CDC_ON_BOOT=1
[env:generic]
board = esp32dev
build_flags = ${env.build_flags}
-DHOYMILES_PIN_MISO=19
-DHOYMILES_PIN_MOSI=23
-DHOYMILES_PIN_SCLK=18
-DHOYMILES_PIN_IRQ=16
-DHOYMILES_PIN_CE=4
-DHOYMILES_PIN_CS=5
[env:olimex_esp32_poe] [env:olimex_esp32_poe]
; https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware ; https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware
board = esp32-poe board = esp32-poe
@ -147,6 +141,7 @@ build_flags = ${env.build_flags}
[env:olimex_esp32_evb] [env:olimex_esp32_evb]
; https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware ; https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware
board = esp32-evb board = esp32-evb
board_build.partitions = partitions_custom_4mb.csv
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DHOYMILES_PIN_MISO=15 -DHOYMILES_PIN_MISO=15
-DHOYMILES_PIN_MOSI=2 -DHOYMILES_PIN_MOSI=2
@ -159,16 +154,17 @@ build_flags = ${env.build_flags}
[env:d1_mini_esp32] [env:d1_mini_esp32]
board = wemos_d1_mini32 board = wemos_d1_mini32
board_build.partitions = partitions_custom_4mb.csv
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-DHOYMILES_PIN_MISO=19 -DHOYMILES_PIN_MISO=19
-DHOYMILES_PIN_MOSI=23 -DHOYMILES_PIN_MOSI=23
-DHOYMILES_PIN_SCLK=18 -DHOYMILES_PIN_SCLK=18
-DHOYMILES_PIN_IRQ=16 -DHOYMILES_PIN_IRQ=16
-DHOYMILES_PIN_CE=17 -DHOYMILES_PIN_CE=17
-DHOYMILES_PIN_CS=5 -DHOYMILES_PIN_CS=5
-DVICTRON_PIN_TX=21 -DVICTRON_PIN_TX=21
-DVICTRON_PIN_RX=22 -DVICTRON_PIN_RX=22
-DPYLONTECH_PIN_RX=27 -DPYLONTECH_PIN_RX=27
-DPYLONTECH_PIN_TX=14 -DPYLONTECH_PIN_TX=14
-DHUAWEI_PIN_MISO=12 -DHUAWEI_PIN_MISO=12
@ -181,6 +177,7 @@ build_flags =
[env:wt32_eth01] [env:wt32_eth01]
; http://www.wireless-tag.com/portfolio/wt32-eth01/ ; http://www.wireless-tag.com/portfolio/wt32-eth01/
board = wt32-eth01 board = wt32-eth01
board_build.partitions = partitions_custom_4mb.csv
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DHOYMILES_PIN_MISO=4 -DHOYMILES_PIN_MISO=4
-DHOYMILES_PIN_MOSI=2 -DHOYMILES_PIN_MOSI=2
@ -207,6 +204,7 @@ build_flags = ${env.build_flags}
; https://www.makershop.de/plattformen/esp8266/wemos-lolin32/ ; https://www.makershop.de/plattformen/esp8266/wemos-lolin32/
; https://www.az-delivery.de/products/esp32-lolin-lolin32 ; https://www.az-delivery.de/products/esp32-lolin-lolin32
board = lolin32_lite board = lolin32_lite
board_build.partitions = partitions_custom_4mb.csv
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DHOYMILES_PIN_MISO=19 -DHOYMILES_PIN_MISO=19
-DHOYMILES_PIN_MOSI=23 -DHOYMILES_PIN_MOSI=23
@ -217,6 +215,7 @@ build_flags = ${env.build_flags}
[env:lolin_s2_mini] [env:lolin_s2_mini]
board = lolin_s2_mini board = lolin_s2_mini
board_build.partitions = partitions_custom_4mb.csv
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DHOYMILES_PIN_MISO=13 -DHOYMILES_PIN_MISO=13
-DHOYMILES_PIN_MOSI=11 -DHOYMILES_PIN_MOSI=11