Skip to main content
Flash firmware through USB DFU using dfu-util on the box. This is the path for a DUT with no debug probe attached, or one that exposes a DFU bootloader. Requires box software 0.33.0 or newer, and dfu-util installed on the box.

Handle

DFU is a box-level capability, not a net. There is no net name and no name().

Methods

Types

DfuOptions

Default selects whatever single DFU device is on the bus. With more than one attached, dfu-util errors on the ambiguity rather than guessing, so name one.

DfuDevice

mode is "DFU" for a device already in its bootloader, and "Runtime" for one running an application that advertises DFU capability.

DfuOutput

Method Reference

list() -> Result<Vec<DfuDevice>>

Enumerate DFU-capable devices, parsed from dfu-util -l into typed records.

download(firmware: &[u8], opts: &DfuOptions) -> Result<DfuOutput>

Upload firmware to the box and flash it. The bytes are base64-encoded into the request, so nothing needs to exist on the box’s filesystem first.
An STM32 system bootloader needs dfuse_address. Without it, dfu-util has no base address to write to and the download fails.

detach(opts: &DfuOptions) -> Result<DfuOutput>

Detach a device from DFU mode, so it leaves the bootloader and runs the application.

Examples

Flash a DUT that has no debug probe

Enter DFU by power-cycling a hub port

Notes

  • dfu-util writes its progress to stderr, not stdout. A successful download still fills DfuOutput::stderr; check exit_code, not whether stderr is empty.
  • A box without dfu-util installed answers with Error::Box and HTTP 500 carrying dfu-util is not installed on this box. Install it with 'lager box-config apt add dfu-util'. This is deliberately not UnsupportedByBox — the route exists, the tool does not.
  • A box older than 0.33.0 does not serve the route at all, and that is Error::UnsupportedByBox.
  • The client allows 180 seconds for a download, above the box’s own 120-second dfu-util budget, to leave room for the upload and for queueing.