Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.
/ esp32c3-hal Public archive

An experimental Rust HAL for the ESP32-C3 SoC

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

ducktec/esp32c3-hal

Repository files navigation

⚠️ Abandoned!

This implementation was abandoned in favour of the implementation in esp-rs/esp-hal. This (already more mature) implementation supports multiple ESP32 variants, the ESP32-C3 variant being one of them. It is strongly recommended to use esp-hal instead!

ESP32-C3 HAL

Build Status

This is an experimental Rust HAL crate for the ESP32-C3 SoC.

⚠️ Please note the emphasis on experimental! Very little works (yet) and what works is not comprehsively tested and will almost certainly contain bugs. Please don't use for real projects at this point in time. The API can and will change.

Status

The following table contains a list of ESP32-C3 functional components that are planned to be supported at this point and their support status within this hal crate:

Functional Component Prototype/Partial Support
TIMG (Timer + WDT) ✔️
UART ✔️
SPI
I2C ✔️
GPIO ✔️
System Timer
(Low-Power) Management
LED PWM
USB Serial/JTAG Controller
Remote Control Peripheral

Getting Started

The ESP32-C3 is based on the RISCV architecture. To build code for this architecture, download the rust toolchain for this architecture:

rustup target add riscv32imc-unknown-none-elf

Next, install the espflash tool that will take care of building and flashing applications and examples:

cargo install --git https://github.com/esp-rs/espflash cargo-espflash

The installation from the git repository is required as the --package support of the tool is merged but not yet released.

Once --package support is part of the release, it will be enough to run

cargo install cargo-espflash

Use the following command to build and flash an example application to a connected ESP32-C3 board:

cargo espflash --package hello-world-demo /dev/tty.usbserial-10

Update the port (last argument) depending on your host system.

Examples

The HAL cargo workspace currently comes with the following example packages (to be built/flashed using the --package option)

  • blinky-demo: Toggle a LED that is connected to GPIO2 every second.
  • empty-demo: Start and enter an endless loop. This is to demonstrate that all relevant watchdogs can be disabled and the SoC does not continuously reset.
  • hello-world-demo: Write "Hello World" to UART0 (with the default pins) every second.
  • i2c-display-demo: Display text on an monochrome OLED with a SSD1306 driver IC (via I2C).
  • uart-loopback-demo: Read from UART0 and write back to UART0.

MSRV

This project follows the rust embedded devices working group MSRV policy.

License

Licensed under either of

at your option.

This project makes use of original and modified code from the esp32-hal project, which is published under the same two licensing options and is used under the MIT license in this context. This code use is reflected in the included license file.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Resources

About

An experimental Rust HAL for the ESP32-C3 SoC

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Languages