I am new to rust and its ecosystem (but not to embedded programming in general, for which I have used C so far).
As a first step to try out the tools, I have compiled the "blinky" and "usb-serial" examples provided with "embassy" and ran them on an STM32F103.
Basically, I was able to start these using
cargo run --release
I also saw the debug info sent back to the host by the info! macros. So far so good!
Then, I interrupted the output with Ctrl-C.
The applications were still running on the target. I saw the LED blinking and the echo of data sent over the terminal of a computer attached to the USB serial port of my target board.
However, after that, I unfortunately am unable to re-connect to the target board.
Repeating the above command yields:
$ cargo run --release
Finished release [optimized + debuginfo] target(s) in 0.09s
Running `probe-rs run --chip STM32F103C8 target/thumbv7m-none-eabi/release/embassy-stm32f1-examples`
Error: Connecting to the chip was unsuccessful.
Caused by:
0: An ARM specific error occurred.
1: The debug probe encountered an error.
2: An error specific to a probe type occurred
3: Command failed with status SwdApFault
So I am unable to re-flash the software.
I disconnected and re-connected the power to my target, and to my STLink adapter, but this did not help.
Probe-rs "sees" the STLink,
$ probe-rs list
The following debug probes were found:
[0]: STLink V2 (VID: 0483, PID: 3748, Serial: 51C3BF700649C2865256154105C287, StLink)
On one hand, I would like to re-connect to see the info! macro messages sent over the SWD interface, as before I hit Ctrl-C, but don't know how to do that. I tried probe-rs attach (the manual says "This is great for inspecting a target - where you might not even have knowledge of the firmware - without altering its state." but attach nevertheless asks for the path to an ELF file... I don't understand this).
What can I do to resolve this?