Skip to content

esp: remove soft fl/system/arduino.h leaks; memory_esp32.hpp → unconditional heap_caps_* #3721

Closed

Description

@zackees

Part of #3715.

Problem

fl/system/arduino.h is a soft shim (#if FL_HAS_INCLUDE(<Arduino.h>) #include <Arduino.h> + macro cleanup). It never breaks a bare-IDF build, but every include of it pulls the entire Arduino core into the translation unit whenever the core is present — cost in compile time, LDF behavior, and accidental symbol dependence. Several ESP TUs include it although their implementation is already pure IDF:

file:line actually uses Arduino?
src/platforms/esp/32/coroutine_esp32.impl.hpp:26 No — impl is FreeRTOS-only. Remove.
src/platforms/esp/32/drivers/uart/uart_peripheral_esp.cpp.hpp:18 No — impl is pure driver/uart.h. Remove.
src/platforms/esp/32/drivers/i2s/i2s_lcd_cam_peripheral_mock.cpp.hpp:29 Host-mock file with an #ifdef ARDUINO fork (line 27) — untangle or scope to the mock branch only.
src/platforms/esp/32/platform_time_esp32.cpp.hpp:14 Yes today — removed by the timing sub-issue.
src/platforms/esp/32/drivers/cled.cpp.hpp:14 Yes today — removed by the LEDC sub-issue.

Separately, src/platforms/esp/32/memory_esp32.hpp forks on #if defined(ARDUINO) at lines 11, 32, 61 around heap queries. heap_caps_* (esp_heap_caps.h) is pure IDF and available identically under Arduino — the fork is unnecessary.

Fix

  1. Delete the fl/system/arduino.h includes from the two pure-IDF TUs; untangle the i2s mock.
  2. Rewrite memory_esp32.hpp to call heap_caps_get_free_size / heap_caps_get_largest_free_block etc. unconditionally; drop all three defined(ARDUINO) guards.
  3. Add a grep-ratchet (lint or CI check) that flags any new fl/system/arduino.h include under src/platforms/esp/** — the ESP tree should reach and stay at zero.

Acceptance criteria

Activity

  1. added
    type: feature
    platform: esp32
    area: core
    on Jul 22, 2026
  2. added a commit that references this issue on Jul 22, 2026
    c69b338
  3. moved this from Triage to Done in FastLED Trackeron Jul 22, 2026
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: coreplatform: esp32type: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions