This repo contains rust code to run on the STM32 microcontroller of the Avoinics board for my 1KCubeSat project. Hardware design files of the Avionics board can be found in the 1KCubeSat Hardware repo
- The Avionics board is the "main computer" of the CubeSat. It reads from sensors and controls the radio.
- The Avionics software is responsible for telling the EPS what to do.
The STM32 microcontroller for this Avionics board is the STM32L496ZG.
C and C++ based development for STM32 platforms is very well established, and is something I have done before. Rust provided the perfect opportunity to try something new.
- The Cortex-Debug extension in VSCode provides the wrapper around GDB for debugging and stepping through the code.
- See
.vscode/launch.jsonfor Cortex-Debug launch configurations - See
../svd/for SVD register description files for STM32 devices. - OpenOCD is the Debugger, and OpenOCD uses STLink to flash the STM32.
- OpenOCD opens a port for GDB to connect
- See
../openocd_cfg/for OpenOCD configuration files.
I complain about this in the EPS README
If all else fails, here's a manual way to flash your micro
cargo build --release
arm-none-eabi-objcopy -O binary target/thumbv7em-none-eabihf/release/eps out.bin
st-flash --debug --reset --freq=100K write out.bin 0x8000000I use Google Protocol buffers (protobuf) to send messages back and forth from this microcontroller.
To make this work with Rust, and in a no-std environment, I use quick-protobuf. This library allows me to set default-features=false which disables reliance on std. Using the provided pb-rs code generator, I can write .proto protobuf specifications.
- src/messages.proto contains the protobuf definition.
pb-rsis installed viacargo install pb-rs- Call
pb-rs src/messages.prototo generate files. These should be generated in a subfolder ofsrc/, and can be included into the project. - Note that
quick-protobufrequires an allocator, which I supply usingalloc_cortex_m.
See the cortex-m-quickstart repository for a template used to generate this repo

