Simple, async embedded Rust

Related tags

Database cntrlr
Overview

Cntrlr - Simple, asynchronous embedded

Crates.io Crates.io Docs.rs

Cntrlr is an all-in-one embedded platform for writing simple asynchronous applications on top of common hobbyist development boards.

#![no_std]
#![no_main]

use cntrlr::prelude::*;
use core::future::pending;

#[entry]
async fn main() -> ! {
    serial_1().enable(9600).unwrap();
    writeln!(serial_1(), \"Hello, World\").await.unwrap();

    // Hang forever once we've sent our message
    pending().await
}

Project Goals

The primary goal of Cntrlr is to provide a prototyping environment for hobbyists. This generally means that functionality should be simple and automatic, but provide escape hatches to directly access hardware for more complex uses.

A secondary goal is to explore the API space afforded by Rust's type system. This also ties into the first goal, since high-level APIs must be designed in a way that allows for low-level access to the hardware by user applications.

It is explicitly a non-goal to move away from nightly Rust. Cntrlr's goals mean it needs the flexibility to bring in new nightly features when it makes sense for the API.

Getting Started

Cntrlr currently requires a recent nightly Rust compiler. The best way to install nightly Rust is via rustup

To simplify building and flashing your application, cargo-cntrlr is recommended.

cargo +nightly install cargo-cntrlr
cargo +nightly cntrlr new myapp
cd myapp
cargo +nightly cntrlr flash --board=<board>

For the list of supported boards, run cargo cntrlr flash --board=help

The nighty requirement

Cntrlr uses a number of rust nightly features. Some of these are required for the functionality the crate provides, while others are used to create a more ergonomic API.

Supported Boards

  • PJRC Teensy 3.x family, based on NXP/Freescale Kinetis microcontrollers
    • Teensy 3.0
    • Teensy 3.1
    • Teensy 3.2
    • Teensy 3.5
    • Teensy 3.6
    • Possibly Teensy LC. The bringup code looks good compared to the Teensyduino core, but I don't own an LC to test with at the moment. It may not work.
  • Sparkfun Red V, based on the SiFive Freedom E310 microcontroller
    • The SiFive HiFive1 Rev B (which the Red V is based on) should also work, but is untested.
    • The original HiFive1 will mostly likely not work without being added as a dedicated board.

Supported Functionality

  • UART-based serial ports
  • Simple digital GPIOs

Future Work

Cntrlr will continue to be updated to add additional board support, as well as expanding functionality for existing boards.

Additional Board Support

Currently, support is planned for the following boards

  • Teensy 4.0/4.1

Note that support for AVR-based boards is currently blocked on a number of Rust compiler issues.

Additional Feature Support

  • SPI and I2C serial
  • Analog read & write
  • PWM
  • SD Cards
  • USB
Comments
  • Gate HW struct visibility to building for that hardware

    Gate HW struct visibility to building for that hardware

    Right now, it's possible to get instances of periphreal access structs for a different MCU than an application was built for. This is a soundness hole, since the memory region the struct points to may be the same as some other memory that Rust is using.

    bug soundness 
    opened by branan 0
  • Support alternate pins for peripherals

    Support alternate pins for peripherals

    On many boards (and definitely on the Teensies), some peripherals have multiple pins they can be routed to.

    Roughly, I think this looks like the following:

    • In each board file, instead of using type FooPin =, instead create an enum FooPin..., with variants for each supported pin.
    • Unsafe impl the appropriate peripheral pin marker trait for that enum.
    • In peripheral init code, choose the pin based on which options are present.
    enhancement 
    opened by branan 0
  • It's not possible to init the heap from a custom reset vector

    It's not possible to init the heap from a custom reset vector

    Since the allocator and runtime modules are both private, there is no access to a function which can set the initial brk value from a user reset vector.

    bug 
    opened by branan 0
  • Add CI

    Add CI

    Need to add basic CI to enable PR review. It should do more or less this:

    rustup install nightly
    cargo +nightly install --path cntrlr-build
    for BOARD in $(cago +nightly cntrlr build --board=help); do
        cargo +nightly cntrlr build --examples --release --board=$BOARD
    done
    
    enhancement 
    opened by branan 1
  • New interrupt API

    New interrupt API

    The current hard-coded interrupt tables have two big deficiencies:

    1. The ISRs are always referenced, which means they and any data structures they reference (such as WakerSets) are always included in the binary. It would be nice to not include ISRs we're not using
    2. There's no way for a user to override an ISR.

    Both of these should be solvable by storing the interrupt table in RAM and having a simple API to specify ISR functions.

    enhancement 
    opened by branan 0
  • Is the GPIO API actually good?

    Is the GPIO API actually good?

    Right now the GPIO/digital pin API is taken pretty much straight from Arduino. It suffices, and it optimizes as well as can be expected. The big issue is that every call needs to lock and then release the pin. this prevents the pin API from optimizing down to direct memory writes.

    One option would be to have pin_XX() functions, just like there is for Serial ports (or perhaps pin<XX>()). These could return a struct which owns the pin for its entire lifetime, thus avoiding the need to re-lock every use.

    Maybe there's space for both types of API? Or something else?

    enhancement 
    opened by branan 1
Owner
Branan Riley
Branan Riley
📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS

Fullstack Movie Streaming Platform ?? Netflix in RUST/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Spark, Kafka, Redis,

null 34 Apr 17, 2023
A simple embedded key-value store written in rust as a learning project

A simple embedded key-value store written in rust as a learning project

Blobcode 1 Feb 20, 2022
Using embedded database modeled off SQLite - in Rust

Rust-SQLite (SQLRite) Rust-SQLite, aka SQLRite , is a simple embedded database modeled off SQLite, but developed with Rust. The goal is get a better u

Hand of Midas 3 May 19, 2023
A tiny embedded database built in Rust.

TinyBase TinyBase is an in-memory database built with Rust, based on the sled embedded key-value store. It supports indexing and constraints, allowing

Josh Rudnik 8 May 27, 2023
RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

Qovery 145 Nov 23, 2022
Embedded graph database

CQLite An embedded graph database implemented in Rust. This is currently a pre-release. It has not been extensively tested with 'real-world work-loads

Tilman Roeder 81 Dec 27, 2022
Embedded graph database

CQLite An embedded graph database implemented in Rust. This is currently a pre-release. It has not been extensively tested with 'real-world work-loads

Tilman Roeder 82 Dec 31, 2022
Scalable and encrypted embedded database with 3-tier caching

Infinitree is a versioned, embedded database that uses uniform, encrypted blobs to store data.

Symmetree Research Labs 116 Dec 27, 2022
Sled - the champagne of beta embedded databases

key value buy a coffee for us to convert into databases documentation chat about databases with us sled - it's all downhill from here!!! An embedded d

Tyler Neely 6.6k Jan 8, 2023
Embedded Distributed Encrypted Database (Research).

EDED Embedded Distributed Encrypted Database. Research projects to support ESSE. WIP Distributed design features Adapt to personal distributed usecase

Sun 2 Jan 6, 2022
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.

SQLx ?? The Rust SQL Toolkit Install | Usage | Docs Built with ❤️ by The LaunchBadge team SQLx is an async, pure Rust† SQL crate featuring compile-tim

launchbadge 7.6k Dec 31, 2022
TDS 7.2+ (mssql / Microsoft SQL Server) async driver for rust

Tiberius A native Microsoft SQL Server (TDS) client for Rust. Supported SQL Server versions Version Support level Notes 2019 Tested on CI 2017 Tested

Prisma 189 Dec 25, 2022
Rust async runtime based on io-uring.

Monoio A thread-per-core Rust runtime with io_uring. 中文说明 Design Goal As a runtime based on io_uring, Monoio is designed to be the most efficient and

Bytedance Inc. 2.4k Jan 6, 2023
🐚 An async & dynamic ORM for Rust

SeaORM ?? An async & dynamic ORM for Rust SeaORM SeaORM is a relational ORM to help you build web services in Rust with the familiarity of dynamic lan

SeaQL 3.5k Jan 6, 2023
Quick Pool: High Performance Rust Async Resource Pool

Quick Pool High Performance Rust Async Resource Pool Usage DBCP Database Backend Adapter Version PostgreSQL tokio-postgres qp-postgres Example use asy

Seungjae Park 13 Aug 23, 2022
Dataloader-rs - Rust implementation of Facebook's DataLoader using async-await.

Dataloader Rust implementation of Facebook's DataLoader using async-await. Documentation Features Batching load requests with caching Batching load re

cksac 229 Nov 27, 2022
High-level async Cassandra client written in 100% Rust.

CDRS tokio CDRS is production-ready Apache Cassandra driver written in pure Rust. Focuses on providing high level of configurability to suit most use

Kamil Rojewski 73 Dec 26, 2022
Automatically deleted async I/O temporary files in Rust

async-tempfile Provides the TempFile struct, an asynchronous wrapper based on tokio::fs for temporary files that will be automatically deleted when th

Markus Mayer 3 Jan 4, 2023
Go like sync.WaitGroup implementation in Rust. (sync/async)

WAG Go like sync.WaitGroup implementation in Rust. (sync/async) | Examples | Docs | Latest Note | wag = "0.3.0" How to use, use wag::WaitGroup; let w

Doha Lee 2 Dec 15, 2022