Repository navigation
feat(buildfs): build RP2040 littlefs images from the arduino-pico flash menu - #1792
Merged
Merged
Conversation
…sh menu `fbuild buildfs` was ESP32-only: it sized the image from a partition CSV and an RP2040 project has none. arduino-pico instead declares the filesystem bounds per `flash` menu option (`build.fs_start` / `build.fs_end`), which the RP2040 build already turns into the `FS_START` / `FS_END` defines. Read those bounds through the same loader the build uses, so the image region and the firmware's mount point cannot drift apart: * new `cli/buildfs_rp2040.rs` resolves the region via `fbuild_build::arduino_props::load_board_props_with_menu_overrides` on the installed `framework-arduinopico` boards.txt (PlatformIO package, then the extracted platform cache); * `board_build.filesystem_size` / `board_build.flash` select the menu option, exactly as they do for the build; * a board whose menu reserves no filesystem (`fs_start == fs_end`, the 2 MB Pico default) fails with both addresses and the knob to set instead of packing a volume the device cannot mount; * `--filesystem=spiffs` is refused: arduino-pico has one driver, and silently building littlefs would hand the firmware an image it does not mount; * other platforms now get a named error instead of "partition table 'default.csv' not found". Image assembly only: an RP2040 filesystem is written over PICOBOOT/UF2, so `fbuild uploadfs` stays ESP32-only (its guard is unchanged). Verified: RP2040 fixture (`board = rpipico`, `filesystem_size = 0.5m`) packs a 524288-byte littlefs image at 0x1017f000, `mklittlefs -l` lists all three files, unpacking round-trips blob.bin byte-identically, and `--json` reports the same offset/size. 7 new unit tests, `soldr cargo test -p fbuild-cli --bin fbuild buildfs` 26 passed / 0 failed. Refs #1358
|
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 buildfssized its image from an ESP32 partition CSV, so an RP2040project (which has no partition table) could not build a filesystem image at
all. arduino-pico declares the filesystem bounds on its own terms: each
flashmenu option carriesbuild.fs_start/build.fs_end, and the RP2040build already turns those into the
FS_START/FS_ENDdefines.This reads the same
boards.txtproperties through the same loader the builduses, so the image region and the firmware's mount point cannot drift apart.
Changes
crates/fbuild-cli/src/cli/buildfs_rp2040.rs— resolves the regionfrom
framework-arduinopico'sboards.txt(PlatformIO package dir, thenfbuild's extracted platform cache) with
fbuild_build::arduino_props::load_board_props_with_menu_overrides, soboard_build.filesystem_size/board_build.flashpick the same menuoption the build picks.
buildfs.rs—plan_imagebranches on the environment's platform:RP2040 → arduino-pico flash menu, ESP32 (or no declared platform) → the
existing partition-CSV path.
ProjectContext.partitions_csvis now optional,and a platform with no filesystem story gets a named error instead of
"partition table 'default.csv' not found".
fs_start == fs_end(the stock 2 MB Pico default reserves no volume)fails with both addresses and the
board_build.filesystem_sizeknob;--filesystem=spiffsis refused — arduino-pico has one driver, andbuilding littlefs under a spiffs request would hand the firmware an image
it does not mount.
docs/reference/cli.mdgains an RP2040 subsection.uploadfsis unchanged and still ESP32-only: an RP2040 filesystem iswritten over PICOBOOT/UF2, not an
esptoolregion write. Only its doccomment was corrected ("the only platform
uploadfscan write to").Verification (real output)
RP2040 fixture project (
platform = raspberrypi,board = rpipico,board_build.filesystem_size = 0.5m, three files indata/):0x1017f000is arduino-pico's ownbuild.fs_startfor the 512 KB option.No
board_build.filesystem_size:Gates:
soldr cargo test -p fbuild-cli --bin fbuild buildfs→ 26 passed / 0failed (7 new),
cargo fmt --checkclean,clippy --workspace --all-targets -- -D warningsrc 0,ci.run_dylint --package fbuild-clirc 0, platformboundary rc 0 (rows=44, dylint_rows=43).
Refs #1358 (ESP8266 image building remains; RP2040 flashing remains PICOBOOT
work).