Skip to content

feat(esp32): make Arduino LittleFS integration optional through a weak provider boundary #4889

Closed

Description

@zackees

Context

embedded_fs_esp.hpp selects Arduino LittleFS when FS.h/LittleFS.h exist, directly stores Arduino File, and calls the global LittleFS object. Verified Arduino 2.0.17 FS.h includes Arduino.h and File inherits Stream. Header availability is currently deciding implementation/dependency acquisition.

The existing embedded storage entry point is deliberately isolated in fl.fs.embedded+.cpp.o. Unused storage should already drop; this is not evidence of additional bloat in the current non-storage D32 benchmark.

Proposal

Use an optional weak provider factory expressed in existing FastLED filesystem types. An explicitly linked Arduino adapter may supply LittleFS behavior without exposing Arduino File/Stream types to native ESP code. Supply a native supported fallback so existing working embedded-storage sketches retain functionality; use the existing null contract only where storage is genuinely unavailable. Resolve provider selection before mounting or taking ownership.

Acceptance criteria

  • RED -> GREEN: reproduce the current Arduino header/link dependency in a real storage-enabled build, then demonstrate its removal from the native path.
  • Test provider present, absent, failed mount, and failed open; verify archive-only providers are not implicitly extracted and document explicit linkage.
  • Preserve getEmbeddedFs(bool), default no-format behavior, valid reads/seeks/EOF/close, and already mounted filesystem ownership; never format or unmount another owner's storage unexpectedly.
  • Run real flash-backed read/seek/reopen tests with provider and native fallback; preserve ESP8266 opt-in/toolchain limitations.
  • Measure matched no-storage, native-storage, and Arduino-provider builds (flash/static RAM/runtime heap, live symbol/map roots). No-storage must retain its separate-object elision.
  • Keep normal lint/tests green and document migration/activation without adding GHA.

Decisions

Open questions

  • Confirm native LittleFS component availability and lifecycle across supported SDK packages; record unsupported configurations explicitly.

Related issues

#3984, #4007, #4887.

Tracked under #4888.

Activity

  1. zackees commented on Oct 22, 2026

    @zackees
    MemberAuthor

    Implemented and published in #4894 (stacked on #4887's branch; full master CI remains required before integration).

    Matched Lolin D32 fbuild + bloat: default embedded storage 293,858 -> 284,070 bytes flash (-9,788); physical static RAM 21,420 -> 21,412 (-8). No-storage remains exactly 231,094 / 21,000. Explicit app-mounted Arduino provider is 293,894 -> 293,998 flash (+104) with unchanged static RAM; native backend symbols are fully discarded in that mode.

    Actual production-entry linker tests cover absent/archive/direct providers. Selectively reverting the entry makes the direct-provider test fail; fixed source restored and passing. Physical AutoResearch passes native 105 and provider 82 checks per call, both cold and warm, including an unmounted-provider failure without fallback mounting, mount ownership, reads/seeks/EOF and file lifetime. Warm retained heap is zero in both modes. First measured cycles retain native96/provider440 bytes for lazy allocations. Canonical AutoResearch restored, final legacy RMT 3/3 passes.

    Full debug suite 326 units / 95 examples passes. Full Python run revealed five failures (four stale assertions plus new header-local registry state); all fixed, final selected rerun 18/18 passes. Normal lint and independent production review pass. SDK4.4 / SDK5.5 compile evidence and the ownership/activation limitations are documented in docs/ESP32_EMBEDDED_FS.md.

    This does not claim physical USB acceptance for #4893. Proceeding next to #4890, as the next sequential implementation.

  2. zackees commented on Oct 22, 2026

    @zackees
    MemberAuthor

    Resolved by #4894 (merged to master 2026-10-22, 2d83b42 ancestry).

  3. moved this from Triage to Done in FastLED Trackeron Oct 22, 2026
  4. added a commit that references this issue on Dec 3, 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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions