# esp-hal: a bare-metal Rust HAL for Espressif chips, with a version policy you have to read

> The Rust hardware abstraction layer behind ESP32 projects, covering a dozen chips across several families, where the interesting part is not the GPIO API but the rules about which breaking changes you get and when.

**esp-rs/esp-hal** — no_std Hardware Abstraction Layers for ESP32 microcontrollers

- Repository: https://github.com/esp-rs/esp-hal
- Website: https://docs.espressif.com/projects/rust/
- Stars: 2,205 · Forks: 545
- Language: Rust
- License: Apache-2.0
- Published: 2026-10-06 · Updated: 2026-10-06 · Language: en
- Canonical page: https://hysenlabs.com/projects/esp-rs-esp-hal

## Bare-metal Rust for the chips you already know

The repository describes itself as a bare-metal `no_std` hardware abstraction layer for Espressif devices, and the chip list is given by family rather than as an afterthought. The ESP32 Series covers the original ESP32. The ESP32-C Series lists C2, C3, C5, C6, and C61. The ESP32-H Series has the H2. The ESP32-P Series has the P4. The ESP32-S Series lists S2 and S3.

That is twelve parts across five families, which matters because no single HAL can be uniform across them. A RISC-V part and an Xtensa part do not present the same peripherals, and a part without Wi-Fi does not have the radio the ecosystem crates expect.

There is one genuinely unusual capability in the list. The repository also provides support for programming the low-power RISC-V cores found on the ESP32-C6, ESP32-S2, and ESP32-S3 through the `esp-lp-hal` package. Those are secondary cores used for tasks that must keep running while the main core sleeps, and driving them needs a separate HAL because they are a different processor with their own memory-mapped peripherals. It is the kind of feature that makes this more than a wrapper, and it is the sort of thing no cross-vendor HAL offers.

Topics on the repository are embedded, embedded-hal, esp32, and rust. The licence is Apache-2.0 or MIT at your option, with both files present in the tree.

## One repository, twenty-odd crates

What arrives in the published crate is a small part of what is in the tree. The repository directory listing shows `esp-hal/` itself alongside `esp-alloc/` for allocation, `esp-backtrace/` for panic output, `esp-bootloader-esp-idf/` for the ESP-IDF bootloader path, `esp-config/`, `esp-hal-procmacros/` for the procedural macros, and `esp-metadata/` with `esp-metadata-generated/` for chip description data.

Then there are the peripherals and the platform. `esp-phy/` handles the physical layer radio calibration, `esp-radio/` is the radio crate, `esp-radio-rtos-driver/` is its RTOS-backed driver, `esp-rtos/` is the runtime, `esp-riscv-rt/` and `xtensa-lx-rt/` are the two runtime start-up paths for the two instruction sets, and `xtensa-lx-rt-proc-macros/` supports them. `esp-println/` handles printing. `esp-storage/` covers storage, `esp-sync/` covers synchronisation primitives, and `esp-rom-sys/` gives access to the ROM routines baked into the silicon.

Three entries tell you this project takes testing seriously. There is `hil-test/`, a hardware-in-the-loop test suite that runs against real hardware, and `hil-test-radio/` for the radio. There is `compile-tests/`, which is the practice of checking that code still builds against chip configurations it may not be exercised on. And there is `xtask/`, the task runner convention from the Rust compiler project, plus `xtask-mcp-macros/`.

A `tests` story built around real hardware is expensive to run and cheap to fake, so its presence in the tree is the strongest signal about how this project verifies itself.

## The version policy that decides your Cargo.toml

The support policy is the section of the README most people should read twice. All active development happens on main. Backported fixes go only to the latest minor release within a major version, so patches applied to 1.1.x stop the moment 1.2.0 ships and only 1.2.x receives them afterwards.

Then the part that affects anyone on unstable APIs. The README states the project will never push breaking changes in a patch release, but unstable changes will make their way into minor releases. So a user of unstable APIs updating from 1.1.x to 1.2.x may hit breaking changes, and the recommended defence is a version requirement that pins the minor line:

```toml
esp-hal = { version = "~1.1" }
```

The tilde operator prevents cargo from auto-updating across minor versions, so you can run `cargo update` for patch fixes without risking a break. That is a small, concrete piece of advice with a real payoff, and it is the kind of thing a HAL that is pre-1.0 in several corners has to offer.

The same logic applies to browsing examples. The README recommends viewing the tag for the esp-hal release you are using rather than reading the examples on main, because main is used for development and APIs may have changed in the meantime.

The README also carries a maturity note worth taking seriously: the repository includes crates at various stages of maturity and stability, many functionalities are implemented and usable for most tasks, and certain advanced or less common features may still be under development, with each crate offering different levels of functionality and guarantees. That is an unusually candid statement for a HAL README.

## What the 1.2.0 release actually changed

The esp-hal v1.2.0 release, published on 2026-09-03, adds chip support for the ESP32-P4 from chip revision v3.0 and newer, and support for the ESP32-S31. It stabilized no public APIs. The migration guide for stable users has no notes at all, which is the good case.

For unstable users the same release removed the `Clocks` struct and `Clocks::get()`. The clock frequencies it provided moved to lockless free functions from `esp_hal::clock`, and for chip-specific clocks to `esp_hal::clock::ll`. The release notes give the mapping directly: `Clocks::get().cpu_clock` becomes `clock::cpu_clock()`, `Clocks::get().apb_clock` becomes `Rate::from_hz(clock::ll::apb_clk_frequency())`, and `Clocks::get().xtal_clock` becomes `clock::xtal_clock()`.

A release candidate preceded it: esp-hal-v1.2.0-rc.0, published on 2026-08-25, carries the same chip support additions and the same `Clocks` removal. That the candidate and the final are so close together, and that the release policy section points at a RELEASING.md for how candidates are staged and published, tells you the release process is formalised.

The other release in the list is a different crate: esp-radio-v1.0.0-beta.1, published on 2026-09-22, described as the second 1.0.0 beta with the API still being refined and feedback still wanted. It was accompanied by esp-generate@1.4, which is the project scaffolding tool that generates a new binary crate, so the two releases arriving together is not a coincidence. Its migration notes show Wi-Fi credential configuration moving into a single `AuthenticationMethodConfig` that carries the password for the selected method, and `Ssid` and `Password` rejecting oversized values.

One practical consequence: `main` is where the work is, the last push was on 2026-09-28, and the repository carries 251 open issues.

## Examples that map to real hardware tasks

The examples directory is small and pointed, which is more useful than a large pile of demos. There is `hello_world/`, `peripheral/` for driving peripherals directly, and `interrupt/` for interrupt handling.

The radio and connectivity examples are where the ecosystem crates show up in practice. There is `wifi/`, `ble/` for Bluetooth Low Energy, `ieee802154/` for the 802.15.4 standard, and `esp-now/`, which is Espressif's own peer-to-peer protocol on top of Wi-Fi. Those four together cover the wireless options the hardware actually offers, and they are also where you find out which crate owns which job.

The remaining three are the interesting ones for embedded Rust. `async/` shows asynchronous Rust on these parts. `ota/` covers over-the-air updates, which is a substantial feature rather than a script. And `qa/` appears to be the project's hardware-in-the-loop quality assurance suite, matching the `hil-test/` directory in the tree.

An `examples/README.md` sits at the root of that directory, and the README at repository level points you elsewhere for the fundamentals rather than repeating them: The Rust on ESP Book for developing Rust applications on ESP devices, the documentation site for how to use the HAL in your own projects, and a resources list naming The Rust Programming Language, the Embedded Rust Book, the Embedonomicon, and a no_std training resource on Espressif.

The division is sensible. The README tells you what exists and where the policy lives, and the book explains how to write the code.

## Where esp-hal sits against the C stack

There is a real alternative for this hardware and it is Espressif's own: ESP-IDF, the C framework, and `esp-idf-svc`, the Rust bindings to it, which the README links from its reference list. The difference is where the abstraction sits.

An approach built on ESP-IDF gives you a mature vendor framework with a full peripheral library, a networking stack, and years of production use, reached from Rust through bindings. That is the lower-risk choice for a product with a deadline, because the C framework is what the silicon is documented against.

esp-hal goes the other way. It is bare-metal Rust with no_std, which means no C framework underneath, and the trade is a direct, idiomatic interface to the hardware in exchange for a project that is still maturing and where stability guarantees vary crate by crate. The README's own note about crates at different stages of maturity is the honest version of that trade.

A third option is doing nothing at this layer: if the task is application logic that only needs GPIO, timing, and one serial port, pulling in a HAL framework is more dependency than the job needs.

Two smaller signals are worth noting. The README asks production users with support needs to contact a rust.support@espressif.com address, which suggests commercial support exists behind the open source layer. And the project publishes an AI contribution policy that follows the official Rust Embedded working group policy, so code generated with an assistant is a considered question here rather than an unstated one.

## Conclusion

esp-hal is the layer to reach for when a Rust ESP32 project needs to stay bare-metal rather than sitting on top of the C SDK, and the cost of that choice is a strict dependency discipline rather than a feature gap. The support policy is the part to internalise before writing any code: all development lands on main, only the latest minor of a major receives backported patches, and anyone using unstable APIs can be broken by a minor bump. Pin with the tilde operator if that applies to you. The other thing to check before committing is chip support for your exact part, since the 1.2.0 release added ESP32-P4 from revision v3.0 and ESP32-S31 while stabilizing no public APIs at all, which tells you how much of the surface is still moving.

## FAQ

### Which ESP32 chips does esp-hal support?

The README lists the original ESP32, the C series with C2, C3, C5, C6 and C61, the H2, the P4, and the S series with S2 and S3. It also supports programming the low-power RISC-V cores on the C6, S2 and S3 through the esp-lp-hal package.

### Does esp-hal use C or C++ under the hood?

No. It is a bare-metal no_std Rust hardware abstraction layer, so there is no C or C++ framework in the path. If you want the vendor C framework instead, the README links esp-idf-svc, which is the Rust binding to ESP-IDF.

### How do I avoid breaking changes from esp-hal minor releases?

Pin the minor line with the tilde operator, for example esp-hal = { version = "~1.1" }, which stops cargo auto-updating across minor versions. The README notes that unstable APIs may bring breaking changes in minor releases, while patch releases never will.

### What changed in the esp-hal 1.2.0 release?

Support was added for the ESP32-P4 from revision v3.0 and newer and for the ESP32-S31, and no public APIs were stabilized. For unstable users, the Clocks struct and Clocks::get() were removed in favour of free functions in esp_hal::clock and esp_hal::clock::ll.

### Can I use the examples on the main branch?

The README recommends viewing the tag for the esp-hal release you are using, for example esp-hal-v1.0.0, when browsing examples. The main branch is used for development, so its APIs and examples may have changed since your release.

## Sources

- [esp-rs/esp-hal on GitHub](https://github.com/esp-rs/esp-hal)
- [License: Apache-2.0](https://github.com/esp-rs/esp-hal/blob/main/LICENSE)
- [Project website](https://docs.espressif.com/projects/rust/)
- [README](https://github.com/esp-rs/esp-hal/blob/main/README.md)
- [Releases](https://github.com/esp-rs/esp-hal/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/esp-rs-esp-hal
