#work #server #register #exit #stack-trace #variables

app erdb

A debugger for rust on embedded systems

3 releases

0.2.2 Oct 16, 2022
0.2.1 Oct 16, 2022
0.2.0 Oct 1, 2022

#466 in Debugging

MIT/Apache

125KB
3K SLoC

Embedded Rust Debugger (erdb)

A debugger for rust on embedded systems.

Erdb currently only work on Linux. It is only tested on a STM32F411RETx dev board.

Features

  • Flash target.
  • Continue, halt, step, and reset program.
  • Set and clear hardware breakpoints.
  • Print variables, registers, MCU status, and more.
  • Print stack trace.
  • Disassemble machine code.

Installation

cargo install --path .

Run

Erdb has the two following modes:

  • CLI mode - Starts a TUI in the terminal.
  • Server mode - Starts a DAP server.

Erdb will start in CLI mode by default. More information on the two modes in the subsections bellow.

CLI Mode

Start erdb with the following command:

erdb

NOTE: Almost all sub commands have an alias, which is usually first letter of each word in the sub command. Examples: target c = target continue, info st = info stack-trace.

Erdb requires the $3$ following configurations:

  • chip - Type of chip, example STM32F411RETx.
  • work-directory - The absolute path to the root of the project directory.
  • elf-file - The absolute path to the compiled binary/elf file.

Which can be set using the config command.

But, the easiest way to use erdb, is to make a shell script that starts erdb and sets all $3$ configurations. It would look something like this:

#!/bin/bash
erdb --chip STM32F411RETx \
--work-directory /home/niklas/exjobb/nucleo64-rtic-examples \
--binary-file-path /home/niklas/exjobb/nucleo64-rtic-examples/target/thumbv7em-none-eabi/debug/nucleo-rtic-blinking-led

Server Mode

To start erdb as a DAP server use the following command:

erdb -m server

It is recommended to use flag -v for more server logs.

Erdb use port 8800 by default, however this can be changed with the flag -p <port>.

Crate rust-debug

Erdb is built using the debug crate rust-debug. Therefore, this is a great example of how to use that crate.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~72MB
~1.5M SLoC