Read Rust


Posts about using Rust on embedded systems. Including microcontrollers, IoT, and devices.


Rust Thermometer – Part 1 by Robert Vojta
I’ve decided to build a thermometer from scratch. I know, I can buy it, but it’s not fun. I found it as a perfect occasion to please my wife (she wants it) and to try new things. What new things? Mainly and resinOS.
Running Rust and FreeRTOS on the PADI IoT Stamp by Lup Yuen Lee
In this article we’ll explore a better way to build and test programs for microcontroller platforms. Specifically we’ll look at Rust, FreeRTOS and Visual Studio Code. And how I made them run on the PADI IoT Stamp.
Bobbin SDK: Richer Hardware Abstractions for Embedded Systems Programming by Jonathan Soo
Bobbin SDK is a suite of tools and code that has been used in embedded development projects running on a variety of ARM Cortex-M MCUs over the last year and a half. It exists to bridge the gap between the existing Rust ecosystem centered around svd2rust and rich but proprietary vendor SDKs.
Neural networks on a micro controller - Preparation and math by Trangar
I've been playing around with the idea of running a neural network on a micro controller. This project is not designed to be the most efficient neural network, but rather one that runs on a micro controller with very limited resources.
Memory-Mapped Registers in Tock by Branden Ghena
Microcontrollers typically use memory-mapped I/O interfaces to control hardware peripherals. Driver code uses these memory-mapped registers and fields to interact with the peripheral while providing a higher-level interface to the rest of the system. This post describes how Tock deals with register memory maps and a new tool that can automatically generate memory maps for many ARM microcontrollers.
Embedded Rust: Peripherals (and low-level stuffs) - take 1 by Wilfried Chauveau
First of all, low level stuffs such as peripheral drivers should be hidden from the application developer. They should not be able to access directly the registers and mess with the peripheral states/control. The wrong flag in the wrong register can lead to dramatic failures and even damages to the products.
Cross compiling rust with docker by Philippe
I am giving embedded systems another go with a side project of mine. The device has a single purpose. It captures network packets, and forwards them to a server. It is easily achieved with LIBpcap, but the device makes it interesting.

The GL-AR150 sells as a mini smart router. The limited storage makes it hard to install language interpreters, or virtual machines. This pushed me to look into standalone executables, and how to compile them for other devices.
Flipping some bits high on STM32VLDISCOVERY board by Nerijus Arlauskas
Here I will document the steps to get started with STM32VLDISCOVERY board. We will take my favourite “from scratch” approach. That way, we build the final thing step by step while building our understanding of how it all fits together.
c3r3s - Serial 64-bit bootloader for the Raspberry Pi 3 by Robey Pointer
c3r3s is a tiny (1KB binary) serial bootloader for loading "bare metal" 64-bit kernels on the Raspberry Pi 3. You can iterate on your own kernel code without constantly moving the SD card back and forth.
Flipper - A new embedded development paradigm by George Morgan
Flipper is a new kind of development board that redefines the embedded software development cycle by offloading development/debugging into higher level languages + tools. One of the languages that we're putting the most focus into adding support for is Rust. We would love to see more embedded done with Rust and Flipper provides a great springboard for existing Rust developers to familiarize themselves with embedded hardware using the tools they already know how to use.
Embedded Rust: Why? by Wilfried Chauveau
I will try to publish here a series of articles about my approach to embedded development and how I plan to achieve that in Rust.
Cargo, Xargo, and Rustup by Aaron Turon
Another topic of discussion at the Berlin Rust All Hands was the long-term story around Cargo, Xargo, and Rustup. The latter two tools are both involved in managing your Rust toolchain, with Xargo allowing you to build custom stds and Rustup managing pre-built artifacts for mainstream targets. Xargo is most commonly used for cross-compiling to less common platforms, but can also be used to customize the standard library on mainstream platforms.
Building Tiny Rust Binaries for Embedded Linux by James Munns
At the recent 2018 Rust All Hands, I met up with Katharina @spacekookie, who works on an open source project that creates software for Embedded Linux Devices. She had talked with the other engineers on the project about including some Rust components, however with their limited flash storage space (8MB for the whole firmware, including operating system and all other software), she was worried that the Rust binaries wouldn’t fit. The current webserver component for their project was measured in the 100’s of KB, while the Rust binary she produced was already multiple MBs, even with a --release build!
Weekly Driver: Using the SGP30 Gas Sensor from Rust by Danilo Bargen
After the MCP3425 ADC driver I published last month as part of the the weekly driver initiative, I wrote a second Rust embedded-hal driver, this time for the SGP30. The Sensirion SGP30 is a tiny low-power gas sensor (produced in Switzerland) for indoor air quality applications with good long-term stability. It has an I²C interface with TVOC (Total Volatile Organic Compounds) and CO₂ equivalent signals.
Writing A Driver in Rust Using Embedded-Hal Traits for the RN4870 BLE Module by Byron Wasti
This post will document my process and thoughts on writing a driver for a bluetooth module using Rust and the embedded-hal crate. The specific bluetooth device I will be using is the RN4870 BLE castellated module. It features a simple UART interface and handles most of the complexities of BLE itself, making it very easy to get a simple BLE connection up and running.
Safe Peripheral Management by Pat Pannuto
This post describes the recently merged PeripheralManager, which helps software ensure it always accesses hardware correctly, and cleans up after it’s done.
HTS221 Humidity and Temperature Sensor by Daniel Gallagher
ST Micro’s HTS221 is a “capacitive digital sensor for relative humidity and temperature” that can be used over either I²C or SPI. It is factory-calibrated, so there is no end-user calibration to incorporate into your application. The driver provides a simple, high-level API to configure the chip once on startup, then read the temperature and humidity.
Achieving memory safety without compromise by Adam Foltzer
A new generation of safe programming languages is leaving garbage collectors and runtimes behind, delivering memory safety and control.
Tock 1.0 Kernel Released by Amit Levy
We silently tag our first rolling release of the Tock kernel in February. If you’re building applications with Tock or porting to a new board, and want to be immune from updating your code everyday, you can work from that tag. We’ll also upload binary kernel images for the supported board sometime soon.
Weekly Driver: Using the MCP3425 ADC from Rust by Danilo Bargen
Announing the MCP3425 Rust driver.
Weekly driver 4: ENC28J60, Ethernet for your microcontroller by Jorge Aparicio
This week I’m releasing a driver for the ENC28J60, an Ethernet controller with SPI interface. This IC lets you connect your microcontroller, if it has a SPI interface, to a Local Area Network or, with more work, to the internet. Apart from the IC you need a RJ45 connector and a few other components so I’m using this module which has the ENC28J60 and all the required components on a single board.
Rust on the STMicro Nucleo by Daniel Gallagher
For the embedded portion of my project, I had two decisions to make: which processors and chips to use, and which language to write the firmware in. Since this personal project is about learning new skills, I decided to use Rust instead of C. I opted to use STMicro’s Nucleo boards, since their ecosystem has shields that do all of the things I would like (WiFi, BLE, and environmental sensing), and there was also a great Rust tutorial for a similar board. However, since I’ve never really done any embedded development, I decided to start with the old standby: copying code off the internet!
Let's write an embedded-hal-driver by Sebastian Wötzel
Mid January japaric started "The weekly driver initiative" with the goal to kick-start releases of platform agnostic embedded-hal based driver crates. In this post we'll build an embedded-hal-driver for the AT24C32-EEPROM chip.
Discovery: Discover the world of microcontrollers through Rust! - 2018 edition by Jorge Aparicio
This is an mdbook I wrote more than a year ago for a workshop and it's an introductory course to embedded systems that uses Rust as the teaching language. I just updated the starter code to use the latest versions of everything so it's now easier to jump from the book to use the latest developments in the Cortex-M ecosystem; there's no new content, though -- the exercises remain unchanged in terms of goals; just the code has changed.
Transcript: Should you Rust in embedded yet? by Simonas Kazlauskas
This is a transcript of a talk I gave at the Vilnius Rust meetup.

It would not be an exaggeration to say that embedded is omnipresent. You can find embedded firmware everywhere from fridges, microwaves and personal computers to safety-critical applications in automotive, medical fields, etc.

Most of this software is still written in C or C++, and neither of these, given their non-ideal track record in relation to security critical software, are the most confidence inspiring choice for safety-critical systems.

In my experience, bugs occurring in embedded firmware tend to be fairly similar to those commonly found in the user-space software.
An introduction to writing platform agnostic drivers in Rust using the MCP3008 by Pramode C.E
Here is how a device like an accelerometer works: you send the device commands over a serial interface (SPI, I2C), say something like: “get me the X-axis reading”; the device responds by sending back some data.

The way the SPI/I2C/GPIO (and other) interfaces are programmed is very much dependent on the specific microcontroller family. But the actions you need to perform to interface with a device like a temperature sensor / accelerometer etc depend only on the device and are independent of the controller being used. What if you can write a generic accelerometer driver and use it on any microcontroller platform - right from low-end ARM Cortex-M, AVR, MSP430 etc to complex Embedded Linux platforms like the Raspberry Pi? What if you can distribute these drivers on so that you only have to include one line in your Cargo.toml to use it in your code?
I decided to make an 1980's Home Computer in Rust - Part 1 by theJPster
My first attempt at Rust programming was the stellaris-launchpad crate. This has a few demos that either blink the LED or roll it through an RGB rainbow using the PWM timers. Recently I've started a new version of the lm4f120 crate called tm4c123x-hal. The name change reflects TI's new name for basically the exact same part, while the -hal indicates that it's based upon the output of svd2rust and @japaric's new Embedded Hal crate. At the same time, I was watching videos on Youtube about a new wave of 1980's style 'retro' computing boards - text output, BASIC interpreter, etc. An idea started to form that I could put all three of these things together.
Programming an ARM microcontroller in Rust at four different levels of abstraction by Pramode C.E
Covering: Why Rust on Microcontrollers, Level 1: Direct register access in an unsafe block, Level 2: No unsafe blocks, use the API provided by svd2rust, A problem, Level 3: The embedded HAL to the rescue, Level 4: Use a board support crate.
Weekly driver 1 & 2: L3GD20, LSM303DLHC and Madgwick - Embedded in Rust by Jorge Aparicio
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. You can find these two ICs on the STM32F3DISCOVERY board.
Zero cost stack overflow protection for ARM Cortex-M devices by Jorge Aparicio
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. What about stack overflows? For quite a long time Rust didn’t have stack overflow checking but that wasn’t much of a problem on tier 1 platforms since these platforms have an OS and a MMU (Memory Management Unit) that prevents stack overflows from wreaking havoc.
Memory safe DMA transfers - Embedded in Rust by Jorge Aparicio
A blog about Rust and embedded stuff
Experimenting with the New I/O Framework (in Rust) for embedded systems by Pramode C.E
Notes on Code, by Pramode C.E
Rust 2018: Improving Safety and Ergonomics for Low-Level Programming - Bobbin Blog by Jonathan Soo
There’s been a lot written about what can be done to make Rust’s tooling, libraries and infrastructure better for embedded programming, but I’d like to cover a slightly different topic: what can be done to make Rust the language itself safer and easier to use for low-level programming?
Rust 2018: Core, Embedded+SIMD, Intermesiate documenation, Async • r/rust by Nico
Hi there! I'm Nico, and I've been lurking around these parts for about a year now. I thought I'd give my 2 cents on Rust's 2018 plans. Note: this...
Embedded Rust in 2018 - Embedded in Rust by Jorge Aparicio
A blog about Rust and embedded stuff
Embedded Rust in 2018 by theJPster
I recently picked up an embedded project that I hadn't touched for a few months, so I could add some new features. I was disappointed to not...
Pollen Robotics call for #Rust2018: toward stability on embedded systems by Pierre Rouanet
Robotics developers face two main problems: