Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exclude = [
libraries = [{ path = "dylints/*" }]

[workspace.package]
version = "2.5.13"
version = "2.5.14"
edition = "2021"
rust-version = "1.94.1"
license = "MIT OR Apache-2.0"
Expand Down
30 changes: 16 additions & 14 deletions agents/docs/deploy-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,21 @@ The follow-up issues track the full polymorphic version:
FastLED/fbuild#1162) selects which stock transport is tried first:

- **`picotool` (default).** After the unchanged pre-touch/1200-bps-touch/
UF2-preparation steps and a best-effort bounded BOOTSEL volume wait
(mounting is not required — failure to mount only affects the
mass-storage fallback), fbuild runs a Windows-only PICOBOOT driver
preflight (`crates/fbuild-deploy/src/rp2040_preflight.rs`,
FastLED/fbuild#1163: classifies `present_usb_problem_devices()` for a
`VID_2E8A&PID_0003` composite-interface devnode stuck at a
`CM_PROB_FAILED_INSTALL`-family Config Manager code), then a bounded
`picotool info` probe, then `picotool load <uf2> -f -x`. A driver-missing
preflight result skips picotool outright (no probe/load timeout burned)
and names the exact devnode + WinUSB (Zadig) guidance. Any picotool
failure — preflight skip, probe failure, or load failure — falls back to
the BOOTSEL mass-storage path below; if that also fails, the combined
error names both transports' failures.
UF2-preparation steps and a best-effort bounded BOOTSEL volume wait,
fbuild derives one exact BOOTSEL VID:PID from the verified FastLED/boards
profile for the selected RP family and binds each picotool operation to
that identity plus the selected runtime USB serial:
`--vid 0x<registry-vid> --pid 0x<registry-pid> --ser <serial>`. It then
runs a Windows-only PICOBOOT driver preflight for that same composite
interface, a bounded `picotool info` probe, and `picotool load <uf2> -x`.
It intentionally does **not** use `-f`: a failed 1200-bps transition must
not let picotool reset some other compatible RP board. A missing runtime
serial or ambiguous/missing registry BOOTSEL identity disables picotool;
fbuild uses only an explicitly identified BOOTSEL mass-storage volume. A
Windows driver problem, including Code 43, also skips picotool rather than
spending its timeout. Any remaining picotool failure falls back to the
BOOTSEL mass-storage path; if that also fails, the combined error names
both transports' failures.
- **`uf2`.** Preserves the historical order exactly: BOOTSEL mass-storage
first (with bounded transfer retries across fresh enumerations), managed
picotool as the fallback.
Expand All @@ -118,7 +120,7 @@ else logs a warning and keeps the default:
| `FBUILD_RP2040_BOOTLOADER_TIMEOUT_SECS` | 10 s | BOOTSEL volume discovery after the 1200-bps touch (and re-discovery between transfer retries) |
| `FBUILD_RP2040_UF2_WRITE_TIMEOUT_SECS` | 60 s | Per-attempt watchdog on the `NEW.UF2` write; a timed-out write feeds the normal retry/picotool-fallback path |
| `FBUILD_RP2040_POST_DEPLOY_TIMEOUT_SECS` | 15 s | Eject watch after the write, and the runtime-CDC reappearance wait |
| `FBUILD_RP2040_PICOTOOL_TIMEOUT_SECS` | 60 s | `picotool load -f -x` budget, both as the picotool-primary load and the picotool-fallback load |
| `FBUILD_RP2040_PICOTOOL_TIMEOUT_SECS` | 60 s | Target-bound `picotool load -x` budget, both as the picotool-primary load and the picotool-fallback load |

Outcome note: once the eject watch (mass-storage path) or a successful
picotool load (primary or fallback) has confirmed the ROM accepted the
Expand Down
23 changes: 23 additions & 0 deletions crates/fbuild-core/src/usb/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ pub fn profiles_for(vid: u16, pid: u16) -> Vec<UsbTransportProfile> {
profiles
}

/// Return every verified USB transport profile, ordered by descending
/// publisher priority. Callers that need to correlate a runtime endpoint with
/// a bootloader endpoint must derive both identities from this registry rather
/// than carrying a built-in VID/PID table.
pub fn all_profiles() -> Vec<UsbTransportProfile> {
let Ok(guard) = INSTALLED.read() else {
return Vec::new();
};
let Some(installed) = guard.as_ref() else {
return Vec::new();
};
let mut profiles: Vec<_> = installed
.identities
.iter()
.map(|entry| entry.profile.clone())
.collect();
profiles.sort_by(|left, right| right.priority.cmp(&left.priority));
profiles
}

fn identity_pid_matches(entry: &IndexedProfile, candidate: u16) -> bool {
let Some(expected) = entry.pid else {
return true;
Expand Down Expand Up @@ -540,6 +560,9 @@ mod tests {
assert_eq!(profiles.len(), 1);
assert_eq!(profiles[0].role, UsbDeviceRole::RuntimeCdc);
assert_eq!(profiles[0].family.as_deref(), Some("synthetic-family"));
let installed = all_profiles();
assert_eq!(installed.len(), 1);
assert_eq!(installed[0].identity_match.vid, "feed");
let board = board_profile("synthetic-alias").unwrap();
assert_eq!(board.board_id, "synthetic-board");
assert_eq!(board.primary_compile_identity, Some((0xfeed, 0xc0de)));
Expand Down
Loading
Loading