Repository navigation
Description
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— normalizesESP_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 providesESP_IDF_VERSION_4_OR_HIGHER/_5_OR_HIGHER/_6_OR_HIGHERpredicates.- 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_4vsrmt_5,audio/devices/idf4_*vsidf5_*,pin_esp32_native_impl.hpp(adc_oneshot on 5+ vs legacydriver/adc.hon 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:
- 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_idf33Arduino leg keeps guarding the 3.x macro paths). - Keep all existing Arduino-on-IDF legs — the Arduino path stays supported, it just stops being load-bearing.
- Interim ratchet until the bare-IDF leg lands: compile with
-DFL_NO_ARDUINOon 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.
- esp32: bare-IDF fl::platforms time impl — drop Arduino millis()/micros()/delayMicroseconds() (blocks all framework=espidf builds) #3716 — timing: bare-IDF
fl::platformstime impl (esp_timer / vTaskDelay / esp_rom_delay_us) — hard blocker for any bare-IDF build — merged feat(esp32): bare-IDF fl::platforms time implementation #3726 - esp32: remove <esp32-hal.h> Arduino fallbacks from clock_cycles.h (+ rmt4 driver cascade) #3717 — remove
<esp32-hal.h>fallbacks fromclock_cycles.h(+ rmt4 cascade) — merged feat(esp32): remove <esp32-hal.h> Arduino fallbacks from clock_cycles.h #3732 - esp32: retire fastspi_esp32_arduino.h — make IDF spi_master the only ESP32 SPI backend #3718 — retire
fastspi_esp32_arduino.h; IDFspi_masterbecomes the only ESP32 SPI backend — merged feat(esp32): make ESP-IDF spi_master the only ESP32 SPI backend #3727 - esp32: cled.cpp.hpp — replace Arduino ledcAttach/ledcSetup/ledcWrite with IDF driver/ledc.h #3719 —
cled.cpp.hpp: replace Arduino LEDC calls with IDFdriver/ledc.h— merged feat(esp32): CLED begin() uses IDF driver/ledc.h instead of Arduino LEDC #3733 - esp32: default serial IO to io_esp_idf.hpp — make io_arduino.hpp opt-in, drop the <Arduino.h> probe #3720 — serial IO: default to
io_esp_idf.hpp;io_arduino.hppbecomes opt-in — closed without a code change:io_esp.cpp.hppalready correctly capability-detects bare-IDF (!FL_HAS_INCLUDE(<Arduino.h>)→io_esp_idf.hpp); flipping the Arduino-present default risked regressing the esp32c6 default env: Serial silently routed to UART0 instead of USB-Serial/JTAG → AutoResearch RPC unreachable on FH4 boards #2665/fl::print: minimal-surface contract — non-blocking on missing CDC host, USJ LL fallback on ESP32 USJ chips #2668 USB-Serial-JTAG bring-up work for no benefit - esp: remove soft fl/system/arduino.h leaks; memory_esp32.hpp → unconditional heap_caps_* #3721 — remove soft
fl/system/arduino.hleaks;memory_esp32.hpp→ unconditionalheap_caps_*— merged feat(esp32): remove unused fl/system/arduino.h leaks; unconditional heap_caps_* #3728 - esp: converge Arduino-vs-native dispatch on capability detection (FL_HAS_INCLUDE of IDF driver headers), not #ifdef ARDUINO #3722 — converge Arduino-vs-native dispatch on capability detection (
FL_HAS_INCLUDE) — merged docs(esp32): document capability-detection dispatch convention #3730 (docs) - esp8266: migrate off Arduino core — pgmspace, SPI.h, HardwareSerial Serial1, delayMicroseconds #3723 — esp8266: migrate off Arduino core (pgmspace / SPI.h / HardwareSerial / delays) — lower priority — merged feat(esp8266): qualify delayMicroseconds; document scope decision on the rest #3731 (partial/documented: delayMicroseconds facade-qualified; pgmspace/UART1/SPI kept Arduino-only, see PR for rationale)
- ci: bare-IDF (framework=espidf) compile-test legs for IDF 4.4 / 5.x / 6.x (+ FL_NO_ARDUINO ratchet) #3724 — ci: bare-IDF (
framework=espidf) compile-test legs for IDF 4.4 / 5.x / 6.x +FL_NO_ARDUINOratchet — verification arm; ratchet stage should land first — merged feat(ci): add ESP-IDF component-build smoke test (esp32dev_idf5_component) #3734 (partial: ESP-IDF component-build leg landed; trueapp_main()-only bare-IDF harness + IDF4.4/6.x legs are 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:
- A genuine
app_main()-only (no Arduino anywhere) bare-IDF harness + IDF 4.4/6.x CI legs (ci: bare-IDF (framework=espidf) compile-test legs for IDF 4.4 / 5.x / 6.x (+ FL_NO_ARDUINO ratchet) #3724 follow-up) - ESP8266 pgmspace/UART1/hardware-SPI native migration (esp8266: migrate off Arduino core — pgmspace, SPI.h, HardwareSerial Serial1, delayMicroseconds #3723 follow-up — deliberately deferred, see that PR for the risk rationale)
- Hardware/bench validation for the SPI backend flip (esp32: retire fastspi_esp32_arduino.h — make IDF spi_master the only ESP32 SPI backend #3718 — compiles and links; wire-level protocol correctness not bench-tested in this pass)
Out of scope
net/,ota/,ble, and alldrivers/{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/ESP8266inis_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
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
feat(esp32): remove unused fl/system/arduino.h leaks; unconditional h…
feat(esp8266): qualify delayMicroseconds as fl::delayMicroseconds (#3731
feat(esp32): bare-IDF fl::platforms time implementation (#3726)
feat(esp32): make ESP-IDF spi_master the only ESP32 SPI backend (#3727)
feat(esp32): remove <esp32-hal.h> Arduino fallbacks from clock_cycles…
feat(esp32): CLED begin() uses IDF driver/ledc.h instead of Arduino L…
feat(ci): add ESP-IDF component-build smoke test (esp32dev_idf5_compo…
zackees commentedon Aug 20, 2026
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
.github/workflows/build_esp32dev_idf5_component.ymlexplicitly says it uses the combined Arduino plus ESP-IDF framework, enables Arduino autostart, and is not a genuineapp_main()-only bare-IDF build. There is still no CI job that makesArduino.hunavailable.ARDUINO.pgmspace, UART1/HardwareSerial, and hardware SPI remain Arduino-core paths. Currentsrc/platforms/esp/8266/{progmem_esp8266.h,fastled_esp8266_uart.h,fastspi_esp8266.h}still carry those dependencies.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.