rust-embedded / wg

Coordination repository of the embedded devices Working Group
1.93k stars 98 forks source link

Survey: Crates you use for embedded development #12

Closed japaric closed 5 years ago

japaric commented 8 years ago

Ultimately, we'd like to have a list of curated crates that are nicely categorized in a presentable format (a website with search function, etc.). But, for starters, let's list here all the crates we use for embedded development.

Just add a comment here with the list of crates that you use The crate can be a library or a tool (binary). Try to stick to the following format:

[`$crate_name`]($crates_io_url_or_github_repo_url) - $description
Tags: `$tag1` `$tag2` ...

I'll be collecting them here in the top comment. Try to not to list a crate that has already been mentioned unless you'd like to propose more tags for it.

The tags at this point are free form and can be anything you think will be useful to someone that has to decide whether they can use that crate or not (is it for my target architecture/device? Is it no_std? etc.).

This is also a good opportunity to figure out what are common tags that we could use for #11.


Here's the list so far:

bitflags - A macro for C-like bit flags, pretty useful for modeling hardware registers. Tags: no_std macro bitflags

lazy_static - A macro that allows to initialize a static using arbitrary code. Tags: no_std macro static lazy

~~rustc_builtins - Current state of the Rust port of compiler-rt. Provides various intrinsics that are required by the compiler. Tags: no_std compiler-rt instrinsics~~ DEPRECATED in favor of the official compiler_builtins crate (see below)

xargo - A drop-in replacement for Cargo that compiles the sysroot for custom targets on the fly. Tags: cargo sysroot core libcore liballoc libcollections

intrusive-collections - Intrusive (non-allocating) singly/doubly linked lists and red-black trees. Tags: no_std intrusive rbtree collections

log - Supports logging in no_std environments, as long as you define your own logger type. Tags: no_std log

cortex-m - Low level access to Cortex-M processors Tags: arm cortex-m hardware no_std register peripheral

meta-rust - Yocto layer providing from-source version of the Rust compiler and Cargo Tags: build yocto

meta-rust-bin - Yocto layer that uses pre-built Rust and Cargo from rust-lang.org Tags: build yocto

fixedvec - Vec-like interface to a pre-sized buffer of memory. Allows using something like Vec when doing heapless programming. Tags: no_std

sysfs-gpio - A Rust Interface to the Linux sysfs GPIO interface Tags: hardware linux gpio

i2cdev - Rust library for interfacing with i2c devices under Linux Tags: hardware linux i2c

spidev - Rust library providing access to spidev devices under Linux Tags: hardware linux spi

log_buffer - Rust library for logging into a circular string buffer Tags: no_std

slog - Supports logging in no_std environments, as long as you implement your own Drain Tags: log no_std

teensy3 - Rust interface layer for the Teensy 3.1/3.2 microcontroller Tags: arm cortex-m hardware no_std

cpuio. Bare metal (no_std) inb, outb, inw, outw, inl, outw instructions, with a Rust-friendly API. Tags: no_std x86

alloc_buddy_simple. Simple, drop-in replacement allocator for Rust running on bare metal. This intended for small, known-size heaps that contain simple collections, such as lists of USB devices discovered on the bus. Tags: allocator no_std

pic8259_simple. Kernel-space interface to the 8259 and 8259A interrupt controllers. Tags: no_std interrupts

volatile_register - for memory mapped registers Tags: kernel_mode no_std registers

spin - a spinlock Mutex Tags: no_std

linked_list_allocator - basic memory allocation Tags: bare_metal no_std allocator

rlibc - pure Rust implementation of some required C library functions (like memset) Tags: no_std intrinsics NOTE the compiler_builtins crate also provides memset (see below)

compiler_builtins - Instrinsics LLVM needs Tags: no_std intrinsics

x86. Library to program x86 (amd64) hardware. Contains x86 specific data structure descriptions, data-tables, as well as convenience function to call assembly instructions typically not exposed in higher level languages. Tags: x86 no_std

prusst - Rust interface to the PRU subsystem on AM335x processors (BeagleBone & other SBC) Tags: hardware linux pru beaglebone

m - A C free / pure Rust mathematical library ("libm") for no_std code Tags: no_std math float

lm4f120 - A set of drivers for the TI LM4F120. Tags: bare-metal drivers

fel-cli - CLI tools for dealing with Allwinner devices in FEL mode, in pure Rust. Tags: arm sunxi allwiner fel

alloc-cortex-m - A heap allocator for Cortex-M processors Tags: arm cortex-m allocator

cortex-m-semihosting - Semihosting for ARM Cortex-M processors Tags: cortex-m arm semihosting

~~cortex-m-template - A Cargo project template for ARM Cortex-M bare metal development Tags: arm cortex-m Cargo template~~ DEPRECATED in favor of cortex-m-quickstart (see below)

byteorder - Library for reading/writing numbers in big-endian and little-endian. Tags: endian big-endian little-endian byte binary

cortex-m-quickstart - A template for building applications for ARM Cortex-M microcontrollers Tags: arm cortex-m template

cortex-m-rtfm - Real Time For the Masses (RTFM), a framework for building concurrent applications, for ARM Cortex-M microcontrollers Tags: arm cortex-m concurrency

heapless - static friendly data structures that don't require dynamic memory allocation Tags: no-heap static

build-const - a helper library for computing constants at compile time in build.rs or a script. Also includes no_std macros for importing them Tags: embedded no_std build const static

defrag - safe defragmenting memory manager for microcontrollers Tags: no_std embedded memory manager microcontroller

bridge-rpc - (in development) a protocol designed to allow a system of different devices, to communicate with each other and issue commands through (optionally) guaranteed unique remote procedural calls. It allows inter-network communication through the concept of "bridges". Both nodes and bridges can be highly resource constrained devices (such as microcontrollers). Intended supported networks include tcp/ip, UART, CAN and ZigBee.

aligned - Statically allocated arrays with guaranteed memory alignments Categories: embedded memory-management no-std Tags: alignment aligned array

cty - Type aliases to C types like c_int for use with bindgen Categories: embedded ffi no-std Tags: bindgen ffi c types

scroll A suite of powerful, extensible, generic, endian-aware Read/Write traits and contextual conversion traits (Byte serializing and deserializing) Tags: pread bytes endian pwrite

ssmarshal - stupid simple (no_std) serde serialzation library Tags: no_std, (TODO)

smoltcp - A TCP/IP stack designed for bare-metal, real-time systems without a heap. Tags: tcp network udp ethernet ip

byte - A low-level, zero-copy, panic-free, binary serializer and deserializer. (parser and encoder) Tags: no_std byte encode binary parser

clerk - A hardware agnostic HD44780 LCD controlling library. Tags: embedded driver

stlog A lightweight logging framework for resource constrained devices Categories: embedded no-std development-tools::debugging Keywords: log elf symtab

lcd - Yet another HD44780/LCD display library (third, at least)! Batteries are not included: all binding to the hardware/GPIO initialization is the responsibility of the user (including the sleep function). Tags: no_std embedded

genio - io::{Read, Write} traits for no_std. It has wrappers for std::io::{Read, Write} to allow use in crates that support std and no_std. Its Read, Write traits have associated type parameters to support custom error types.

framed - Rust crate to send and receive data over lossy streams of bytes.

cstr_core - #[no_std] port of std::ffi::CStr and std::ffi::CString. CString support is optional, and uses the alloc crate instead of std.

hashmap_core - #[no_std] port of std::collections::HashMap and std::collections::HashSet. This crate uses alloc instead of std and uses FNV as the default hash function since SipHash requires a source of random numbers.

whitequark commented 6 years ago

@Amanieu I know. Can't the libstd facade provide it, though?

DoumanAsh commented 5 years ago

Just wanted to mention my logging crate, I've been working in past.

cortex-m-log - It provides generics over possible outputs (for now it is only semihosting, itm and dummy), I didn't have much of feedback so far and I haven't been working with embedded stuff for quite some time, but I appreciate increased visibility since I'd like to start working on embedded again. It also contains simple integration with log crate and allows you to implement own writers/printers to be used with log integration. It also allows to configure interrupt mode for printers

Tags: no_std log

therealprof commented 5 years ago

@DoumanAsh Interesting. Have to check it out, I've been using the log crate previously to log output to a UART and wrote an adapter to use that for panics, too. It's a bit foot-in-mouth to use though...

DoumanAsh commented 5 years ago

@therealprof Here is example in my playground with log https://github.com/DoumanAsh/2B/commit/35d6bc5dc4bee4322e411af12759ddbad54894b6

If you want to write custom destination for logs, you need to implement Printer then it will just work

Specifically you only need to provide how to retrieve &mut io::Write for printer. Example: https://github.com/DoumanAsh/cortex-m-log/blob/master/src/printer/semihosting.rs#L64-L72

eldruin commented 5 years ago

embedded-hal-mock - A collection of mocked devices that implement the embedded-hal traits. Tags: testing hal

jamesmunns commented 5 years ago

I believe that this issue has been superseded by the github.com/rust-embedded/awesome-embedded-rust repo. I would propose that we close this issue.

Marking this for a cleanup sweep. If we would like this to stay open, please provide an update to what this issue should be focused on.

jamesmunns commented 5 years ago

I am closing this issue, please feel free to open another issue if you would like this discussed further.