Embedded Rust on Espressif training material.

Last update: Jun 18, 2022

Embedded Rust Trainings for Espressif

This repository contains Training Material for learning to use Embedded Rust with the Espressif ESP32-C3.

We suggest you start by reading the book.


There is:

  • A book you can work through - (Source) (Published)
  • Some introductory level examples:
  • Some advanced level examples:
    • Low-level GPIO
    • Interrupts in General
    • I2c Driver (Source)
    • I2c Sensor Reading (Source)
    • GPIO/Button Interrupts (Source)
    • Driving an RGB LED
  • Some useful common crates:
  • Some extra bits:

Please note, much of this material remains a work in progress!


Each Rust example crate provided here can be built in the usual fashion. See the Embedded Rust Bookshelf for general details, or each crate's own README.md file for specifics.

The book is written in Markdown, using mdbook. You can render a local copy by running:

~ $ cargo install mdbook
~ $ git clone https://github.com/ferrous-systems/espressif-trainings.git
~ $ cd espressif-trainings/book
~/espressif-trainings/book $ mdbook serve

A local web-server will be started on where you can view the rendered book. It will update automatically as you modify Markdown pages on disk.

Note that you must not push to the main branch. Instead undertake any changes in a branch, either in this repository (if you have access) or in a fork. Please do then feel free to open a Pull Request in Github to merge the changes to our main branch.

This work is continually updated and as such there are no 'releases'. Every commit to main gets published to https://espressif-trainings.ferrous-systems.com automatically.


The material in this repository is licensed CC BY-SA 4.0. All material is Copyright 2022 Ferrous Systems GmbH, unless otherwise stated.

You are free to Share and Adapt but you must give Attribution and Share Alike.

In addition, the source code contained within this repository (either in the book, or as separate examples) is made available under either the MIT or Apache-2.0 licenses, at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Code of Conduct

Contribution to this crate is organized under the terms of the Rust Code of Conduct, and the maintainer of this crate, Ferrous Systems GmbH, promises to intervene to uphold that code of conduct.


  • 1. Add devcontainer

    Adding devcontainer to enable the use of Visual Studio Code remote containers to have a working environment with necessary dependencies among useful VSCode settings and extensions.

    It also includes proper files to run Wokwi simulator with the exercises

    Reviewed by SergioGasquez at 2022-03-28 13:50
  • 2. Cannot find macro 'llvm_asm' in this scope

    I am following the guide here and when trying to run the hardware-check example: cargo espflash --release --monitor /dev/tty.usbserial-1130

    I get the following error: error: could not compile "riscv" due to 366 previous errors warning: build failed, waiting for other jobs to finish... error: build failed error: cannot find macro "llvm_asm" in this scope

    error[E0635]: unknown feature "llvm_asm" --> /Users/reinhard/.cargo/registry/src/github.com-1ecc6299db9ec823/riscv-0.7.0/src/lib.rs:17:45 | 17 | #![cfg_attr(feature = "inline-asm", feature(llvm_asm))]

    I have tried pinning nightly to nightly-2022-03-10 (using rustup install nightly-2022-03-10 and rustup component add rust-src --toolchain nightly-2022-03-10) and to 2022-04-21, but both result in errors.

    Reviewed by reinhardbluelab at 2022-04-22 05:08
  • 3. intro/http-client/example doesn't build without updating riscv to 0.8.0 in esp32-c3-dkc02-bsc

    when trying to run the http-client example

    cargo doc --open

    I got a multitude of errors about the llvm_asm! macro

    error: cannot find macro `llvm_asm` in this scope

    I was able to resolve it by downloading the esp-pacs repo and patch esp32c3 in common/lib/esp32-c3-dkc01-bsc/Cargo.toml

    esp32c3 = "=0.4.0"
    esp32c3 = { path = "/Users/lmckechnie/esp/esp-pacs/esp32c3" }

    This updated the riscv dependency to 0.8.0. I also added the riscv 0.8.0 dependency to intro/http-client/exercise/Cargo.toml

    Reviewed by galamdring at 2022-04-22 15:36
  • 4. More intro docs

    Hi! I have strong opinions about example code :) I've tried to make sure everything in hardware-check is explained with a comment (or just removed).

    I was a little confused that we Box'd the Result that comes from the wifi() function, because then it's hard to unwrap. Should it return a Result<Box<Wifi>> perhaps? I couldn't tell how big Wifi itself was.

    Reviewed by jonathanpallant at 2022-02-11 16:59
  • 5. Led version

    This provides a safe version (Anatol's original approach) for Learners to see, as well as a version that changes the led to a different random color on pushing the button. The led version is the solution to a second part of the exercise that's a bit more creative.

    Reviewed by Mirabellensaft at 2022-03-01 11:15
  • 6. feat: simplified mqtt client to remove the hiearchy and allow easier …

    1. Changed common/lib/mqtt-messages/ to add a new topic, (color_data), aColorDataenum +implthat has one topic and containsBoardLed. This part is exactly like command but without hierarchy. It also has animplto transform theEspMqttMessageinto rgb colors. AllCommand` related code is still there, to implement hierarchical topics in the future.

    2. Changed the example-client to publish to ColorData topic instead of Command.

    3. The solution is using now ColorData instead of Command

    4. Possible error:

    E (107451) MQTT_CLIENT: No PING_RESP, disconnected
    E (192421) MQTT_CLIENT: mqtt_message_receive: transport_read() error: errno=128
    E (192421) MQTT_CLIENT: mqtt_process_receive: mqtt_message_receive() returned -1

    It can depend on the broker/keep alive parameter. I cannot reproduce the error.

    1. Once approved I will update the book accordingly as section 3_5_3 will need different instructions.
    Reviewed by Dajamante at 2022-02-16 11:38
  • 7. Remove warnings

    Removes warnings when building solutions. (Exercises should build but their code is incomplete. Therefore warnings can happen.)

    Sometimes #[allow(unused)] is necessary, e.g. in a sensor since the temperature ranges are there but don't get used just yet.

    Reviewed by BriocheBerlin at 2022-05-31 15:05
  • 8. Fix CI pipeline & devcontainer setup

    This PR fixes the Github CI workflow to build the Docker image in .devcontainer/Dockerfile. The Docker image is now built fully, all Rust projects are compiled within the image.

    Due to a few restrictions when building a Docker image using Github Actions, the Dockerfile has been updated to avoid issues with USER & WORKDIR instructions.

    • adjust Dockerfile to work on Github CI & as a VS Code devcontainer
    • fix VS Code devcontainer config to set workspace & user
    • update Github CI workflow to build Docker image & compile Rust projects
    • reduce Docker image size, use bullseye-slim base image, remove unnecessary packages
    • update instructions in material
    Reviewed by justahero at 2022-05-09 11:54
  • 9. Add instructions to training book on Docker usage

    This updates the Software chapter in the Espressif training book to include information on how to use the Docker setup.

    • set fix nightly Rust version in install instructions that match the one used in examples
    • add section on Docker setup
    • update section on IDEs and VS Code extensions
    • add section on VS Code and devcontainer
    Reviewed by justahero at 2022-05-06 09:54
  • 10. Add Github CI pipeline to check code

    This PR adds a Github CI workflow to build the Docker image from the Dockerfile in folder .devcontainer. It uses the resulting Docker image to compile all Rust libraries & exercises in this repository.

    Reviewed by justahero at 2022-05-06 09:47
  • 11. Use `rev` option to set fixed commit hash

    This change sets a fixed commit revision to the riscv patch annotation in all Cargo.toml files.

    Using master as a branch option resulted in different commit hashes at different times, which occurred due to changes in the riscv crate. This crate has seen some changes in the last days / weeks that broke the current setup, therefore a working revision is set.

    All examples compiled successfully but have not been tested with the hardware itself.

    This should fix #55.

    Reviewed by justahero at 2022-04-22 08:46
High performance distributed framework for training deep learning recommendation models based on PyTorch.
High performance distributed framework for training deep learning recommendation models based on PyTorch.

PERSIA (Parallel rEcommendation tRaining System with hybrId Acceleration) is developed by AI [email protected] Technology, collaborating with ETH. It

Jun 11, 2022
A machine learning library for supervised training of parametrized models

Vikos Vikos is a library for supervised training of parameterized, regression, and classification models Design Goals Model representations, cost func

May 10, 2022
Deduplicating Training Data Makes Language Models Better

Deduplicating Training Data Makes Language Models Better This repository contains code to deduplicate language model datasets as descrbed in the paper

Jun 19, 2022
NEATeRS is a library for training a genetic neural net through reinforcement learning.

NEATeRS NEATeRS is a library for training a genetic neural net through reinforcement learning. It uses the NEAT algorithm developed by Ken Stanley whi

May 16, 2022
Embedded Rust arithmetic, 2D/3D vector, and statistics library
Embedded Rust arithmetic, 2D/3D vector, and statistics library

Embedded-friendly (i.e. no_std) Rust math library featuring fast, safe floating point approximations for common arithmetic operations, trigonometry, 2D/3D vector types, statistical analysis, and quaternions.

Jun 6, 2022
Msgpack serialization/deserialization library for Python, written in Rust using PyO3, and rust-msgpack. Reboot of orjson. msgpack.org[Python]

ormsgpack ormsgpack is a fast msgpack library for Python. It is a fork/reboot of orjson It serializes faster than msgpack-python and deserializes a bi

Jun 16, 2022
Practice repo for learning Rust. Currently going through "Rust for JavaScript Developers" course.

rust-practice ?? Practice repo for learning Rust. Directories /rust-for-js-dev Files directed towards "Rust for JavaScript Developers" course. Thank y

Dec 25, 2021
A Rust library with homemade machine learning models to classify the MNIST dataset. Built in an attempt to get familiar with advanced Rust concepts.

mnist-classifier Ideas UPDATED: Finish CLI Flags Parallelize conputationally intensive functions Class-based naive bayes README Image parsing Confusio

Sep 2, 2021
A Rust machine learning framework.

Linfa linfa (Italian) / sap (English): The vital circulating fluid of a plant. linfa aims to provide a comprehensive toolkit to build Machine Learning

Jun 18, 2022
Machine Learning library for Rust

rusty-machine This library is no longer actively maintained. The crate is currently on version 0.5.4. Read the API Documentation to learn more. And he

Jun 15, 2022
Rust library for Self Organising Maps (SOM).
Rust library for Self Organising Maps (SOM).

RusticSOM Rust library for Self Organising Maps (SOM). Using this Crate Add rusticsom as a dependency in Cargo.toml [dependencies] rusticsom = "1.1.0"

Jul 28, 2021
Rust language bindings for TensorFlow
Rust language bindings for TensorFlow

TensorFlow Rust provides idiomatic Rust language bindings for TensorFlow. Notice: This project is still under active development and not guaranteed to

Jun 23, 2022
Machine learning crate for Rust

rustlearn A machine learning package for Rust. For full usage details, see the API documentation. Introduction This crate contains reasonably effectiv

May 16, 2022
Rust bindings for the C++ api of PyTorch.

tch-rs Rust bindings for the C++ api of PyTorch. The goal of the tch crate is to provide some thin wrappers around the C++ PyTorch api (a.k.a. libtorc

Jun 19, 2022
个人的 rust 学习资料

?? 通知: 项目文档迁移到: https://github.com/higker/learn-rust learning-rust-zh 个人的 rust 学习资料 学习目录 目录 源代码地址 相关解析 第一个rust程序 https://github.com/higker/learning-ru

Nov 8, 2021
Distributed compute platform implemented in Rust, and powered by Apache Arrow.
Distributed compute platform implemented in Rust, and powered by Apache Arrow.

Ballista: Distributed Compute Platform Overview Ballista is a distributed compute platform primarily implemented in Rust, powered by Apache Arrow. It

Jun 17, 2022
Tensors and differentiable operations (like TensorFlow) in Rust

autograd Differentiable operations and tensors backed by ndarray. Motivation Machine learning is one of the field where Rust lagging behind other lang

Jun 4, 2022
Rust numeric library with R, MATLAB & Python syntax

Peroxide Rust numeric library contains linear algebra, numerical analysis, statistics and machine learning tools with R, MATLAB, Python like macros. W

Jun 20, 2022
A fast, safe and easy to use reinforcement learning framework in Rust.
A fast, safe and easy to use reinforcement learning framework in Rust.

RSRL (api) Reinforcement learning should be fast, safe and easy to use. Overview rsrl provides generic constructs for reinforcement learning (RL) expe

Jun 17, 2022