3.7.1 调试

01-调试 — Comprehensive Rust

译文 · 基于 Comprehensive Rust

原文链接: https://google.github.io/comprehensive-rust/bare-metal/microcontrollers/debugging.html

3.7.1 调试

Embed.toml:

1
2
3
4
5
[default.general]
chip = "nrf52833_xxAA"

[debug.gdb]
enabled = true

在 src/bare-metal/microcontrollers/examples/ 下的一个终端中:

1
cargo embed --bin board_support debug

在同目录的另一个终端中:

在 gLinux 或 Debian 上:

1
gdb-multiarch target/thumbv7em-none-eabihf/debug/board_support --eval-command="target remote :1338"

在 MacOS 上:

1
arm-none-eabi-gdb target/thumbv7em-none-eabihf/debug/board_support --eval-command="target remote :1338"

在 GDB 中可尝试运行:

b src/bin/board_support.rs:29
b src/bin/board_support.rs:30
b src/bin/board_support.rs:32
c
c
c
最后修改 August 11, 2026: 更新 (70a5af133)