The STM32F3DISCOVERY is a development board that has a Cortex-M4 microcontroller (72 MHz, 256 KiB Flash, 40+8 KiB RAM), MEMS sensors (accelerometer, gyroscope and magnetometer), a built-in programmer/debugger, user LEDs and other bells and whistles.
Hello, fellow Rustaceans!
Today, I’m here to announce the version 0.1.0 of my
f3 crate (crates.io). As the title suggests this crate provides a high level, Arduino like API to program the microcontroller in the STM32F3DISCOVERY. Check out the documentation! It has instructions on how to get started and plenty of example programs!
Here’s the list of features as of version 0.1.0
Zero C code/dependencies (yay, one less build step that can go wrong)
High-level, Arduino-like API over LEDs, sensors, timers, etc. (But there’s only two high-level modules right now:
delay. More to come soon!)
An iprint! family of macros to send
print!-formatted messages to the host over the ITM (Instrumentation Trace Macrocell). IOW, you can send messages to your laptop over the same USB cable that you are using to debug your program.
panic!s also send their messages (cause + filename + line number) to the host over the ITM.
The default exception handler (the function that runs when you crash your system) tells you (over the ITM) where your code crashed and under GDB it also gives access to the stack frame that triggered the crash so you can inspect the state of your program (CPU registers) at the moment of the crash.
By default, everything (LEDs, sensors, etc) is initialized before the user entry point, main. So everything Just Works inside
The default behavior of
panic!, the default exception handler and the default pre-main initialization code can all be overridden.
The documentation of this crate does not have information about how to actually “flash” Rust programs into the microcontroller or how to debug those programs using GDB. But the Copper book does! So check that out as well.
Off-topic: I wish Cargo had some feature to build and include the documentation of a crate examples (
examples/*.rs) in the main
cargo doc output. I had to hack a shell script to implement that feature; the
examples module was generated using that script.