memory.x
and .cargo/config
files are automatically copied over based on the
microcontroller being used. Select the microcontroller by using features
. By
default, stm32f0
is selected:
cargo build --release
WARNING The very first time a build is run on a fresh repo, or when changing between chips it is advisable to build twice as the
memory.x
and.cargo/config
files don't appear to be picked up on the first run. It may also be advisable tocargo clean
between builds.
To build for STM32F1 chips, run
cargo build --release --features stm32f1
To check the built size
cargo size --release
To deploy on STM32F103C8 (blue pill) target
cargo flash --chip stm32f103c8 --release
To deploy on STM32F042 target
cargo flash --chip STM32F042F4Px --release
Debugging on device requires two terminals. In one terminal:
openocd -f interface/stlink.cfg -f target/stm32f0x.cfg
In a second terminal:
arm-none-eabi-gdb -q ./target/thumbv6m-none-eabi/release/pedalrs -ex "target remote :3333"
Once GDB loads
l
b main
c
This will stop at the start of the main function. From there you can use normal gdb
commands to debug.