μAMP: Asymmetric Multi-Processing on microcontrollers

May 10, 2019

An asymmetric multiprocessing (AMP) system is a multiprocessor computer system where not all of the multiple interconnected central processing units (CPUs) are treated equally. – Wikipedia What is μAMP? microamp (styled as μAMP) is a framework (library plus cargo subcommand) for building bare-metal applications that target AMP systems. This blog post is a deep dive into this framework which serves as the core foundation of the multi-core version of Real Time For the Masses (RTFM), which I’ll cover in the next blog post. ... Read more

cargo-call-stack, part 2: getting call graph information from rustc

April 13, 2019

In a previous post I described the current implementation of cargo-call-stack, a static stack usage analysis tool. In the second part of that post I described the problems the tool runs into when dealing with indirect function calls (both function pointer calls and dynamic dispatch) and proposed improving the output of the tool by having rustc inject type information in the LLVM IR it produces. While discussing that idea with rustc developers they noted that the compiler could emit information that’s more relevant to call graph analysis than just the signatures of functions and trait methods. ... Read more

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

Creative Commons License
Jorge Aparicio