Programming Language
The course suggestion is to program in C (or C++) and use STM32CubeIDE to generate the microcontroller-configuration (setting pins as input/output, setting up I2C, etc.), but this was not a hard requirement.
I chose Rust for the following reasons:
- It is a systems programming language with similar performance to C/C++
- The language offers many memory-safety related features which C & C++ lack
- There are many companies and projects which have done research on this and come to the conclusion that this can't be solved
with C/C++ and are moving towards Rust, e.g.:
- Linux Kernel 6.1 with Rust Support for Drivers
- Android: Memory Safe Languages in Android 13
- Microsoft Security Response Center: Blog Series on Memory Safety
- Microsoft Azure CTO Statement
- AWS loves Rust
- Mozilla is oxidating Firefox
- Chromium supports Rust
- Tangram Vision: Why Rust for Robots?
- tonari: 3K, 60fps, 130ms: achieving it with Rust
- There are many companies and projects which have done research on this and come to the conclusion that this can't be solved
with C/C++ and are moving towards Rust, e.g.:
- Embedded development is nowadays well-supported in Rust:
- Active community around it (incl. a working group)
thumbv7em-none-eabihf
(for our STM32F4 chip) is a tier 2 target for the compiler- HAL implementations available for all relevant chips
- Drivers (target-agnostic, based on
embedded-hal
traits) exist for a lot of peripherals - Frameworks for many common functionalities exist
- Various RTOS and RTOS-like frameworks exist
- Due to the
embedded-hal
abstraction most of the code can be written in a device-agnostic manner, making it more portable. - The language offers many more modern, concise ways of writing code compared to C/C++
- Personal reasons
- While I had used Rust before, I had never used it for embedded development and wanted to explore this use-case
- I wanted to show Rust as an alternative to C/C++ for the FHGR