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 ARM & RISC-V architectures along with a collection of tools, including but not limited to:

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
            "flashingConfig": {
                "flashingEnabled": true,
                "resetAfterFlashing": true,
                "haltAfterReset": true,
                "formatOptions": {
                    "format": "idf" //!MODIFY (or remove). Valid values are: 'elf'(default), 'idf'
                }
            },
            "coreConfigs": [
                {
                    "coreIndex": 0,
                    "programBinary": "target/riscv32imc-unknown-none-elf/debug/${workspaceFolderBasename}", //!MODIFY
                }
            ]
        },
        {
            "type": "probe-rs-debug",
            "request": "attach",
            "name": "Attach",
            "cwd": "${workspaceFolder}",
            "chip": "esp32c3", //!MODIFY
            "coreConfigs": [
                {
                    "coreIndex": 0,
                    "programBinary": "target/riscv32imc-unknown-none-elf/debug/${workspaceFolderBasename}", //!MODIFY
                }
            ]
        }
    ]
}

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 of cargo-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