Merge pull request #114 from cjkas/feat/esp32c3-build

build: bring back the ESP32-C3 build
This commit is contained in:
cjkas 2026-10-29 16:11:50 +01:00 • committed by GitHub
commit 9e8ac88893
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 30 additions and 17 deletions

View file

@ -60,9 +60,7 @@ jobs:
# fwname: firmware-only binary for OTA updates # fwname: firmware-only binary for OTA updates
# obname: onboard image (bootloader + partitions + firmware + littlefs merged) # obname: onboard image (bootloader + partitions + firmware + littlefs merged)
# for flashing a new chip via USB/serial # for flashing a new chip via USB/serial
# addr_bootloader: chip-dependent (ESP32: 0x1000, S3/C6: 0x0) # addr_bootloader: chip-dependent (ESP32: 0x1000, S3/C3/C6: 0x0)
# No C3: on ESP-IDF 5.5 its image no longer fits the 1.5 MB OTA slot
# (docs/adr/0003-pioarduino-idf55.md). C3 boards stay on 3.0.x.
# addr_fs: must match spiffs/littlefs offset in esp32_3MB.csv # addr_fs: must match spiffs/littlefs offset in esp32_3MB.csv
include: include:
- env: esp32dev - env: esp32dev
@ -81,6 +79,14 @@ jobs:
fwname: SomfyController.ino.esp32s3.bin fwname: SomfyController.ino.esp32s3.bin
fsname: SomfyController.littlefs.esp32s3.bin fsname: SomfyController.littlefs.esp32s3.bin
obname: SomfyController.onboard.esp32s3.bin obname: SomfyController.onboard.esp32s3.bin
- env: esp32c3
name: ESP32-C3
chip: ESP32-C3
addr_bootloader: "0x0"
addr_fs: "0x310000"
fwname: SomfyController.ino.esp32c3.bin
fsname: SomfyController.littlefs.esp32c3.bin
obname: SomfyController.onboard.esp32c3.bin
- env: esp32c6 - env: esp32c6
name: ESP32-C6 name: ESP32-C6
chip: ESP32-C6 chip: ESP32-C6

View file

@ -12,7 +12,9 @@ We moved every firmware env from `espressif32 @ 6.13.0` (Arduino 2.0.17 on ESP-I
- **Firmware size.** The ESP32 image grows from 1,382,640 bytes (v3.0.14) to 1,555,472 at `CORE_DEBUG_LEVEL=2`, leaving 17 KB of the 1.5 MB OTA slot. At level 3 it doesn't fit, so release envs build at level 2 (warnings and errors) and debug envs stay at 3. PlatformIO's "Flash:" figure counts ELF sections, not the image, and reads about 45 KB low, so CI checks `firmware.bin` against the app partition and fails under 8 KB free (`.github/size_check.py`). - **Firmware size.** The ESP32 image grows from 1,382,640 bytes (v3.0.14) to 1,555,472 at `CORE_DEBUG_LEVEL=2`, leaving 17 KB of the 1.5 MB OTA slot. At level 3 it doesn't fit, so release envs build at level 2 (warnings and errors) and debug envs stay at 3. PlatformIO's "Flash:" figure counts ELF sections, not the image, and reads about 45 KB low, so CI checks `firmware.bin` against the app partition and fails under 8 KB free (`.github/size_check.py`).
- **No more C3 builds.** Its image grows by 214 KB to 1,651,216 bytes, 76.5 KB over the OTA slot even at level 2. C3 boards stay on the 3.0.x releases. - **No more C3 builds.** Its image grows by 214 KB to 1,651,216 bytes, 76.5 KB over the OTA slot even at level 2. C3 boards stay on the 3.0.x releases.
> **Amended by [ADR 0006](0006-two-security-modes-eleven-http-routes.md) (4.0.0).** The C3 builds again. Without the old API (ports 8080 and 8081), its image is 1,498,512 bytes at level 2 and leaves 72.6 KB of the OTA slot. It runs on chip revision v0.3 or later only: the framework's C3 libraries are built with `CONFIG_ESP32C3_REV_MIN_3`. Its default radio pins moved off GPIO 12-17, which hold the SPI flash.
- **Ethernet PHY ids are ours.** Arduino 3.x renumbered `eth_phy_type_t` (`ETH_PHY_GENERIC` is 0). NVS, backups and the web UI keep the Arduino 2.x numbers as `eth_phy_id_t` (`src/EthPhy.h`), translated by name when Ethernet starts. Never cast a stored id to the framework enum. - **Ethernet PHY ids are ours.** Arduino 3.x renumbered `eth_phy_type_t` (`ETH_PHY_GENERIC` is 0). NVS, backups and the web UI keep the Arduino 2.x numbers as `eth_phy_id_t` (`src/EthPhy.h`), translated by name when Ethernet starts. Never cast a stored id to the framework enum.
- **Ethernet only on the original ESP32.** Arduino 3.x has the RMII MAC API only where `CONFIG_ETH_USE_ESP32_EMAC` is set. S3 and C6 build without Ethernet. - **Ethernet only on the original ESP32.** Arduino 3.x has the RMII MAC API only where `CONFIG_ETH_USE_ESP32_EMAC` is set. S3, C3 and C6 build without Ethernet.
- **Updates roll back until proven.** We override the core's `verifyRollbackLater()` hook to return true, and `loop()` marks the new firmware valid once it has run 60 s and the network is up. A reset before then boots the previous firmware. The LittleFS image an update wrote stays, so the old firmware runs with the new web UI. - **Updates roll back until proven.** We override the core's `verifyRollbackLater()` hook to return true, and `loop()` marks the new firmware valid once it has run 60 s and the network is up. A reset before then boots the previous firmware. The LittleFS image an update wrote stays, so the old firmware runs with the new web UI.
- **Tooling.** pioarduino needs its own Core fork (`pip install pioarduino`, the pioarduino IDE extension in VS Code), which it installs into `~/.platformio/penv` in place of PlatformIO Core. - **Tooling.** pioarduino needs its own Core fork (`pip install pioarduino`, the pioarduino IDE extension in VS Code), which it installs into `~/.platformio/penv` in place of PlatformIO Core.

View file

@ -95,6 +95,14 @@ build_flags =
${dualcore.build_flags} ${dualcore.build_flags}
-DCORE_DEBUG_LEVEL=2 -DCORE_DEBUG_LEVEL=2
[env:esp32c3]
extends = esp32
board = esp32-c3-devkitm-1
board_build.partitions = esp32_3MB.csv
build_flags =
${esp32.build_flags}
-DCORE_DEBUG_LEVEL=2
; Released as a debug build with one 3 MB app slot, so C6 boards update over ; Released as a debug build with one 3 MB app slot, so C6 boards update over
; USB, not OTA. ; USB, not OTA.
[env:esp32c6] [env:esp32c6]

View file

@ -474,12 +474,14 @@ void transceiver_config_t::load() {
this->CSNPin = 34; this->CSNPin = 34;
break; break;
case esp_chip_model_t::CHIP_ESP32C3: case esp_chip_model_t::CHIP_ESP32C3:
this->TXPin = 13; // The framework's default SPI pins (variants/esp32c3). 12-17 hold the
this->RXPin = 12; // SPI flash, and 2, 8 and 9 are strapping pins.
this->MOSIPin = 16; this->TXPin = 10;
this->MISOPin = 17; this->RXPin = 3;
this->SCKPin = 15; this->MOSIPin = 6;
this->CSNPin = 14; this->MISOPin = 5;
this->SCKPin = 4;
this->CSNPin = 7;
break; break;
#ifdef CONFIG_IDF_TARGET_ESP32C6 #ifdef CONFIG_IDF_TARGET_ESP32C6
case esp_chip_model_t::CHIP_ESP32C6: case esp_chip_model_t::CHIP_ESP32C6:

View file

@ -278,14 +278,10 @@ static void test_releaseAssetName_matches_the_release_workflow() {
TEST_ASSERT_EQUAL_STRING("SomfyController.ino.esp32.bin", buf); TEST_ASSERT_EQUAL_STRING("SomfyController.ino.esp32.bin", buf);
releaseAssetName(buf, sizeof(buf), "littlefs", "s3"); releaseAssetName(buf, sizeof(buf), "littlefs", "s3");
TEST_ASSERT_EQUAL_STRING("SomfyController.littlefs.esp32s3.bin", buf); TEST_ASSERT_EQUAL_STRING("SomfyController.littlefs.esp32s3.bin", buf);
releaseAssetName(buf, sizeof(buf), "littlefs", "c6");
TEST_ASSERT_EQUAL_STRING("SomfyController.littlefs.esp32c6.bin", buf);
}
static void test_releaseAssetName_keeps_c3() {
// C3 is out of the IDF 5.5 builds for now (ADR 0003) but is coming back.
char buf[64];
releaseAssetName(buf, sizeof(buf), "ino", "c3"); releaseAssetName(buf, sizeof(buf), "ino", "c3");
TEST_ASSERT_EQUAL_STRING("SomfyController.ino.esp32c3.bin", buf); TEST_ASSERT_EQUAL_STRING("SomfyController.ino.esp32c3.bin", buf);
releaseAssetName(buf, sizeof(buf), "littlefs", "c6");
TEST_ASSERT_EQUAL_STRING("SomfyController.littlefs.esp32c6.bin", buf);
} }
/********************************************************************* /*********************************************************************
@ -432,7 +428,6 @@ int main(int argc, char **argv) {
RUN_TEST(test_otaProven_not_before_the_minimum_uptime); RUN_TEST(test_otaProven_not_before_the_minimum_uptime);
RUN_TEST(test_otaProven_not_without_network); RUN_TEST(test_otaProven_not_without_network);
RUN_TEST(test_releaseAssetName_matches_the_release_workflow); RUN_TEST(test_releaseAssetName_matches_the_release_workflow);
RUN_TEST(test_releaseAssetName_keeps_c3);
RUN_TEST(test_formatBacktrace_frames_the_dump_holds); RUN_TEST(test_formatBacktrace_frames_the_dump_holds);
RUN_TEST(test_formatBacktrace_garbage_depth_stays_in_bounds); RUN_TEST(test_formatBacktrace_garbage_depth_stays_in_bounds);
RUN_TEST(test_formatBacktrace_stops_when_the_buffer_is_full); RUN_TEST(test_formatBacktrace_stops_when_the_buffer_is_full);