It's time for another technical blog post about async Rust on embedded. This time we're going to pitch Embassy/Rust against FreeRTOS/C on an STM32F446 microcontroller.
It's time for another technical blog post about async Rust on embedded. This time we're going to pitch Embassy/Rust against FreeRTOS/C on an STM32F446 microcontroller.
They will both be running applications that perform the same actions. We're then going to judge them on the basis of interrupt latency, program size, ram usage and ease of programming. There are already a lot of articles that compare C and Rust, so we're not going to focus on that today.
What I will try to show are two 'normal' applications. Both projects could be tuned to give better performance with a lot of work. Doing that can be a nearly endless task. So as a guideline, the applications will be:
Portable(-ish) to other chips and architectures (aside from the dependency on the HAL)
Straightforward
Tuned with normal options and settings like compiler optimizations, rtos settings and thread priorities
In the end, we should have a basic understanding of how RTOS'es and async executors (can) work.
I am biased, but I hope this blog post gives a fair comparison. If you have suggestions, please let us know!
We'll be testing with the STM32F446ZET6 microcontroller at 180Mhz and some of the measurements will be done with a Rigol DS1054Z oscilloscope.
... continue reading