Adapt the usbd-storage rp2040 example into pm-grid as a composite MIDI+MSC device: - Host sees a 1MB removable drive backed by the upper 1MB of flash (a .filesystem region, NOLOAD so it stays out of the UF2 and survives reflashes). - scsi_command handles the SCSI set (Inquiry / ReadCapacity10/16 / ReadFormatCapacities / Read / Write / ModeSense / RequestSense / TestUnitReady). Reads come from flash via raw pointer; writes accumulate a 4KB block then erase+program the sector with rp2040-flash (wrapped in interrupt::free). - Host owns the FAT format (formats on first use). Unblocks on-device persistence. - Composite poll: usb_dev.poll([&mut midi, &mut scsi]); scsi.poll services commands. Build fixes required by adding rp2040-flash: - rp2040-hal 0.10 -> 0.11 (0.10 + rp2040-flash 0.6 both export the __aeabi_*/ __addsf3 ROM intrinsics -> duplicate symbols). No HAL API breakage. - lto = false + codegen-units = 1 (fat-LTO tripped the same duplicate intrinsic). UF2 stays ~257KB thanks to NOLOAD. defmt logs on block writes + unknown commands. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
1.2 KiB
TOML
27 lines
1.2 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
|
|
|
|
[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
|