Zero cost stack overflow protection for ARM Cortex-M devices

February 17, 2018

One of the core features of Rust is memory safety. Whenever possible the compiler enforces memory safety at compile. One example of this is the borrow checker which prevents data races, iterator invalidation, pointer invalidation and other issues at compile time. Other memory problems like buffer overflows can’t be prevented at compile time. In those cases the compiler inserts runtime checks, bounds checks in this case, to enforce memory safety at runtime. ... Read more

RTFM v0.3.0: safe `&'static mut T` and less locks

January 22, 2018

RTFM (Real Time For the Masses) v0.3.0 is out! This blog post will cover the goodies of this new release. The minor (breaking) release was mainly to become compatible with the new IO model presented in my previous blog post, but a new feature also shipped with this release: safe creation of &'static mut references. First, let’s look at one feature that landed in v0.2.1 but that didn’t get documented in this blog, yet it was essential to adapt RTFM to the new IO model: ... Read more

RTFM v2: simpler, less overhead and more device support

July 29, 2017

Hiya folks! It’s been a while. Today I’m pleased to present the next version of the Real Time For the Masses framework: cortex-m-rtfm v0.2.0 or just v2, which is how I like to call it. Here’s the executive summary of the changes: v2 is simpler. v1 used a bunch of tokens – ceiling tokens, priority tokens, preemption threshold tokens and task tokens – for memory safety; this made the API rather boilerplatery. ... Read more

A CPU usage monitor for the RTFM framework

June 4, 2017

We have used the RTFM framework in the previous posts but put most of the application logic in tasks, and always sent the processor to sleep in the idle function. In this post we’ll put the idle function to better use and build a CPU usage monitor there. Idle The main logic of the CPU usage monitor will be in the idle function. Let’s see how it works: // RESOURCES peripherals! ... Read more

The ITM and the quest for faster logging

May 31, 2017

In this post we’ll explore the different alternatives one has to log data from a microcontroller to some host machine. Be it for printf style debugging or for logging sensor data. The Blue Pill This time I’ll use a different development board: the Blue Pill. On the center the Blue Pill development board. On the left side a UART to USB adapter based on the CH340G. On the right side an SWD programmer: a Chinese clone of the ST-LINK. ... Read more

Overhead analysis of the RTFM framework

May 23, 2017

In the last post I introduced the RTFM framework, and made several claims about it being highly efficient both in memory usage and runtime overhead. In this post I’ll analyze all the RTFM concurrency primitives to back up those claims. To do that I’ll first introduce a non-invasive timing method that’s accurate to a single clock cycle, which is the time the processor spends to execute one of the simplest instructions. ... Read more

Fearless concurrency in your microcontroller

May 9, 2017

I want to start by thanking all the people that has sent improvements and comments to all the crates and tools I presented in the last blog post. The Rust community rocks! Last time I showed you how to easily develop Rust programs for pretty much any ARM Cortex-M microcontroller. In this post I’ll show you one way of doing memory safe concurrency. It’s important to note that the Rust language doesn’t impose a single concurrency model. ... Read more

Rust your ARM microcontroller!

April 28, 2017

NOTE Embedded Rust development makes use of the nightly channel. The nightly channel moves fast and breaks things unapologetically. That’s why if you want to follow these steps you must use the exact same versions (crates’ and nightly’s) used in these steps. If you want to try the latest and greatest of embeded Rust and use the latest nightly then go grab the latest version of the cortex-m-quickstart template. ... Read more

Creative Commons License
Jorge Aparicio