Git Product home page Git Product logo

not-yet-awesome-embedded-rust's Introduction

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

Support for no_std esp32-cam

Background

There is a large amount of accessible libraries and projects involving the esp32-cam in c++, and a few projects for rust using esp-idf-std (listed below), however there are no no_std crates with this support. A repository of information, including pin defintions, can be found (here)[https://github.com/raphaelbs/esp32-cam-ai-thinker/blob/master/docs/esp32cam-pin-notes.md].

Success Criteria

A library with bindings to the esp32-cam camera, accessible in a no_std environment.

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.

not-yet-awesome-embedded-rust's People

Contributors

adamgreig avatar bors[bot] avatar disasm avatar dlkj avatar eldruin avatar flip111 avatar jamesmunns avatar japaric avatar leseulartichaut avatar parasew avatar peterstuart avatar sycrosity avatar thejpster avatar therealprof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

not-yet-awesome-embedded-rust's Issues

Bluetooth (and BLE) support

The Bluetooth landscape for Rust, especially embedded Rust, is very patchwork and it's preventing awesome projects like rs-matter from taking off by having a clear path to support BLE advertising/discovery (which is the only way for Matter devices to "just work"). I'm interested in trying to add generic traits (sync and async) for basic BLE support to start, followed by an esp32 implementation. Would it be too bold to try to take the embedded-ble namespace for the traits?

[request] embedded internationalization (i18n)

I'm hot sure how to post request right, so posting to issue, according to template. Correct me, if i do something wrong.


No i18n (gettext), suitable for embedded use

Existing i18n crates have heavy extra dependency, ok for desktop, but not suitable for restricted embedded requirements.

Also, gettext prefer use PO-files, but yaml (like in ruby's i18n) is more human-friendly.

Success Criteria

Create a set of tool + runtime to translate texts the same way as gettext.

  • Phrase scanner - creates YAML files, to be translated by humans,
    • optionally, for import/export to web translation services
  • "Renamer" - if source phrase changed and you need to update key in all translations
  • Compiler - take YAML files and build rust code

Work in progress

  • lv_i18n - i did tool with node.js for C. This may look strange, but is has verified workflow, data structures and API features set. Now it's possible to skip top level architecture design and just implement similar thing in Rust.

Secure Bootloader

Currently not-awesome, a lack of a rust bootloader using image signing with dfu support.

Perhaps re-using mcuboot is the right thing to do.

[Request] Add BeagleBone Black support

Seems like this device would already have support but didn't see in the current awesome list. Would be nice to see examples and such like RPi and ESP32. Thanks

[request] Embedded GUI

No GUI, suitable for embedded use on small SOC-s

Currently there are no complete solutions, suitable to create modern interfaces on "small" devices (like 8-16K RAM + 64-128K Flash).

Targeting

I'd suggest to focus on "small" systems like stm32f0-stm32f4 with colour displays up to 320*200.

Reasons:

  • "Big" embedded systems, where linux available, can run restricted versions of QT and other "desktop" libs.
  • Hardware should be simple enough, to order via EasyEDA and assemble manually. I mean, primary focus on chips like TQFP64 and below, without external DRAM.
  • Displays 320*200 is almost maximal size to have 25FPS with SPI. Bigger displays usually have more powerful hardware => shift to linux-based solutions.

That's only examples, to explain range of devices, where hardware already CAN run modern GUI, but no appropriate software available. Of cause, you can find lot of exclusions, but reason of GUI request is to fill gap, not to compete with existing libs.

Specifics of hardware restrictions

  1. No memory space for full display buffer (320*240*16bpp). This is solved by multi-pass rendering, when buffer size is 1/20 of screen area.
  2. No resources (primary - RAM) for TTF (vector) fonts. Bitmap fonts used.
    • Related: there are some solutions to convert font from TTF, but those do not support good compression. Appropriate tools required.
  3. No GPU. As a result - no need to have abstraction layer for appropriate draw commands. It's enough for driver to support region copy only.

UX/look

Most of existing GUI-s try to invent own look instead of following one of existing guideline. Result is very poor. IMHO something like Material Design is "minimal possible quality requirement".

PC emulator

When you do simple device, it's not difficult to code "meat". The most time-consuming task become interface polishing. It's not convenient to do such things on bare metal. Having PC emulator of display/touch will speed up development significantly.

Success criteria

Ideally, it would be nice to have GUI, able to create Material Design interfaces on SOCs with 8-16K RAM and 64-128K flash.

  1. GUI core. To not fall into technical details - something like LittlevGL.
  2. Tool to convert TTF fonts to bitmap fonts, with subsetting and RLE-like compression.
  3. Demo with "Settings menu". A lot of small devices can be described as "Main screen + settings". Having demo with good design will help a lot to quick-start.
  4. PC emulator (driver), easy to install on major platforms.

References

This chapter replaces "Work in Progress" because referred things are not for rust. But those have a lot of reusable things, and should save a lot of time.

  • LittlevGL - example of nice GUI for C. It's not ideal due C restrictions, but worth to check instead of reinvent all from scratch.
  • lv_font_conv - WIP, see dev branches & issues. Fonts convertor + area to experiment with compressions. It's written in JavaScript for LVGL, but with keeping in mind to be reusable for Rust.
  • Settings menu screenshots - how modern settings could look.

Move CI from travis to actions

opening this mostly as a reminder / in case anyone is looking for a reasonably straightforward contribution, it'd be great to move this over from travis-ci so PRs / bors run more reliably.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.