Skip to content

fbuild-deploy: enumerate supported deploy protocols per board; fail fast on unsupported #692

Description

@zackees

TL;DR

Today's fbuild deploy stack accepts a deploy method (esptool, pyocd, 1200bps, future dfu-util, etc.) and tries it; if the board doesn't support that method, the failure surfaces as a 30-180s timeout or a backend-specific error that doesn't say "this board doesn't do OTA." For a user who picks the wrong upload_protocol, the experience is "it hangs."

This issue asks for explicit per-board enumeration of supported deploy methods and a fail-fast guard up front.

Where this came from

The audit on FastLED/FastLED#3339 noted that:

  • ESP32 supports OTA, esptool, esp-jtag.
  • LPC845-BRK supports CMSIS-DAP/pyocd only — no OTA, no esptool.
  • Teensy supports HID bootloader only — no OTA.
  • STM32 with USART boot ROM: DFU + USART, no native OTA.
  • RP2040: BOOTSEL → MSC drag-drop, OR picotool DFU, no OTA.

A bash autoresearch lpc845brk --use-ota attempt today hangs trying esptool or just silently doesn't work depending on which path is taken. The user expectation is "fail fast with a clear message."

Proposed shape

PlatformIO board JSON already has upload.protocol + upload.protocols (array). fbuild reads it. Add a pre-deploy filter:

fn validate_deploy_method(board: &BoardConfig, requested: DeployMethod) -> Result<()> {
    let supported = board.upload.protocols.clone();
    if !supported.contains(&requested.as_str().to_string()) {
        return Err(FbuildError::UnsupportedDeployMethod {
            board: board.name.clone(),
            requested,
            supported,
        });
    }
    Ok(())
}

Error message:

Error: deploy method 'ota' is not supported on board 'lpc845brk'.
       Supported: cmsis-dap, mbed.
       Use `bash autoresearch lpc845brk` (default: cmsis-dap) instead of
       `--use-ota`.

Acceptance criteria

  • validate_deploy_method runs in the top-level orchestrator before any backend is selected.
  • Error carries board, requested, supported so the user gets all three in one read.
  • CI test that picks an unsupported method per board family and asserts the right error.
  • Default --use-XXXX flag → board's first supported protocol when no flag is passed.

Refs

  • FastLED/fbuild#686BOARD_FINGERPRINTS. Same data source (board JSON).
  • FastLED/fbuild#687BoardFamily. The reset_method() API already gates on family; this issue applies the same pattern to deploy method.

Filed from the audit fan-out on FastLED/FastLED#3339.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions