Implementing a static stack usage analysis tool

March 13, 2019

(This blog covers the implementation details of cargo-call-stack v0.1.2. If you are only interested in using the tool these tweets and the README will give you an idea of what it can do.) Motivation So, why would you ever want to analyze the stack usage of your program at compile time? The obvious answer is when you want to know if your application can stack overflow at runtime without actually running your program. ... Read more

RTFM v0.4: +stable, software tasks, message passing and a timer queue

December 19, 2018

Hey there! It’s been a long time since my last post. Today I’m pleased to announce v0.4.0 of the Real Time for The Masses framework (AKA RTFM), a concurrency framework for building real time applications. The greatest new feature, IMO, is that RTFM now works on stable Rust (1.31+)! 🎉 🎉 🎉 This release also packs quite a few new features which I’ll briefly cover in this post. For a more throughout explanation of RTFM’s task model and its capabilities check out the RTFM book, which includes examples you can run on your laptop (yay for emulation), and the API documentation. ... Read more

Weekly driver 4: ENC28J60, Ethernet for your microcontroller

March 13, 2018

It’s week number 11 and the weekly driver #4 is out! Last time, I did drivers 1 and 2 so you may be wondering where’s driver 3? Driver #3, the MCP3008, was covered by @pcein in their blog. Also, as of now there are at least 14 (!) drivers being worked on by the community. This week I’m releasing a driver for the ENC28J60, an Ethernet controller with SPI interface. ... Read more

Weekly driver 1 & 2: L3GD20, LSM303DLHC and Madgwick

February 19, 2018

Oh, time flies. It’s already week 8 and we have zero weekly driver posts out there – don’t worry though because there’s plenty of drivers and embedded-hal implementations in the works. To play catch up in this post I’ll cover two embedded-hal drivers: the l3gd20 and the lsm303dlhc. The L3GD20 is an IC that contains a gyroscope and exposes I2C and SPI interfaces; the LSM303DLHC is an IC that contains an accelerometer and a magnetometer, and exposes an I2C interface. ... Read more

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

Memory safe DMA transfers

February 9, 2018

UPDATE Given the comments I’ve received so far I think I should more explicitly mention that the context here are systems that lack a MMU and where a memory allocator may or may not be available or desirable, e.g. Cortex-M microcontrollers. In this post I’ll describe an approach to building memory safe DMA based APIs. DMA? DMA stands for Direct Memory Access and it’s a peripheral used for transferring data between two memory locations in parallel to the operation of the core processor. ... 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

Embedded Rust in 2018

January 21, 2018

This is my #Rust2018 blog post. These are some things I think the Rust team needs to address this year to make Rust a (more) viable alternative to C/C++ in the area of bare metal (i.e. no_std) embedded applications. Stability Here’s a list of breakage / regressions I encountered (i.e. that I had to work around / fix) during 2017: Changes in target specification files broke compilation of no_std projects that use custom targets. ... Read more

Brave new I/O

January 18, 2018

Hey there! It’s been a while. I’ve been working on some cool stuff for you. Now that’s in more or less good shape I can blog about it! This blog post introduces our new approach to I/O in embedded contexts. Overview: The register model First some background information In microcontrollers all external I/O requires interacting with peripherals. Peripherals are additional pieces of electronics that sit in the same chip / package as the core processor. ... 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

Creative Commons License
Jorge Aparicio