Skip to content

feat(buildfs): build RP2040 littlefs images from the arduino-pico flash menu - #1792

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

zackees merged 1 commit into
mainfrom
agent/buildfs-rp2040

Conversation

@zackees

@zackees zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member

What

fbuild buildfs sized its image from an ESP32 partition CSV, so an RP2040
project (which has no partition table) could not build a filesystem image at
all. arduino-pico declares the filesystem bounds on its own terms: each
flash menu option carries build.fs_start / build.fs_end, and the RP2040
build already turns those into the FS_START / FS_END defines.

This reads the same boards.txt properties through the same loader the build
uses, so the image region and the firmware's mount point cannot drift apart.

Changes

  • new crates/fbuild-cli/src/cli/buildfs_rp2040.rs — resolves the region
    from framework-arduinopico's boards.txt (PlatformIO package dir, then
    fbuild's extracted platform cache) with
    fbuild_build::arduino_props::load_board_props_with_menu_overrides, so
    board_build.filesystem_size / board_build.flash pick the same menu
    option the build picks.
  • buildfs.rs — plan_image branches on the environment's platform:
    RP2040 → arduino-pico flash menu, ESP32 (or no declared platform) → the
    existing partition-CSV path. ProjectContext.partitions_csv is now optional,
    and a platform with no filesystem story gets a named error instead of
    "partition table 'default.csv' not found".
  • failures that are configurations, not mysteries:
    • fs_start == fs_end (the stock 2 MB Pico default reserves no volume)
      fails with both addresses and the board_build.filesystem_size knob;
    • --filesystem=spiffs is refused — arduino-pico has one driver, and
      building littlefs under a spiffs request would hand the firmware an image
      it does not mount.
  • docs — docs/reference/cli.md gains an RP2040 subsection.
  • uploadfs is unchanged and still ESP32-only: an RP2040 filesystem is
    written over PICOBOOT/UF2, not an esptool region write. Only its doc
    comment was corrected ("the only platform uploadfs can write to").

Verification (real output)

RP2040 fixture project (platform = raspberrypi, board = rpipico,
board_build.filesystem_size = 0.5m, three files in data/):

$ fbuild buildfs rp2040-proj
filesystem: littlefs   partition: filesystem @ 0x1017f000 (524288 bytes)
data: 3 file(s), 70020 bytes; image estimate 79872 bytes (15% of partition)
image: .../build/rpipico/release/littlefs.bin (524288 bytes)

0x1017f000 is arduino-pico's own build.fs_start for the 512 KB option.

$ mklittlefs -l littlefs.bin
70000   /blob.bin
13      /greeting.txt
<dir>   /sub
7       /sub/deep.txt

$ mklittlefs -u unpack littlefs.bin && cmp unpack/blob.bin data/blob.bin
blob byte-identical

No board_build.filesystem_size:

config error: board 'rpipico' reserves no filesystem space: build.fs_start
0x101ff000 and build.fs_end 0x101ff000 in .../framework-arduinopico/boards.txt
are the same region. Pick a `flash` menu option that gives the filesystem room
(set `board_build.filesystem_size`, for example `0.5m`) ...

Gates: soldr cargo test -p fbuild-cli --bin fbuild buildfs → 26 passed / 0
failed
(7 new), cargo fmt --check clean, clippy --workspace --all-targets -- -D warnings rc 0, ci.run_dylint --package fbuild-cli rc 0, platform
boundary rc 0 (rows=44, dylint_rows=43).

Refs #1358 (ESP8266 image building remains; RP2040 flashing remains PICOBOOT
work).

…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
@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 e1cf487 Oct 30, 2026
29 checks passed
@zackees
zackees deleted the agent/buildfs-rp2040 branch October 30, 2026 03:44
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 31, 2026
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