no_std Hardware Abstraction Layers for ESP32 microcontrollers
Go to file
Jesse Braham 6a663f8b1a
Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196)
* Remove the chip-specific HAL packages

* Update some doc comments which were missed, fix build script for ESP32/S2

* Refactor/update `esp-hal-procmacros`

* Create the `examples` package, add back all of the previously existing examples

* Use `xtask` automation package for checking examples and documentation in CI

* Combine the `rt-riscv` and `rt-xtensa` features into a single `rt` feature

* Bump MSRV to 1.76.0 (shocking!)

* Re-document the features for the HAL

* No need to re-export the `riscv` package like this

* Make clippy happy, improve CI clippy checks

* Update `CHANGELOG.md`

* riscv: zero bss

Co-authored-by: Björn Quentin <bjoernQ@users.noreply.github.com>

* Address a number of review comments

* Correct pin number in `hello_rgb` example for ESP32-C3

* Address the remaining review comments

* More small tweaks/improvements

* Fix RMT examples (#11)

* Fix RMT examples

* Remove logger-init

* Make I2S examples work on ESP32 (#12)

* Make I2S examples work on ESP32

* Remove logger init

* Fix the direct-vectoring examples on all RISCV chips (#10)

* Update GPIOs for some examples...

* Embassy timer example fixes (#13)

* Switch to generic queue instead of integrated for all examples

* changelog

* Update GPIO in another example, make `rustfmt` happy

* Fix ESP32-S2 PSRAM

* Avoid UART0 and SPI flash pins (#15)

* Avoid UART0 and SPI flash pins

* Fix spi_eh1_device_loopback for non-ESP32

* Update examples/src/bin/gpio_interrupt.rs

Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>

---------

Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
Co-authored-by: Björn Quentin <bjoernQ@users.noreply.github.com>
Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
2024-02-27 14:10:11 +00:00
.cargo Add the xtask package, implement automation for building examples (#1157) 2024-02-12 15:38:19 +00:00
.github Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
.vscode Combine the esp-ulp-riscv-hal and esp32c6-lp-hal packages (#1115) 2024-01-26 13:46:51 +00:00
esp-hal Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
esp-hal-procmacros Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
esp-hal-smartled Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
esp-lp-hal Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
esp-riscv-rt Document the features of the remaining packages (#1143) 2024-02-06 07:12:05 -08:00
examples Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
resources Add a simple CONTRIBUTING.md guide 2023-08-14 09:35:13 -07:00
xtask Add build-package and bump-version subcommands to xtask package (#1172) 2024-02-16 11:21:31 +00:00
.gitattributes Set merge=union git attribute for CHANGELOG.md 2023-07-12 09:24:09 -07:00
.gitignore Convert the VS Code workspace file into a standard settings file (#830) 2023-10-03 06:33:43 -07:00
Cargo.toml Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
CHANGELOG.md Unify: Remove the chip-specific HAL packages, adapt esp-hal for direct use [1/?] (#1196) 2024-02-27 14:10:11 +00:00
CONTRIBUTING.md Add a simple CONTRIBUTING.md guide 2023-08-14 09:35:13 -07:00
LICENSE-APACHE Initial commit 2021-10-19 15:00:41 -07:00
LICENSE-MIT Initial commit 2021-10-19 15:00:41 -07:00
pre-commit Improve the pre-commit hook 2023-05-11 08:53:03 -07:00
README.md docs: Update lp cores crates (#1119) 2024-01-26 14:02:53 +00:00
rustfmt.toml Begin adding some doc comments, update rustfmt config 2022-01-10 15:23:01 -08:00

esp-hal

GitHub Workflow Status MIT/Apache-2.0 licensed Matrix

Hardware Abstraction Layer crates for the ESP32, ESP32-C2/C3/C6, ESP32-H2, ESP32-P4, and ESP32-S2/S3 from Espressif. Additionally provides support for programming the low-power RISC-V cores found on the ESP32-C6 and ESP32-S2/S3.

These HALs are no_std; if you are looking for std support, please use esp-idf-hal instead.

If you have any questions, comments, or concerns, please open an issue, start a new discussion, or join us on Matrix. For additional information regarding any of the crates in this repository, please refer to the relevant crate's README.

Note

This project is still in the relatively early stages of development, and as such there should be no expectation of API stability. A significant number of peripherals currently have drivers implemented but have varying levels of functionality. For most basic tasks, this should be usable already, however some more advanced or uncommon features may not yet be implemented.

Getting Started

For information relating to the development of Rust applications on ESP devices, please first read The Rust on ESP Book.

For information about the HAL and how to use it in your own projects, please refer to the documentation on docs.rs for the relevant chip.

Resources

HAL Crates

High-Power Cores

Crate Documentation Technical Reference Manual Target MSRV
esp32-hal esp32-hal-docs ESP32 xtensa-esp32-none-elf esp
esp32c2-hal esp32c2-hal-docs ESP32-C2 riscv32imc-unknown-none-elf nightly
esp32c3-hal esp32c3-hal-docs ESP32-C3 riscv32imc-unknown-none-elf nightly
esp32c6-hal esp32c6-hal-docs ESP32-C6 riscv32imac-unknown-none-elf nightly
esp32h2-hal esp32h2-hal-docs ESP32-H2 riscv32imac-unknown-none-elf nightly
esp32p4-hal esp32p4-hal-docs ESP32-P4 riscv32imafc-unknown-none-elf nightly
esp32s2-hal esp32s2-hal-docs ESP32-S2 xtensa-esp32s2-none-elf esp
esp32s3-hal esp32s3-hal-docs ESP32-S3 xtensa-esp32s3-none-elf esp

Low-Power Cores

Crate Documentation Targets
esp-lp-hal N/A (Not yet published) riscv32imc-unknown-none-elf, riscv32imac-unknown-none-elf

Ancillary Crates

There are a number of other crates within the esp-rs organization which can be used in conjunction with esp-hal:

Crate Description
esp-alloc A simple no_std heap allocator
esp-backtrace Backtrace support for bare-metal applications
esp-ieee802154 Low-level IEEE802.15.4 driver for the ESP32-C6 and ESP32-H2
esp-openthread A bare-metal Thread implementation using esp-ieee802154
esp-println Provides print! and println! implementations
esp-storage Implementation of embedded-storage traits to access unencrypted flash memory
esp-wifi no_std Wi-Fi/BLE/ESP-NOW support

Git Hooks

We provide a simple pre-commit hook to verify the formatting of each package prior to committing changes. We strongly encourage use of this git hook.

The hook can be enabled by copying it in to the .git/hooks/ directory:

cp pre-commit .git/hooks/pre-commit

When using this hook, you can choose to ignore its failure on a per-commit basis by committing with the --no-verify flag; however, you will need to be sure that all packages are formatted when submitting a pull request.

License

Licensed under either of:

at your option.

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.