
* Create the `esp32c6-hal` package * Teach `esp-hal-common` about the ESP32-C6 * Get a number of peripheral drivers building for the ESP32-C6 bckup initial clocks_ii * Create the `esp32c6-hal` package C6: update * Simplify and fix the linker script update * C6: add I2S * Create the `esp32c6-hal` package * Teach `esp-hal-common` about the ESP32-C6 * Get a number of peripheral drivers building for the ESP32-C6 bckup initial clocks_ii * Create the `esp32c6-hal` package * C6: update * Simplify and fix the linker script * update * C6: add I2S * update * C6 Interrupts * C6: Update build.rs, linker scripts and initial examples * C6: RMT * Fix interrupt handling * Fix `ClockControl::configure` * C6: revert to I2S0 instead of just I2S * C6: rebase and update * RTC not buildable * Implement RWDT and SWD disable * C6: working LEDC * C6: working RMT * C6: add aes * C6: add mcpwm * C6: add rtc_cntln - not finished * C6: update and formatting * C6: add pcnt * C6: add examples and format * Remove inline assembly, fix interrupts and linker scripts * Remove unused features, update cargo config for atomic emu, misc cleanup * Get ADC building and example "working" (as much as it ever does) * Remove a bunch of unused constants which were copied from ESP-IDF * The `mcpwm` example now works correctly * Get `TWAI` peripheral driver building for C6 * Clean up the `rtc_cntl` module and get all the other HALs building again * Add the C6 to our CI workflow * Fix various things that have been missed when rebasing Still missing a few examples (`clock_monitor`, `embassy_spi`, `ram`) * C6: Small updates in wdt (#1) * C6: Update WDT * C6: Update examples with WDT update * Update `esp-println` dependency to fix build errors * Fix formatting issues causing pre-commit hook to fail * Get some more examples working * Working `ram` example * Sync with changes in `main` after rebasing * Working `embassy_spi` example * Use a git dependency for the PAC until we publish a release * Fix I2S for ESP32-C6 * Fix esp32c6 direct boot (#4) * Add direct boot support for C6 * Fix direct boot for c6 - Actually copy into rtc ram - remove dummy section that is no longer needed (was just a waste of flash space) - Move RTC stuff before the no load sections * Update RWDT and refactor RTC (#3) * C6: Update RWDT and add example, refactor RTC and add not-really-good example * Update based on review comments, resolve bunch of warnings and run cargo fmt * Update C6 esp-pacs rev commit * Fix clocks_ll/esp32c6.rs * Fix riscv interrupts * Remove clock_monitor example for now * RAM example works in direct-boot mode * Add a TODO for &mut TIMG0 and cargo fmt * Fix linker script after a bad rebase * Update CI and Cargo.toml embassy required features * use riscv32imac-unknown-none-elf target for C6 in CI * change default target to riscv32imac-unknown-none-elf * add riscv32imac-unknown-none-elf target to MSRV job * another cleanup --------- Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de> Co-authored-by: Jesse Braham <jesse@beta7.io> * Make required changes to include new `RADIO` peripheral * Use published versions of PAC and `esp-println` * Use the correct target extensions (`imac`) * Fix the super watchdog timer, plus a few more examples * Fix UART clock configuration * Make sure to sync UART registers when configuring AT cmd detection * Disable APM in direct-boot mode * Address a number of review comments * Fix `SPI` clocks and `rtc_watchdog` example (#6) * fix SPI clocks * run cargo fmt * Add comment about used default clk src * Fix rtc_watchdog example in BL mode * run cargo fmt * Update rtc_watchdog example that it works in DB mode * README and example fixes/cleanup * Add I2C peripheral enable and reset * Fix `ApbSarAdc` configuration in `system.rs` --------- Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de> Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com> Co-authored-by: Juraj Sadel <jurajsadel@gmail.com> Co-authored-by: Scott Mabin <scott@mabez.dev>
6.6 KiB
esp-hal
Hardware Abstraction Layer crates for the ESP32, ESP32-C2/C3/C6, and ESP32-S2/S3 from Espressif.
These HALs are no_std
; if you are looking for std
support, please use esp-idf-hal instead.
This project is still in the early stages of development, and as such there should be no expectation of API stability. A significant number of peripherals currently have drivers implemented (you can see a full list here) but have varying levels of functionality. For most basic tasks, this should be usable already.
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 crate's README.
Crate | Target | Technical Reference Manual |
---|---|---|
esp32-hal | xtensa-esp32-none-elf |
ESP32 |
esp32c2-hal | riscv32imc-unknown-none-elf |
ESP32-C2 |
esp32c3-hal | riscv32imc-unknown-none-elf |
ESP32-C3 |
esp32c6-hal | riscv32imac-unknown-none-elf |
ESP32-C6 |
esp32s2-hal | xtensa-esp32s2-none-elf |
ESP32-S2 |
esp32s3-hal | xtensa-esp32s3-none-elf |
ESP32-S3 |
Quickstart
We recommend using cargo-generate and esp-template in order to generate a new project with all the required dependencies and configuration:
$ cargo install cargo-generate
$ cargo generate --git https://github.com/esp-rs/esp-template
For more information on using this template, please refer to its README.
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-println | Provides print! and println! implementations |
esp-storage | Implementation of embedded-storage traits to access unencrypted flash memory |
esp-wifi | no_std Wi-Fi/Bluetooth LE support |
MSRV
The Minimum Supported Rust Versions are:
1.65.0
for RISC-V devices (ESP32-C2, ESP32-C3, ESP32-C6)1.65.0
for Xtensa devices (ESP32, ESP32-S2, ESP32-S3)1.67.0
for allasync
examples (embassy_hello_world
,embassy_wait
, etc.)
Note that targeting the Xtensa ISA currently requires the use of the esp-rs/rust compiler fork. The esp-rs/rust-build repository has pre-compiled release artifacts for most common platforms, and provides installation scripts to aid you in the process.
RISC-V is officially supported by the official Rust compiler.
Git Hooks
We provide a simple pre-commit
hook to verify the formatting of each package prior to committing changes. This can be enabled by placing it in 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:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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.