Skip to content

esp8266: migrate off Arduino core — pgmspace, SPI.h, HardwareSerial Serial1, delayMicroseconds #3723

Closed

Description

@zackees

Part of #3715.

Problem

The ESP8266 subtree retains the heaviest Arduino coupling in the ESP family. Note the target here is the NONOS SDK / bare-metal registers, not ESP-IDF (8266 never got IDF proper; RTOS-SDK is out of scope):

file:line dependency native replacement
8266/progmem_esp8266.h:9 #include <pgmspace.h> (Arduino core) flash is memory-mapped on ESP8266 — FL_PGM_READ_* become plain (aligned) pointer reads; PROGMEM → section attribute or no-op
8266/fastspi_esp8266.h:7 #include <SPI.h>, Arduino SPIClass direct HSPI register programming via SDK spi_register.h — or explicitly document 8266 hardware-SPI as Arduino-only
8266/fastled_esp8266_uart.h:31 extern HardwareSerial Serial1 direct UART1 FIFO writes (USF(1)) via esp8266_peri.h registers
8266/fastled_esp8266_uart.h:99,108,131,161 Serial1.flush()/begin()/write() UART1 register sequence (baud via USD(1), conf via USC0(1))
8266/fastled_esp8266_uart.h:32,134,167 + 8266/clockless_esp8266.h:67 + 8266/clockless_block_esp8266.h:59 delayMicroseconds(...) ets_delay_us(...) (ROM/SDK)
8266/led_sysdefs_esp8266.h:36 #ifdef ARDUINO_ESP8266_NODEMCU pin-order fork keep — board identification macro, allowed exception per the dispatch-convention sub-issue
8266/ldf_headers.h:16 <SPI.h> LDF hint remove alongside the fastspi migration

Already native (no work needed): 8266/pin_esp8266_native.hpp (register-level GPIO via esp8266_peri.h/osapi.h — SDK headers, not Arduino wiring), 8266/io_esp_idf.hpp (ROM ets_putc), 8266/fastpin_esp8266.h (SDK GPO/GP16O registers).

Priority

Lower than the ESP32 sub-issues — ESP8266 is a legacy platform and its Arduino core is the only actively maintained runtime most users have. Recommended scope cut: do the cheap wins (pgmspace, delayMicroseconds→ets_delay_us), and take a deliberate documented decision on UART/SPI (migrate vs declare Arduino-only) rather than defaulting into a half-migration.

Acceptance criteria

  • progmem_esp8266.h has no Arduino include; PROGMEM reads verified on-device (flash-mapped read alignment on 8266 traps on unaligned byte reads — the existing FL_PGM_READ_BYTE_NEAR shift/mask logic must be preserved).
  • No bare delayMicroseconds calls remain under src/platforms/esp/8266/.
  • Decision recorded (in this issue) for UART1 + hardware-SPI: native registers or documented Arduino-only.
  • ESP8266 CI leg green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreplatform: esp8266priority: lowtype: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions