Skip to content

Apply asset-declared build defines (embedded_fs_defines) to the compile configuration #4020

Closed

Description

@zackees

Summary

ci/compiler/asset_scanner.embedded_fs_defines() decides which preprocessor defines a sketch's assets require, and nothing applies them. An asset declaring storage=littlefs is reported (in green) but cannot actually turn a backend on.

Why it is not simply wired up

Two independent reasons, and the second is the blocking one:

1. Defines are per-board, this is per-sketch. Build defines are assembled from Board.defines in ci/boards.py and rendered into the generated platformio.ini. Asset scanning happens later, in copy_example_source(), which returns bool and has no path back to the build configuration. Threading it through means changing that contract and its three call sites in ci/compiler/pio.py.

2. Applying it today would break the builds it targets. The only define currently produced is FL_ESP8266_EMBEDDED_FS, and the ESP8266 embedded backend does not compile — fbuild caches the ESP8266 core without its littlefs submodule, so <LittleFS.h> resolves and then fails on its own #include "../lib/littlefs/lfs.h" (FastLED/fbuild#1380). Enabling it in response to an asset declaration would turn a working build into a broken one.

So the plumbing is blocked behind fbuild#1380 regardless of effort.

Worth noting: ESP32 already works

On ESP32 — the platform people actually use LittleFS on — no define is needed. platforms/embedded_fs.h selects the backend automatically, so a sketch declaring storage=littlefs gets a working filesystem today and the green message is accurate. The gap is ESP8266-only.

Work

Not a silent failure

embedded_fs_defines() is tested and correct in isolation; it is simply not consumed yet. The reporting function deliberately returns nothing so no caller can appear to apply defines it is dropping — an earlier revision returned them from the reporting path and the caller discarded the value, which read as if the build were acting on it.

Follows #4019.

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