-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Steps to reproduce
I build the rp/wifi_blinky.rs and rp235x/blinky_wifi.rs examples using cargo build --bin wifi_blinky --release . I then try to debug the program in VS Code with this launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "probe-rs-debug",
"request": "launch",
"name": "probe-rs Test",
"cwd": "${workspaceFolder}",
// "connectUnderReset": true,
// "chip": "RP235x",
"chip": "RP2040",
"flashingConfig": {
"flashingEnabled": true,
"haltAfterReset": true
},
"coreConfigs": [
{
"coreIndex": 0,
"programBinary": "./examples/rp/target/thumbv6m-none-eabi/release/wifi_blinky"
}
]
}
]
}
Flashing works and the debugger starts. Also, the debugger halts the execution right after the beginning. After I continue the program execution, the LED starts blinking.
Now I set a breakpoint in one of the lines within the loop using VS Code:
embassy/examples/rp/src/bin/wifi_blinky.rs
Lines 70 to 76 in 61797d5
| info!("led on!"); | |
| control.gpio_set(0, true).await; | |
| Timer::after(delay).await; | |
| info!("led off!"); | |
| control.gpio_set(0, false).await; | |
| Timer::after(delay).await; |
However, the execution does not halt.
When I manually set a breakpoint in the loop using cortex_m::asm::bkpt(); the code execution halts but VS Code opens the file /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cortex-m-0.7.7/asm/inline.rs and marks the line
asm!("bkpt", options(nomem, nostack, preserves_flags));
as being currently executed rather than the corresponding line in the wifi_blinky.rs file.
- When I use a STM32H743 (also connected to the picoprobe) and the corresponding blinky example, everything works as expected.
- When I build a binary using the Pico C/C++ SDK and flash is using probe-rs, everything works as expected as well.
That's why I think that the problem is the binary and debug info produced by Rust/ embassy-rs rather than the picoprobe or probe-rs.
What I have also tried:
- Switch to the nightly toolchain.
- Modifying the
[profile.release]section of theCargo.tomlto:
[profile.release]
codegen-units = 1
debug = 2
debug-assertions = false
incremental = false
lto = 'fat'
opt-level = 3
overflow-checks = false