Repository navigation
feat(cli): add fbuild buildfs — LittleFS/SPIFFS image from data/ (#1358) - #1788
Merged
Merged
Conversation
…ata/ PlatformIO's buildfs target had no fbuild equivalent (#1358), so there was no path from a sketch's data/ directory to an on-device filesystem. `fbuild buildfs` packs data/ (or data_dir) into a LittleFS/SPIFFS image sized from the board's partition CSV: - fbuild blob pointers (.fetch / JSON .lnk) are resolved and packed under their projected name; the pointer never ships, and a pointer that does not parse is a build error rather than a file the device would receive instead of its content. - plain-text .lnk files are FastLED's on-device asset links, classified by content, and ship as data. - the filesystem partition is selected by label or by spiffs/littlefs subtype (including the 0x82/0x83 encodings); an oversized data/ fails with the byte shortfall before any image tool runs. - mklittlefs/mkspiffs are resolved from --tool, the PlatformIO package, then PATH; --check-only reports the size plan without running the tool. Flashing the image (uploadfs) stays in #1358; it belongs to the daemon deploy path, not the image builder.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
fbuild buildfs— build a flash filesystem image (LittleFS/SPIFFS) from aproject's
data/, the fbuild equivalent of PlatformIO'sbuildfstarget.This is the image-assembly half of #1358; flashing (
uploadfs) is deliberatelynot in this PR (see "Not in this PR").
Behaviour
data/(ordata_dirfromplatformio.ini).fbuild blob pointers (
.fetch, JSON.lnk) are resolved and packed undertheir projected name (
foo.png.lnk→/foo.png); the pointer itself isnever packed.
.lnkfiles (FastLED's on-device asset links) are ordinarydata and do ship. They are classified by content, not extension: a
.lnkstarting with
{is an fbuild manifest, anything else is device data.development a malformed
.fetchwas silently copied into the image, whichwould hand the device a pointer where it expects content. That is now
BuildFailedand covered by tests.board_build.partitions(project-relative, then theframework's
tools/partitions/), else the frameworkdefault.csv;--partitionsoverrides. The row is selected by subtype(
spiffs/littlefs/0x82/0x83) or--fs-partition <label>.segment costs a directory entry, LittleFS metadata blocks are reserved, and
the total is compared with the partition size. Oversized
data/fails withthe shortfall in bytes instead of failing to mount at runtime.
--tool, then the PlatformIO package(
tool-mklittlefs/tool-mkspiffs), thenPATH.--filesystemoverrides andwarns when it disagrees with the table (the firmware mounts what the table
declares).
--jsonemits a machine-readable plan/summary.Proof (real, on this host)
Unit tests — 18 new, all green:
End-to-end with the host's real
mklittlefs(ver. 05d49dc, PlatformIOtool-mklittlefs) on a scratch project withdata/README.txt,data/assets/logo.png(5000 B) and a plain-textdata/font.lnk:Image size equals the
fspartition size (1048576), as LittleFS requires. Avalid-but-unfetchable
.fetchpointer aborts with the download error insteadof shipping the pointer (exit 1); an oversized
data/fails before toolresolution:
Gates:
cargo fmt --all -- --checkclean,cargo clippy --workspace --all-targets -- -D warningsclean,run_dylint --package fbuild-cliclean,platform boundary
rows=44,check_test_layout.pyok,check_dylint_allowlists.pyok,bash teston the full workspace: 3974 passed, 0 failed, rc=0 (47 test binaries).Not in this PR
uploadfs— flashing the image to the filesystem partition through esptool.That is a daemon deploy operation (region selection + progress plumbing), so it
belongs in its own PR rather than making the image builder depend on the deploy
path. #1358 stays open for it; the partition reader and
fs_tool_argsarereusable there.
Also unchanged: partition-table generation for boards that have no filesystem
region (the CSV must declare one; the error names the requirement), and
FFat/Teensy/AVR targets (no usable flash FS / unsupported by PIO's target).
Refs #1358