liveBook · Manning

Probe-rs

As explained in Embedded Software with Rust

The probe-rs crate is a Rust library for communicating with debug probes, flashing embedded targets, and capturing RTT data.

probe-rs is a Rust library and toolset for communicating with debug probes and controlling embedded targets. It supports flashing, reset and run control, debug transport, and RTT capture. Higher-level tools such as cargo-flash and cargo-embed build on this foundation. section 2.6.1 section 6.2.4

A Cargo runner lets cargo run flash and start firmware on the target. Configure the runner in .cargo/config.toml with the target architecture and chip name. Use probe-rs chip list to find recognized chip identifiers. section 2.6.1 section 6.3.4

[target.thumbv7m-none-eabi]
runner = "probe-rs run --chip STM32F103C8Tx"

This runner configuration selects the thumbv7m target and an STM32F103C8Tx chip for a Blue Pill board. section 2.6.1

Alternatively, invoke probe-rs run directly with a chip identifier and a built ELF path. It flashes the binary and streams RTT output to the terminal. For defmt logs, it also uses ELF metadata to decode the output. section 6.2.4 section 6.3.4

cargo install probe-rs-tools
probe-rs run --chip STM32F103C8T6 target/thumbv7m-none-eabi/release/app

Install the tools, then run a built application on the specified chip. section 6.2.4

RTT output is read from a target RAM buffer through the debug probe while firmware runs. For a one-off command, probe-rs run keeps the chip and ELF path explicit. For more involved settings, cargo-embed stores configuration in Embed.toml and can also provide a GDB server. cargo-flash is a simpler choice when live logging and debugging are not needed. section 6.2.4 section 2.6.1

Run firmware on a Blue Pill

Set up the app template and install the thumbv7m-none-eabi Rust target. In .cargo/config.toml, select that build target and set the runner chip to STM32F103C8. With the project's memory map in place, cargo run --release --bin phoenix builds and runs the example, which prints a message using defmt. section 2.6.4

How Embedded Software with Rust covers it

How deep it goes
Walks through runner configuration, direct invocation, flashing, and RTT capture without detailing the library API.
Examples
Uses a Blue Pill firmware project and a direct STM32F103C8T6 ELF invocation to demonstrate deployment and logging.
What it assumes
Assumes a Rust toolchain and target hardware while walking through project setup, target installation, and runner configuration.
What you can do after
Apply it via probe-rs run or a Cargo runner to flash firmware and view RTT output.
How it connects
Connects Cargo runners and RTT logging with defmt, cargo-flash, and cargo-embed.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Embedded Software with Rust. The section links point to the parts of the book it draws on.