Skip to content
Snippets Groups Projects
user avatar
lucazulian authored
f09dbc37
History

rust-stm32l432kc

STM32L432KC board examples in rust

Compilation and load

prerequisites

apt-get install binutils-arm-none-eabi
rustup target add thumbv7em-none-eabihf
rustup component add clippy
cargo install cargo-binutils
rustup component add llvm-tools-preview

build

$ cargo build
$ cargo build --release
$ cargo build --target thumbv7em-none-eabihf --release  

check

$ arm-none-eabi-readelf -h <output>
$ arm-none-eabi-readelf -A <output>
$ cargo objdump --release -- --disassemble --no-show-raw-insn
$ arm-none-eabi-size -tA <output>

elf to bin/hex format

$ arm-none-eabi-objcopy -O ihex <output> <output>.hex 
$ arm-none-eabi-objcopy -O binary <output> <output>.bin 

load

$ cp <output>.bin <device-path>
$ cp <output>.bin /run/media/luca/NODE_L432KC

debug with openocd in one console:

$ openocd -f nucleo_l432kc.cfg

in another console:

$ arm-none-eabi-gdb -q -x openocd.gdb <output>

read from serial interface via USB

$ tail -f /dev/ttyACM1
$ screen /dev/ttyACM1 9600

Documentation: