probe-rs
The probe-rs
project is a set of tools to interact with embedded MCU's using various debug probes. It is similar to OpenOCD, pyOCD, Segger tools, etc. There is support for Xtensa
& RISC-V
architectures along with a collection of tools, including but not limited to:
- Debugger
- GDB support.
- CLI for interactive debugging.
- VS Code extension.
- Real Time Transfer (RTT)
- Similar to
app_trace
component of IDF.
- Similar to
- Flashing algorithms
Follow the installation and setup instructions at the probe-rs
website.
Espressif products containing the USB-JTAG-SERIAL
peripheral can use probe-rs
without any external hardware.
Flashing with probe-rs
probe-rs
can be used to flash applications to your target since it supports the ESP-IDF image format.
- Example command for flashing an ESP32-C3:
probe-rs run --chip esp32c3
The flashing command can be set as a custom Cargo runner by adding the following to your project's .cargo/config.toml
file:
[target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))']
runner = "probe-rs run --chip esp32c3"
With this configuration, you can flash and monitor your application using cargo run
.
VS Code Extension
There is a probe-rs
extension in VS Code, see probe-rs
VS Code documentation for details on how to install, configure and use it.
Example launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "probe-rs-debug",
"request": "launch",
"name": "Launch",
"cwd": "${workspaceFolder}",
"chip": "esp32c3", //!MODIFY
// probe field only needed if multiple probes connected. <Serial> is the MAC address of your esp in case of usb-jtag
"probe": "VID:PID:<Serial>", //!MODIFY (or remove) | optional field
"flashingConfig": {
"flashingEnabled": true,
"haltAfterReset": true,
"formatOptions": {
"binaryFormat": "idf"
}
},
"coreConfigs": [
{
"coreIndex": 0,
"programBinary": "target/riscv32imc-unknown-none-elf/debug/${workspaceFolderBasename}", //!MODIFY
// svdFiles describe the hardware register names off the esp peripherals, such as the LEDC peripheral.
// They can be downloaded seperatly @ https://github.com/espressif/svd/tree/main/svd
"svdFile": "${workspaceFolder}/esp32c3.svd" //!MODIFY (or remove) | optional field
}
]
},
{
"type": "probe-rs-debug",
"request": "attach",
"name": "Attach",
"cwd": "${workspaceFolder}",
"chip": "esp32c3", //!MODIFY
"probe": "VID:PID:<Serial>", //!MODIFY (or remove) | optional field
"coreConfigs": [
{
"coreIndex": 0,
"programBinary": "target/riscv32imc-unknown-none-elf/debug/${workspaceFolderBasename}", //!MODIFY
"svdFile": "${workspaceFolder}/esp32c3.svd" //!MODIFY (or remove) | optional field
}
]
}
]
}
The Launch
configuration will flash the device and start debugging process while Attach
will start the debugging in the already running application of the device. See VS Code documentation on differences between launch and attach for more details.
cargo-flash
and cargo-embed
probe-rs
comes along with these two tools:
cargo-flash
: A flash tool that downloads your binary to the target and runs it.cargo-embed
: Superset ofcargo-flash
that also allows opening an RTT terminal or a GDB server. A configuration file can used to define the behavior.
GDB Integration
probe-rs
includes a GDB stub to integrate into your usual workflow with common tools. The probe-rs gdb
command runs a GDB server, by default in port, 1337
.
GDB with all the Espressif products supported can be obtained in espressif/binutils-gdb