Skip to content

feat(buildfs): build ESP8266 filesystem images from the eagle.flash linker script (#1358) - #1800

Merged
zackees merged 1 commit into
mainfrom
agent/esp8266-buildfs
Oct 30, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/esp8266-buildfs

Conversation

@zackees

@zackees zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member

fbuild buildfs builds filesystem images for ESP32 (partition CSV) and RP2040
(arduino-pico flash menu). An ESP8266 project hit the "ESP32 and RP2040 only"
refusal even though it has a perfectly well-defined volume — this adds the third
platform, closing the ESP8266 half of #1358.

Where the region comes from

An ESP8266 module has no partition table. The flash layout is chosen by the
eesz "Flash Size" menu option in arduino-esp8266's boards.txt, which names a
linker script:

generic.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld

That script is the authority, not the duplicated build.spiffs_start /
build.spiffs_end copies in boards.txt: the firmware links against the
script's _FS_start, _FS_end, _FS_page and _FS_block symbols. So
buildfs_esp8266 parses the script itself and takes the region and the
filesystem geometry from it, exactly the invariant plan_image already gives
ESP32 (partition CSV) and RP2040 (fs_start/fs_end).

The menu option is resolved through the same loader the RP2040 half uses
(fbuild_build::arduino_props::load_board_props_with_menu_overrides), so
board_build.eesz selects the script and board_build.flash_ld pins one
outright.

Why the geometry moved into its own type

An image formatted with different block/page sizes than the firmware mounts with
does not mount, even at exactly the right length. FsGeometry
(buildfs_geometry.rs) now carries block/page/metadata per volume: ESP32 stays
4096/256, an ESP8266 volume takes _FS_block/_FS_page from its linker script
(8192/256 for a 4 MB layout). The size estimate and the mklittlefs/mkspiffs
argv both come from that one value, so the estimate can't be computed under one
geometry and the image written under another. ESP32/RP2040 behaviour is
unchanged (same constants, same argv).

Refusals are named rather than guessed:

  • no _FS_start/_FS_end in the script → error naming board_build.eesz;
  • _FS_start == _FS_end → "reserves no filesystem space";
  • _FS_block/_FS_page missing, zero, or not page-aligned → error, instead of
    silently formatting 4096/256;
  • a board with no build.flash_ld → error naming the Flash Size knob.

LittleFS is the default (SPIFFS is deprecated upstream); --filesystem spiffs
still builds a SPIFFS image. Flashing remains ESP32-only — an ESP8266 write
offset is this address minus the 0x40200000 mapping, and uploadfs does not
have that transport.

Verification

Real end-to-end with the installed arduino-esp8266 3.30102.0 framework and
PlatformIO's mklittlefs, on a fixture project (board = nodemcuv2,
board_build.eesz = 4M2M, data/ = one text file + a 70,000-byte blob):

$ fbuild buildfs
filesystem: littlefs   partition: filesystem @ 0x40400000 (2072576 bytes)
data: 2 file(s), 70014 bytes; image estimate 87552 bytes (4% of partition)
image: .fbuild/build/nodemcuv2/release/littlefs.bin (2072576 bytes)

$ mklittlefs -l -b 8192 -p 256 .fbuild/build/nodemcuv2/release/littlefs.bin
14	/greeting.txt
<dir>	/sub
70000	/sub/blob.bin

Unpacking the image round-trips the blob byte-identically (same sha256). The
region matches eagle.flash.4m2m.ld (_FS_start 0x40400000, 2,072,576 bytes)
and the geometry is the script's 8192/256, not the ESP32's 4096/256.

Gates run locally: 39 buildfs unit tests pass (14 new ESP8266 ones), workspace
clippy --all-targets -D warnings clean, run_dylint --package fbuild-cli
clean, platform-boundary 44/43, test-layout clean, soldr cargo fmt --check
clean, bash test 4020 passed / 0 failed / 107 ignored (rc 0).

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees
zackees added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit f65fdf6 Oct 30, 2026
29 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 31, 2026
@zackees
zackees deleted the agent/esp8266-buildfs branch November 5, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant