Demo of tokio running on esp32 using esp-idf

Overview

Tokio running on esp32!

This repo demonstrates a working hello world utilizing upstreamed tokio support for esp32. The tokio executor and I/O reactor are both working fully with no known gotchas. Third party libraries utilizing tokio can also be used freely, such as coap-server-rs.

Quickstart

Recommended that you use an ESP32C3 as upstream Rust support is currently better, though if you do choose any other in the ESP32 family be sure to check out the guides in the Rust on ESP Book.

git clone https://github.com/jasta/esp32-tokio-demo
cd esp32-tokio-demo
vim src/main.rs # <-- edit the WIFI_SSID/WIFI_PASS variables!
cargo run

After the board connects to Wi-Fi, you can test that things are working with:

$ echo hello | nc -N -v espressif 12345
hello

You may optionally use cargo run --target xtensa-esp32-espidf or any of the other supported targets which should work provided that you followed the esp-rs installation instructions above.

Future work

esp32 support still requires the experimental mio_unsupported_force_poll_poll feature. To mature this support, we'll need to address a few more uptsream issues:

Alternatives

To use async on esp32, you can also use a number of other executors and reactor combos, including smol and async-task. Upstream esp-rs support appears to be leaning toward edge-executor which can be utilized to support ISR-based wakeups and other useful embedded features that tokio lacks. See ivmarkov/rust-esp32-std-demo#153 (comment) for discussion of some of the advantages with this approach.

The tokio support, however, is still useful to broadly make libraries making use of tokio compatible with esp32, even ones that use the tokio I/O reactor. You can also have multiple executors living side-by-side in a process by simply isolating them to separate pthreads. This can actually be a useful strategy intentionally to support high and lower priority task queues simultaneously active to achieve realtime performance characteristics.

You might also like...
BlackBird is a framework for Rust Tokio
BlackBird is a framework for Rust Tokio

BlackBird Blackbird is framework like OTP for Erlang. Blackbird is not a Actor Framewrok, it's Behavior for around Tokio task This project currently p

WasmEdge Hyper Demo.

WasmEdge Hyper Demo In this project, we demonstrate how to use hyper and tokio to build async http client in WebAssembly and execute it using WasmEdge

secmem-proc is a crate designed to harden a process against low-privileged attackers running on the same system trying to obtain secret memory contents of the current process.

secmem-proc is a crate designed to harden a process against low-privileged attackers running on the same system trying to obtain secret memory contents of the current process. More specifically, the crate disables core dumps and tries to disable tracing on unix-like OSes.

A thread pool for running multiple tasks on a configurable group of threads.
A thread pool for running multiple tasks on a configurable group of threads.

Threadfin A thread pool for running multiple tasks on a configurable group of threads. Extra features: Dynamic pool size based on load Support for asy

dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle!

dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle (such as rewriting/refactroing your DM code).

A Simple, But amazing telegram bot, Made using the Rust language!

Telegram bot in Rust A fun Telegram bot made using Rust language.

Rust bindings to Cloudflare Worker KV Stores using wasm-bindgen and js-sys.

worker-kv Rust bindings to Cloudflare Worker KV Stores using wasm-bindgen and js-sys

Showing how to deploy a Terra smart contract using Chainlink Data Feeds

Chainlink Terra Developing Requirements This demo requires the following components: Rust: rustup with cargo 1.44.1+. rustc and cargo 1.44.1+. Install

Private swaps for Secret Network using a private entropy pool & differential privacy.

WIP SecretSwap: Anon Edition Private swaps for Secret Network! Uses private entropy pool for differential privacy when reporting pools sizes. Swap amo

Owner
Josh Guilfoyle
Mobile and embedded engineer; Rust, Java/Kotlin. Former Facebook Mobile Eng.
Josh Guilfoyle
Esp-backtrace - backtrace for ESP32 bare-metal

esp-backtrace - backtrace for ESP32 bare-metal supports ESP32, ESP32C3, ESP32S2, ESP32S3 optional features: panic-handler, exception-handler (will ena

Björn Quentin 10 Dec 14, 2022
An example project demonstrating integration with Rust for the ESP32-S2 and ESP32-C3 microcontrollers.

Rust ESP32 Example An example project demonstrating integration with Rust for the ESP32-S2 and ESP32-C3 microcontrollers.

Espressif Systems 303 Jan 4, 2023
Embedded demo based on esp32-c3

wot-esp-demo Demo Hygro-Thermometer based on the esp-rust-board. http version based on std-training Deploy Rust prerequisites Install espflash, ldprox

null 3 Dec 1, 2023
Backtrace for ESP32 bare-metal

esp-backtrace - backtrace for ESP32 bare-metal supports ESP32, ESP32C3, ESP32S2, ESP32S3 optional features: panic-handler, exception-handler (will ena

esp-rs 10 Dec 14, 2022
ESP32-C3 interfacing to a PS/2 Keyboard (bare-metal Rust)

ESP32-C3 interfacing to a PS/2 Keyboard (bare-metal Rust) Very simplified example of connecting a PS/2 keyboard to ESP32-C3 You need to build it with

Björn Quentin 3 Dec 5, 2022
Rust implementation of ESP32 NVS partition generator.

Simple ESP32 NVS writer library for Rust Overview A library for Rust to generate NVS partitions for ESP32. How to use See examples/write_simple.rs. Ma

Kenta IDA 4 Dec 29, 2022
Using engines running outside of the browser

External engine (ALPHA) Using engines running outside of the browser

Lichess 43 Dec 31, 2022
Demo for the swash font library

Demo for the swash crate See the swash repo or crate for the actual project. This is a chunk of very rough code.

Chad Brokaw 28 Nov 29, 2022
Basic Rust I2C demo on the TI Launchpad

msp430-i2c-oled-example An example project to talk to an SSD1306 OLED (Adafruit PiOLED) with an MSP430G2553 Launchpad via I2C.

Edward Shin 3 Jul 9, 2021
WIP demo project for pure rust playing nicely with MCUBoot/Infinitime OTA

pinetime-rust-mcuboot WIP demo project for pure rust playing nicely with MCUBoot/Infinitime OTA Firmware Behavior This is an example project so I just

David Boles 2 Jan 26, 2022