app-template
app-template copied to clipboard
semihosting on the "blue pill" board
Hello knurling-rs,
I can't seem to get semihosting to work with the app-template and my STM32F103C8T6 "blue pill" board. I'm using VSCode and the "Debugger for probe-rs" behind an STLink V2:
$ probe-rs list
The following debug probes were found:
[0]: STLink V2 (VID: 0483, PID: 3748, Serial: [...], StLink)
$ probe-rs info
Probing target via JTAG
ARM Chip:
Debug Port: Version 1, DP Designer: ARM Ltd
└── 0 MemoryAP
└── ROM Table (Class 1)
├── Cortex-M3 SCS (Generic IP component)
│ └── CPUID
│ ├── IMPLEMENTER: ARM Ltd
│ ├── VARIANT: 1
│ ├── PARTNO: 3107
│ └── REVISION: 1
├── Cortex-M3 DWT (Generic IP component)
├── Cortex-M3 FBP (Generic IP component)
├── Cortex-M3 ITM (Generic IP component)
└── Cortex-M3 TPIU (Coresight Component)
[...]
Now, whenever I start debugging anything, I end up in line 212 of cortex-m-semihosting/src/lib.rs, indicative of a failed semihosting attempt.
In a more "bare" setup (without knurling-rs, using the "Cortex-Debug" VSC extension and a manually setup "cargo build" prelaunch task) I was able to resolve the same issue leveraging "preLaunchCommands" for the gdb process, i.e. "monitor arm semihosting enable". I can't seem to find a similar setting with the arguably better approach using probe-rs and knurling.
I've selfhosted both experimental projects in my gitea instance and added a containers.dev config for convenience.
- With knurling + probe-rs (failed semihosting): https://code.yavook.de/jmm/bluepill-knurling-rs
- With manual setup + Cortex-Debug: https://code.yavook.de/jmm/bluepill-rust-blinky/src/commit/4132b45631b65d326b8f4ad85acfbc752b64c18a
Any ideas forward?
Crossposted at probe-rs/vscode/issues/89
The Knurling project generally recommends defmt over RTT as the logging mechanism instead of semihosting. We typically only suggest semihosting for causing probe-rs to quit, e.g. after running a short example. You could ask the probe-rs team on Matrix to see if they support whichever semihosting operation you are attempting to use.