On boot (before USB setup, so the flash write cannot disrupt enumeration) the
device mounts the Mass Storage FAT volume and uses it:
- fatfs 0.4 (git rev c4b88477; 0.3.6 needs core_io for no_std) via a read-only
FlashIo over the .filesystem region (reads flash through a black_box ptr).
- If the root-dir volume label is not "PM_G-1" (e.g. a leftover CircuitPython
volume), write an embedded blank PM_G-1 FAT12 template (src/fat_template.bin =
first 7 sectors of mkfs.fat -F12 -S4096 -n PM_G-1; sets both BPB + root-dir
VOLUME_ID label) -> the drive now shows as PM_G-1.
- Read programs.json (LFN) and a tolerant scanner (parse_setlists) turns it into
user set lists appended to the built-ins. Drop programs.json on the drive,
reboot, your grooves appear (B-hold cycles set lists).
Set lists are now a runtime Vec<SetList>{title,items} (built-ins -> owned +
drive); refactored load/next_track/next_setlist/goto_target/prepare_next/sel.
Validated off-bench: a host probe ran fatfs against a real mkfs 4096-sector image
(label + programs.json read confirmed) before flashing.
WRITE-from-device (practice log / settings) is still deferred (the read path is
in; needs a write-back FlashIo).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
1.5 KiB
TOML
30 lines
1.5 KiB
TOML
[package]
|
|
name = "pm-grid"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
description = "PM_G-1 'Grid' firmware (RP2040 / Pimoroni Pico Scroll Pack PIM545). 17x7 IS31FL3731 LED metronome — Rust sibling of pico-scroll/app.py."
|
|
|
|
[dependencies]
|
|
rp2040-hal = { version = "0.11", features = ["rt", "critical-section-impl", "defmt"] }
|
|
rp2040-boot2 = "0.3"
|
|
cortex-m = "0.7"
|
|
cortex-m-rt = "0.7"
|
|
defmt = "0.3"
|
|
defmt-rtt = "0.4" # logs over RTT, read by `probe-rs run` (the Pi Debug Probe)
|
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
|
embedded-hal = "1"
|
|
track-format = { path = "../track-format" }
|
|
embedded-alloc = "0.6" # track-format parses into Vec/String → needs a global allocator
|
|
usb-device = "0.3" # USB device stack (rp2040-hal provides the UsbBus)
|
|
usbd-midi = "0.5" # USB-MIDI class — the Scroll Pack's only audio path (no speaker)
|
|
usbd-storage = { version = "2", features = ["bbb", "scsi", "defmt"] } # USB Mass Storage (the drive)
|
|
rp2040-flash = "0.6" # run-from-RAM flash erase/program for the filesystem region
|
|
# 0.4.0 (git) — clean no_std IoBase/IoError model (0.3.6 needs core_io for no_std). Reads the FAT
|
|
# drive on-device (load programs.json). Pinned for reproducibility.
|
|
fatfs = { git = "https://github.com/rafalh/rust-fatfs", rev = "c4b88477", default-features = false, features = ["alloc", "lfn"] }
|
|
|
|
[profile.release]
|
|
opt-level = "s"
|
|
lto = false # fat-LTO trips a duplicate soft-float intrinsic (__addsf3) across the USB/flash deps
|
|
codegen-units = 1
|
|
debug = 2
|