This project's sole purpose is to understand and explore how Rust can be used in the same way as was done in the led-ext.s assembly language example. This example intentionally does not use any external crates so that it is as close as possible to the original example.
Like we needed with the assembly examples we have to specify a linker script:
$ cargo rustc -- -C link-arg=-Tlinker-script.ldThis has been added to config.toml so we don't have to type this every time we build. We also have to set up the vector table which is done by the script and also we have code in main.rs to handle this.
The board I'm using is STM32F0 which uses Cortex-M0 so we need to add this target to be able to cross compile:
$ rustup target add thumbv6m-none-eabi$ cargo build -vStart openocd:
$ openocd -f board/stm32f0discovery.cfgStart a telnet session:
$ telnet localhost 4444Flash the program:
> reset halt
> flash write_image erase target/thumbv6m-none-eabi/debug/rust-low-level
> reset runRunning should turn on the led:
Debug:
$ arm-none-eabi-gdb target/thumbv6m-none-eabi/debug/rust-low-level