• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
  • License
    Creative Commons ...
  • Created over 5 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of items that are not yet awesome in Embedded Rust

Not Yet Awesome Embedded Rust

Awesome

This is a collection of things that are not yet awesome in Embedded Rust. We need your help to capture all of the things that are not yet awesome, and to start making them awesome!

This project is developed and maintained by the Resources team.

Are you interested in:

  • Adding something to this list that is not yet awesome?
  • Tell people you are working on making something on this list awesome?
  • Tell people you have made something on this list awesome already?

Check out our Contributing Guide for how to get started.

And don't forget to check our Awesome Embedded Rust list! The thing you are looking for may already exist!

Table of Contents

The List

Sharing Data With Interrupts

Background

Currently, it is not convenient to share non-atomic or non-Sync data with an interrupt using safe Rust. Because interrupt handlers are functions that take no arguments, all data consumed by interrupts must either be global or module scoped Atomics (e.g. AtomicBool), local static variables, or global or module scoped static variables.

Global variables are not great in Rust, because:

  • All mutable access (of non-Sync/Atomic data) must be unsafe
  • Not all data can be initialized in a const context, so it's often necessary to use an Option<T> to delay the initialization to runtime
  • Global variables aren't typically idiomatic Rust.

Frameworks like cortex-m-rtic achieve this in a zero cost fashion by using a Domain Specific Language to automatically provide safe access to shared resources between tasks and interrupts, however these tools can not be used by applications not using RTIC, or by libraries such as HAL or BSP crates.

Useful Links

  • wg#294 - An Embedded-WG issue discussing this topic
  • bare-metal#15 - One proposed solution hiding the un-idiomatic syntax

Success Criteria

Ideally, we would be able to support all of the following use cases:

  1. Sharing a variable between the main thread and only one interrupt handler
  2. Sharing a variable between the main thread and one or more interrupt handlers
  3. Moving a variable from the main thread to one interrupt handler

We should be able to serve the three use cases listed above, while:

  • Using only safe Rust (at least as a user of the library)
  • Add only minimal overhead, if not "zero cost"

Serialization/Deserialization in no_std

Background

For embedded systems that send or receive data to other devices, or who read/write data to a medium such as an SD card or other Flash memory, it is useful to have automatic serialization and deserialization support to turn structured data into a binary format.

While tools like serde are widely used in Rust (and already support no_std), few of the the backends (like serde_json) are supported in a no_std environment.

Success Criteria

We should be able to serialize and deserialize data in an automatic way, either using a frontend like serde, or with a simple and convenient serialize and deserialize method. To use these, we should not need heap allocations, and it should be possible to detect when serialization and deserialization have failed.

Additionally, all common datatypes used in embedded Rust should be supported, as well as a (preferrably automatic) way to add support for custom data types. Common data types include:

  • Fixed point signed/unsigned numbers like u8..u64 or i8..i64
  • Floating point numbers like f32..f64
  • Booleans
  • Variable length types, like [u8] and &str
  • Tuples
  • Enumerated types

We should also have support for different ways of serializing data, primarily:

  • Self-describing schemas, such as JSON or CBOR
  • Non-self-describing schemas, such as binary packed data or ProtoBufs

Work in progress

  • serde already has support for no_std environments, when using a feature flag
  • ssmarshal has support for basic types, but does not support enums with more than 255 variants, or variable sized types like slices. This covers only the non-self-describing use case.
  • ujson supports JSON serialization and deserialization for no_std environments, but is experimental (and not on crates.io), and is unlikely to be stabilized as-is
    • It is unknown if ujson welcomes contributions
  • There are a number of forks of std-only serde backends, though they do not seem to have official support from the upstream libraries. These forks include:

Support crates for USB Host and USB Device Support

Background

The USB standard has a fair bit of commonality between USB Devices (like Mice, Printers, and Webcams) and USB Hosts (like Laptops and Raspberry Pis), but each specific microcontroller has a slightly different implementation of the USB Controller at the bottom of the stack. It would make bringing up a USB stack on a new chip much easier if there was a #[no_std] crate which defined some common traits, enumerations and structures at the bottom, and then provided support for various device classes above that.

Success Criteria

I'd like to be able to implement USB Host and USB Device support on the Texas Instruments Tiva-C line and the STM32F4 line by only implementing a thin shim around each device's USB OTG Controller registers. The USB Host should be able to handle a USB Keyboard and the USB Device should enumerate as a Communications Class Device (two of the most common use-cases).

Work in progress

  • The tm4c123x-hal crate has svd2rust definitions for the USB controller's registers.
  • There is a branch looking at adding USB Host support.
  • usb-device crate and corresponding device-specific implementations for STM32:
  • usbd-serial crate implements USB CDC for serial communication.
  • usbd-hid crate implements USB HID, providing a way to implement keyboard and mouse drivers on top of it.
  • usbd-human-interface-device crate implements various keyboards, mice and consumer control devices on top of usb-device
  • Keyberon project uses usb-device to implement its own HID support for USB keyboard firmware. This project usually serves as a starting point for those willing to implement their own USB keyboard firmware.

Display and GUI support

Background

So far there seem to be no libraries to do anything with displays or gui's. However in C some libraries have already been written. Rust could interface with these libraries if bindings were made.

Useful links

Success Criteria

Bindings to C libraries or a Rust library that is meant for Displays and/or GUIs.

Work in progress

Not Yet Awesome Item Template

Here's an example for something that is not yet awesome:

It's Hard to Foo without a Bar

Background

IETF RFC -1 states that you should be able to Foo with either a Bar, Bib, Bim, or Bap. However in all of these rust crates, you're required to have a Bar!

Success Criteria

I'd like to be able to Foo using only a Bib, Bim, or Bap.

Work in progress

License

The Not Yet Awesome Embedded Rust list (this project) is distributed under the terms of the Creative Commons CC-BY-SA v4.0 license.

Copies of the license used by this project may also be found here: CC-BY-SA v4.0 Hosted.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you 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, the maintainers of this crate, the Resources team, promises to intervene to uphold that code of conduct.

More Repositories

1

rust-raspberrypi-OS-tutorials

📚 Learn to write an embedded OS in Rust 🦀
Rust
13,436
star
2

awesome-embedded-rust

Curated list of resources for Embedded and Low-level development in the Rust programming language
6,173
star
3

embedded-hal

A Hardware Abstraction Layer (HAL) for embedded systems
Rust
1,977
star
4

wg

Coordination repository of the embedded devices Working Group
1,892
star
5

heapless

Heapless, `static` friendly data structures
Rust
1,492
star
6

discovery

Discover the world of microcontrollers through Rust!
Rust
1,458
star
7

book

Documentation on how to use the Rust Programming Language to develop firmware for bare metal (microcontroller) devices
1,083
star
8

riscv

Low level access to RISC-V processors
Rust
820
star
9

cortex-m

Low level access to Cortex-M processors
Rust
801
star
10

cortex-m-quickstart

Template to develop bare metal applications for Cortex-M microcontrollers
Rust
786
star
11

svd2rust

Generate Rust register maps (`struct`s) from SVD files
Rust
685
star
12

cargo-binutils

Cargo subcommands to invoke the LLVM tools shipped with the Rust toolchain
Rust
488
star
13

rust-sysfs-gpio

A Rust Interface to the Linux sysfs GPIO interface (https://www.kernel.org/doc/Documentation/gpio/sysfs.txt)
Rust
383
star
14

cortex-m-rt

Minimal startup / runtime for Cortex-M microcontrollers
Rust
357
star
15

riscv-rt

Minimal runtime / startup for RISC-V CPU's.
Rust
299
star
16

embedded-alloc

A heap allocator for embedded systems
Rust
295
star
17

linux-embedded-hal

Implementation of the `embedded-hal` traits for Linux devices
Rust
233
star
18

gpio-cdev

Rust interface to the Linux GPIO Character Device API (/dev/gpiochip...)
Rust
210
star
19

embedonomicon

How to bootstrap support for a no_std target
Rust
206
star
20

rust-i2cdev

Rust library for interfacing with i2c devices under Linux
Rust
205
star
21

rust-spidev

Rust library providing access to spidev devices under Linux
Rust
121
star
22

cortex-a

Low level access to Cortex-A processors
Rust
120
star
23

bare-metal

Abstractions common to microcontrollers
Rust
114
star
24

meta-rust-bin

Yocto layer for installing Rust toolchain from pre-built binaries
BitBake
102
star
25

critical-section

Pluggable critical section
Rust
97
star
26

gpio-utils

Userspace Utilities for managing GPIOs in Linux
Rust
94
star
27

showcase

Awesome embedded projects by the Rust community!
CSS
91
star
28

nb

Minimal and reusable non-blocking I/O layer
Rust
87
star
29

rust-embedded.github.io

A collection of books and other documents about embedded Rust
84
star
30

blog

The Rust Embedded WG Blog
SCSS
71
star
31

svd

A CMSIS-SVD file parser
Rust
70
star
32

r0

Initialization code ("crt0") written in Rust
Rust
69
star
33

aarch64-cpu

Low level access to processors using the AArch64 execution state.
Rust
65
star
34

svdtools

Python package to handle vendor-supplied, often buggy SVD files.
Rust
60
star
35

debugonomicon

Shell
60
star
36

rust-sysfs-pwm

Linux PWM Access via Sysfs in Rust
Rust
47
star
37

register-rs

Unified interface for type-safe MMIO and CPU register access in Rust
Rust
46
star
38

fixedvec-rs

Heapless vector implementation for Rust
Rust
45
star
39

qemu-exit

Exit QEMU with user-defined code
Rust
40
star
40

cortex-m-semihosting

Semihosting for ARM Cortex-M processors
Rust
40
star
41

msp430

Low level access to MSP430 microcontrollers
Rust
36
star
42

msp430-quickstart

Template to develop bare metal applications for MSP430 microcontrollers
Rust
36
star
43

embedded-dma

Rust
35
star
44

volatile-register

Volatile access to memory mapped hardware registers
Rust
34
star
45

itm

Tool to parse and dump ITM packets
Rust
28
star
46

mutex-trait

Low level API definition of a Mutex
Rust
25
star
47

msp430-rt

Minimal startup / runtime for MSP430 microcontrollers
Rust
15
star
48

patterns

A book capturing different approaches or patterns for solving problems in Embedded Rust
15
star
49

docker-rust-cross

Docker images for testing rust code on many versions and architecures (DEPRECATED)
Shell
13
star
50

panic-semihosting

Report panic messages to the host stderr using semihosting
Rust
12
star
51

cortex-r

Low level access to Cortex-R processors
Shell
11
star
52

arm-dcc

Debug Communication Channel (DCC) API
Rust
9
star
53

rust-embedded-www

The Rust embedded website: http://www.rust-embedded.org
HTML
7
star
54

panic-itm

Log panic messages using the ITM (Instrumentation Trace Macrocell)
Rust
6
star
55

rust-embedded-provisioning

Terraform provisioning for Rust Embedded infrastructure
HCL
2
star
56

template

Rust
1
star
57

discovery-mb2

Rust Discovery Book for BBC micro::bit v2
Rust
1
star