Skip to content

Meta: decouple src/platforms/esp from the Arduino core — go straight to Espressif (ESP-IDF) headers, with IDF 3.x-6.x compat + per-IDF compile-test CI #3715

Open
9 of 9 issues completed

Description

@zackees

Goal

Take src/platforms/esp/** fully off the Arduino dependency path: every ESP32/ESP8266 code path should compile against Espressif headers directly (ESP-IDF drivers / ROM / SoC headers, or NONOS-SDK on 8266), with the Arduino core reduced to an optional, opt-in convenience layer — never a requirement.

Current state (audit of src/platforms/esp/**, 2026-07-22)

The good news: the tree is already mostly IDF-native. led_sysdefs_esp32.h / led_sysdefs_esp8266.h, all of 32/drivers/* (rmt_5, spi, i2s, i2s_spi, parlio, lcd_cam, lcd_spi, uart), net/, ota/, ble, interrupts/, and the pin_*_native* implementations already use ESP-IDF / SDK headers directly. Those need no migration.

The remaining Arduino-core coupling is concentrated in a handful of legacy files:

Area Files Arduino dependency
Timing 32/platform_time_esp32.cpp.hpp, 32/clockless_block_esp32.h ::millis(), ::micros(), ::delayMicroseconds(); no bare-IDF time impl exists at all — a pure-IDF build fails to link fl::platforms::millis etc.
Cycle counter 32/core/clock_cycles.h, 32/drivers/rmt/rmt_4/channel_driver_rmt4.h <esp32-hal.h> fallback branches
SPI (ESP32) 32/core/fastspi_esp32_arduino.h <SPI.h>, SPIClass, SPISettings (an IDF backend already exists in fastspi_esp32_idf.h)
PWM / CLED 32/drivers/cled.cpp.hpp ledcAttach / ledcAttachPin / ledcSetup / ledcWrite + ESP_ARDUINO_VERSION_MAJOR fork
Serial IO 32/io_esp.cpp.hpp probes FL_HAS_INCLUDE(<Arduino.h>) and can route to platforms/arduino/io_arduino.hpp (an IDF path already exists in io_esp_idf.hpp)
Soft leaks fl/system/arduino.h included from 32/coroutine_esp32.impl.hpp, 32/drivers/uart/uart_peripheral_esp.cpp.hpp, 32/drivers/i2s/i2s_lcd_cam_peripheral_mock.cpp.hpp; 32/memory_esp32.hpp #if defined(ARDUINO) forks pulls the whole Arduino core into the TU whenever present, even where the impl is pure IDF
Dispatch inconsistency fastspi_esp32.h, memory_esp32.hpp, platform_time_esp32.cpp.hpp vs pin_esp32_native.hpp, io_esp.cpp.hpp three different Arduino-vs-native selection mechanisms (#ifdef ARDUINO, FL_HAS_INCLUDE(<Arduino.h>), FL_HAS_INCLUDE("driver/gpio.h"))
ESP8266 8266/progmem_esp8266.h, 8266/fastspi_esp8266.h, 8266/fastled_esp8266_uart.h, 8266/clockless*.h, 8266/led_sysdefs_esp8266.h <pgmspace.h>, <SPI.h>, HardwareSerial Serial1, delayMicroseconds, ARDUINO_ESP8266_NODEMCU guard

IDF compat-layer requirement (3.x / 4.x / 5.x / 6.x)

Every migrated call site must keep working across the full IDF spread. The normalization layer already exists and must remain the single source of truth:

  • src/platforms/esp/esp_version.h — normalizes ESP_IDF_VERSION* across Arduino-ESP32 and native IDF, defaults to 3.0.0 when the toolchain defines nothing (legacy Arduino-ESP32 1.0.x era), and provides ESP_IDF_VERSION_4_OR_HIGHER / _5_OR_HIGHER / _6_OR_HIGHER predicates.
  • Version-forked subsystems already model the pattern to follow: isr_esp32_idf{3,4,5}.hpp, watchdog_esp32_idf{4,5}.hpp, drivers/rmt/rmt_4 vs rmt_5, audio/devices/idf4_* vs idf5_*, pin_esp32_native_impl.hpp (adc_oneshot on 5+ vs legacy driver/adc.h on 4.x).

Rule for the sub-issues: replacements must use APIs available in the oldest supported IDF for that path, or add a version fork following the existing *_idfN convention. Known hazards are called out per sub-issue (e.g. LEDC config-struct changes across 4/5/6, esp_cpu_get_cycle_count being 5.x+, esp_rom_delay_us header moves).

Compile-test strategy per IDF version

Existing CI legs (all Arduino-on-IDF via espressif32/pioarduino — they prove the Arduino path, not the bare-IDF path):

Leg Platform IDF Workflow
esp32dev_idf33 [email protected] (Arduino core 1.0.x) 3.3 build_esp32dev_idf3.3.yml
esp32dev_idf44 ESP32_IDF_4_4_LATEST 4.4 build_esp32dev_idf4.4.yml
esp32dev + most boards pioarduino IDF 5.x pins 5.1–5.5 build.yml matrix
esp32dev_idf6 pioarduino prep_IDF6 6.0.1+ build_esp32dev_idf6.yml

What is missing — and what the CI sub-issue adds — is a bare-IDF leg (framework = espidf, no Arduino core installed) so that any reintroduced Arduino dependency fails CI immediately:

  1. Bare-IDF compile-smoke per IDF major: 4.4, 5.x (current pin), 6.x. IDF 3.3 bare is best-effort (ancient toolchain; the esp32dev_idf33 Arduino leg keeps guarding the 3.x macro paths).
  2. Keep all existing Arduino-on-IDF legs — the Arduino path stays supported, it just stops being load-bearing.
  3. Interim ratchet until the bare-IDF leg lands: compile with -DFL_NO_ARDUINO on an existing leg to force the native branches through the current dispatch macros.

Sub-issues

Ordered roughly by dependency (7 unblocks 3/5/6; 1 is the known hard blocker for any bare-IDF build). All 9 closed as of 2026-07-22 — see ## Final status below for outcomes and residual follow-up.

Final status (2026-07-22)

7 of 9 sub-issues shipped real code changes to src/platforms/esp/**; #3720 was investigated and closed as already-correct; #3724 shipped a partial CI leg. Residual follow-up work, none of it blocking:

Out of scope

  • net/, ota/, ble, and all drivers/{rmt_5,spi,i2s,i2s_spi,parlio,lcd_cam,lcd_spi,uart} engines — already IDF-native.
  • Host-mock !defined(ARDUINO) && (linux/apple/win) guards in *_mock.cpp.hpp — those select host mocks vs device, not Arduino vs IDF.
  • Platform-detection uses of ARDUINO_ARCH_ESP32/ESP8266 in is_esp.h — harmless identification, stays.
  • Publishing to the IDF component registry — tracked separately in idf component registry #2121 (this meta is a prerequisite for that being useful).

Sub-issues

Sub-issues

9 of 9 Issues completed
Loading 9 sub-issues

Activity

  1. added
    type: feature
    platform: esp32
    platform: esp8266
    area: core
    on Jul 22, 2026
  2. added
    deferred
    on Aug 20, 2026
  3. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    Burn-down disposition: DEFERRED ? the remaining goal is still multi-toolchain work

    The nine listed child issues are closed and most of the ESP32 migration landed, but the meta's stated end condition (no Arduino dependency, with bare-IDF coverage across supported majors) is not yet true.

    Landed

    Remaining acceptance gaps

    1. .github/workflows/build_esp32dev_idf5_component.yml explicitly says it uses the combined Arduino plus ESP-IDF framework, enables Arduino autostart, and is not a genuine app_main()-only bare-IDF build. There is still no CI job that makes Arduino.h unavailable.
    2. The requested bare-IDF 4.4 and 6.x legs do not exist; the lone component job is IDF5 and still defines ARDUINO.
    3. esp8266: migrate off Arduino core — pgmspace, SPI.h, HardwareSerial Serial1, delayMicroseconds #3723 was deliberately partial: ESP8266 pgmspace, UART1/HardwareSerial, and hardware SPI remain Arduino-core paths. Current src/platforms/esp/8266/{progmem_esp8266.h,fastled_esp8266_uart.h,fastspi_esp8266.h} still carry those dependencies.
    4. The IDF SPI backend flip has compile/link evidence but the meta's residual note records no wire-level bench validation.

    Completing this safely requires a real bare-IDF app_main() harness, per-major SDK/toolchain CI, and a separate NONOS/ESP8266 compatibility migration. That is not one bounded change.

    Resume by landing the no-Arduino IDF5 harness first, then add IDF4.4/6 matrix jobs and use them as a ratchet while removing the remaining ESP8266 core dependencies. Close the meta only when a build with no Arduino headers installed succeeds and the ESP8266 ownership decision is fully implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coredeferredplatform: esp32platform: esp8266type: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions