I'm trying to run a Rust Hello World on my STM32F401xB. I have a working C program for comparison (different functionality, but it verifies the flashing toolchain) and use the same openocd commands to flash both programs onto the controller.
When I flash the C program, I get:
...
** Verified OK **
adapter speed: 2002 kHz
When I flash the Rust program, I get the following:
...
** Verified OK **
adapter speed: 2002 kHz
target halted due to breakpoint, current mode: Thread
xPSR: 0x21000000 pc: 0x08002f42 msp: 0x2000ffa0
note the two extra lines. When I connect using gdb
and continue
, I get the Hello, World!
printout through semihosting, so the program does in principle execute fine - it just pauses before main even though I have not set a breakpoint. My procedure for both binaries is the same. What could be going on? Why are the two binaries behaving differently?
svd2rust
to create a stm32f40x
crate from the official stm32f401.svd
cortex-m-quickstart
and basically the hello.rs
example - configuring memory.x
and adding the dependency to stm32f40x
of courseI get the Hello, World! printout through semihosting
Check the semihosting documentation. Last time I checked, semihosting works using breakpoints on several ARM targets.
Your C program probably does not use semihosting at all, so no breakpoints are used.