Commands

onmcu run

Upload firmware, run it on a matching board, and stream its logs.

onmcu run finds a matching board, flashes the firmware, streams its logs, and returns the result.

onmcu run --board <BOARD> --file <PATH>

For example:

onmcu run \
  --board NUCLEO-H743ZI \
  --file target/thumbv7em-none-eabihf/release/my-firmware

Options

OptionDefaultDescription
--board <BOARD>requiredBoard identifier. Use onmcu list-boards to discover valid values.
-f, --file <PATH>requiredFirmware binary or package to upload and flash. A linked ELF is typical for Rust and C projects.
--api-key-from-envoffRead the API key from ONMCU_API_KEY instead of the OS keyring.
-t, --timeout <SECONDS>600Maximum run duration. Accepted range: 59 through 86400. Overrides timeout_seconds from the config file.
--wait-timeout <SECONDS>300How long to wait for an available matching device before prompting to wait again or cancel.
--logging <MODE>rttLog transport: rtt or serial.
--baud <RATE>115200Serial baud rate; used only with --logging serial.
--ignore-trailing-argsoffDiscard arguments appended after the run options by tools such as Cargo or rust-analyzer.

Select a log transport

RTT is the default and supports plain text as well as defmt metadata from the ELF:

onmcu run --logging rtt --board NUCLEO-H743ZI --file firmware.elf

For a firmware that writes to a board UART:

onmcu run \
  --logging serial \
  --baud 115200 \
  --board NUCLEO-F401RE \
  --file firmware.elf

See Firmware logging for when to use each mode.

Waiting for hardware

While a matching board is pending, the CLI polls its job status. After --wait-timeout seconds it offers two choices:

  • w or wait waits for another interval of the same length;
  • any other response cancels the pending job and exits with code 9.

Pressing Ctrl+C also asks whether to cancel. Answer y or yes to send a cancellation request, or resume waiting and log streaming with another answer.

Use as a Cargo runner

Cargo appends the linked executable to the configured runner command. Leave --file last so the executable becomes its value:

.cargo/config.toml
[build]
target = "thumbv7em-none-eabihf"

[target.thumbv7em-none-eabihf]
runner = "onmcu run --board NUCLEO-H743ZI --file"

Now cargo run builds, uploads, and runs the ELF:

cargo run --release

For test harnesses that append their own arguments, see Run Rust tests from VS Code.

Exit status

After the logs end, the CLI checks the job status. It returns 0 for completed, 10 for failed, 11 for cancelled, and 12 for timeout. The device can stop the run at once with a semihosting exit code.

On this page