Skip to content
Back to skills

Esp Hal Knowledge Patch

ASecurity

esp-hal

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
developmentrustgoapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 17 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill esp-hal-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Esp Hal Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Esp Hal Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-esp-hal-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-esp-hal-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: esp-hal-knowledge-patch
description: esp-hal
version: "1.2.0"
license: MIT
metadata:
  author: Nevaberry
---


# esp-hal compatibility guidance

Load this skill when migrating esp-hal applications or integrating its allocator,
diagnostics, flash, radio, and RTOS crates. Use the topic references for complete
migration details, examples, and chip-specific conditions.

## Reference index

| Reference | Topics |
| --- | --- |
| [Foundations and peripherals](references/foundations-peripherals.md) | Toolchains, features, entry points, builders, singleton lifetimes, eFuse, chip support |
| [GPIO](references/gpio.md) | Pin ownership, configuration, routing, event waits, interrupt status |
| [UART, I2C, TWAI](references/uart-i2c-twai.md) | Blocking and async I/O, errors, FIFO settings, readiness, DMA, breaks, timeouts |
| [SPI and DMA](references/spi-dma.md) | Transfer methods, buffer ownership, cancellation, channels, memory-to-memory DMA |
| [Time and clocks](references/time-clocks.md) | Time types, timers, watchdogs, RTC, clock configuration and queries |
| [Sleep and low power](references/sleep-low-power.md) | Persistent wake sources, GPIO, UART, ULP and LP cores, wake causes |
| [Interrupts and runtimes](references/interrupts-runtimes.md) | Binding, run levels, software interrupts, locks, guards, RISC-V and Xtensa runtimes |
| [Memory and allocation](references/memory-allocation.md) | PSRAM, RAM placement, linker hooks, allocator selection, DMA alignment, heap hooks |
| [Cryptography and analog](references/crypto-analog.md) | RNG, AES, RSA, SHA, ECC, ADC, temperature sensing |
| [RMT, I2S, parallel interfaces](references/rmt-i2s-parallel.md) | Channels, pulses, streaming, TDM, PDM, LCD, camera, PARL_IO, PWM |
| [Diagnostics](references/diagnostics.md) | Backtraces, panic handling, log timestamps, filtering, printing |
| [Configuration and macros](references/configuration-macros.md) | Generated settings, validators, builders, entry macros, documentation macros |
| [Flash storage](references/flash-storage.md) | Peripheral ownership, storage traits, encryption, multicore access, erase validation |
| [Radio networking](references/radio-networking.md) | Scheduler migration, Wi-Fi lifecycle and events, scanning, BLE, IEEE 802.15.4 |
| [RTOS integration](references/rtos-integration.md) | Embassy migration, scheduler interrupts, multicore operation, sleep, task lifecycle |

## Entry points, dependencies, and configuration

- Replace the old `entry` attribute with `#[esp_hal::main]`; the `macros` module
  is private. Replace `esp_hal::prelude` imports with defining-module imports.
- HAL 1.0.0 uses edition 2024 and requires Rust 1.88. Libraries should disable
  default HAL features so the final binary controls `rt`, `exception-handler`,
  and Xtensa `float-save-restore`.
- Enable `unstable` explicitly for gated APIs and settings, including
  `gpio::Input::wait_for` and `gpio::Event`. Replace `log` with `log-04`, use
  `defmt` 1.0, and remove `debug` and the former public `usb_otg` and `bluetooth` features.
- Use default configurations and generated builders; read private configuration
  fields through accessors. Add wildcard arms for affected non-exhaustive enums.
- Remove peripheral-instance type arguments from affected drivers and replace
  `new_typed` with their standard constructors.

## Peripheral ownership and GPIO

- Replace `Peripheral` and `PeripheralRef` with singleton types carrying
  lifetimes. Use `reborrow`, conversions instead of inherent `degrade`, and
  numbered GPIO and concrete DMA channel types from `esp_hal::peripherals`.
- Include `..` when destructuring non-exhaustive `Peripherals`.
  Recover erased types with `AnyPin::downcast` or `AnyPeripheral::downcast`.
- Keep `Async` drivers on their owning thread or core; they no longer implement `Send`.
- Pass GPIO configuration structs to constructors. Replace `OutputOpenDrain`
  with a configured output and old `Flex` setters with configuration and controls.
- Pass GPIO pins directly for bidirectional I2C and half-duplex SPI signals;
  `gpio::Output` no longer satisfies those bounds.
- SPI, UART, and I2C disconnect replaced pins and disconnect their pins on drop.
  Dropping a GPIO wait future stops its interrupt listener.
- Check chip or module pin reservations. In custom GPIO handlers, clear the
  relevant status bits, which the HAL leaves set by default.

## SPI and DMA migration

For HAL 1.2.0 `unstable` APIs, `SpiDma::with_buffers(rx_buf, tx_buf)` returns
`SpiDma`, which directly implements blocking and async `SpiBus`.

- Replace the former buffer-owning `read`, `write`, and `transfer` methods with
  `read_buffer`, `write_buffer`, and `transfer_buffers`; replace
  `half_duplex_read` and `half_duplex_write` with `half_duplex_read_buffer` and
  `half_duplex_write_buffer`, respectively.
- Remove `SpiDmaBus`. Recover buffers with `SpiDmaTransfer::wait()` on transfers
  started by the buffer methods, replacing `SpiDmaBus::split()`.
- Replace generic DMA compatibility bounds and aliases with driver channel
  traits such as `SpiDmaChannel` or `I2sDmaChannel`.
- `Mem2Mem::new` requires `Mem2MemCapableChannel`. Its singleton arguments vary
  by chip; use the chip-specific guidance in the SPI and DMA reference.

Since HAL 1.1.1, dropping a SPI DMA transfer object also drops its owned bus and
buffer. Keep the object through completion if those resources must be recovered.
Dropping `Spi::transfer_in_place_async` stops the transfer; `SpiDma<Async>` waits
for completion on the SPI interrupt.

## Sleep and wakeup migration

For HAL 1.2.0 `unstable` APIs, arm wakeup through the driver owning the hardware.
Pass `RtcSleepConfig::default()` to `sleep_light` or `RtcSleepConfig::deep()` to
`sleep_deep`, replacing the old wake-source slice.

- Wake enables persist across sleep, deep-sleep wake, and driver drop until
  explicitly disabled. Absolute timer deadlines remain armed until replaced
  or cleared with `clear_wakeup_deadline`.
- With no enabled source able to wake the chip, light sleep returns immediately
  and deep sleep panics. Use `sleep_deep_with_rejection` to regain control when
  hardware rejects a request because a source is already asserted.
- Replace GPIO `wakeup_enable` and `WaitForOptions` with `Input::listen` or the
  `wait_for` family. These arm both interrupts and light-sleep wake.
- Deep sleep and light sleep with `pd_hp_periph` or `pd_top` require a low-power
  pad with its low-power path enabled. Configure a pull opposite the wake level
  or use an external resistor for level-triggered wake.
- `RisingEdge` wakes on high, `FallingEdge` on low; `AnyEdge` samples the pin at
  sleep entry and arms the opposite level. A pin already at its wake level
  causes sleep rejection.
- Use the sleep reference for ULP/LP wake, UART rising-edge thresholds, and
  iteration over the `WakeupReason` set returned by `wakeup_cause()`.

## I2S construction and DMA

For HAL 1.2.0 `unstable` APIs, pass `TdmConfig` to `I2s::new`. PDM is simplex,
available only on I2S0, and constructed with `I2s::new_pdm` and `PdmConfig`.

- Call channel-builder `.build()` without descriptors. Use `dma_rx_buffer!` or
  `dma_tx_buffer!` for one-shot buffers and `dma_rx_stream_buffer!` or
  `dma_tx_stream_buffer!` for streams.
- For async transfers, call `I2s::into_async()` before building channels.
- `read(buffer)` and `write(buffer)` consume the channel and buffer; startup
  failure returns both in `Err((error, channel, buffer))`.
- One-shot `wait()` or `wait_async().await` returns the completion result,
  channel, and buffer. Streaming handles dereference to buffer views; use
  `wait_for_available_async().await` and the byte count from `available_bytes()`.

## UART and I2C behavior

- Replace blocking UART `read_bytes` and `write_bytes` with `read` and `write`,
  using returned byte counts. `flush` is blocking and fallible; RX and TX have
  separate `RxError` and `TxError` types.
- UART `read_async` and `write_async` are cancellation-safe. `read_exact_async`,
  `split`, and split-half types require `unstable`.
- Since HAL 1.1.1, configure the RX FIFO full threshold with a nonzero value; successful
  `read_async` into a nonempty buffer returns at least one byte.
- RX overflow detection clears the RX FIFO. RX and TX settings are configured
  separately; the default `tx_idle_num` is zero, so transmission starts immediately.
- Async-mode I2C exposes blocking and `_async` methods. Dropping an async
  operation cancels it; the driver clears the bus after errors when necessary.
- I2C hardware and software timeout settings require `unstable` and default to
  their maximum values. `Config::with_software_timeout` sets the software timeout
  that handles a stuck-low SCL.

## Interrupts, timers, and clocks

- Since HAL 1.1.0, replace `bind_interrupt` plus `enable` with safe, infallible
  `bind_handler`; remove `Priority::None` and `InterruptHandler::new_not_nested`.
- For HAL 1.2.0 `unstable` APIs, construct `SoftwareInterrupt` from the matching
  `FROM_CPU_INTRn` singleton instead of `SoftwareInterruptControl`.
- Use `esp_hal::time::{Rate, Duration, Instant}` and replace
  `esp_hal::time::now()` with `Instant::now()`.
- Timer `wait` blocks. Replace `enable_interrupt(true)` and `enable_interrupt(false)`
  with `listen()` and `unlisten()` and handle out-of-range one-shot `InvalidTimeout`.
- Configure watchdogs through their drivers after removal of `WatchdogConfig`.
- For HAL 1.2.0 `unstable` APIs, replace `Clocks::get()` and its fields with free
  functions; wrap `clock::ll::apb_clk_frequency()` in `Rate`. Low-level clock
  controls are experimental.

## PSRAM and allocation

- Since HAL 1.1.0, replace the `psram` Cargo feature with the `Psram` driver and
  `esp_hal::psram::psram_raw_parts` with `Psram::raw_parts`, or initialize the
  allocator with `esp_alloc::psram_allocator!`.
- On ESP32-S3, use driver `PsramMode` instead of `ESP_HAL_CONFIG_PSRAM_MODE`.
  Its default `Auto` detects Quad or Octal SPI PSRAM; failed detection leaves
  SPI1 uninitialized.
- Starting with `esp-alloc` 0.11, select a chip feature. Disable its default
  features if the application supplies its own Rust global allocator.
- Use `AnyMemory`, `InternalMemory`, or `ExternalMemory` with `allocator_api2`
  collections on stable Rust. DMA-aligned buffers can use
  `DmaCompatibleInternalMemory` or `DmaCompatibleExternalMemory`.

## Radio and RTOS migration

- `esp-wifi` becomes `esp-radio` in 0.16.0 and removes `builtin-scheduler`;
  applications must supply a scheduler.
- In `esp-radio` 0.18.0, create Wi-Fi and BLE without a shared controller;
  `esp_radio::init` is private and `Controller` is removed. Select the radio
  crate's own `unstable` for its gated APIs.
- Use Wi-Fi `set_config` to start or restart the controller and drop it to stop.
  A failed `set_config` also stops Wi-Fi. Replace blocking lifecycle calls with
  the configuration-driven lifecycle and remaining async operations.
- Replace generic Wi-Fi event waits and `EventExt` with
  `WifiController::subscribe()` or the specific async event waits. The `event`
  module requires `unstable`; queue capacity and subscriber limits are configurable.
- Replace `esp-hal-embassy` with `esp-rtos` for Embassy integration.
- From `esp-rtos` 0.3.0, call `esp_rtos::start` outside interrupt handlers. In
  0.4.0, scheduler start functions and `InterruptExecutor::new` take corresponding
  `FROM_CPU_INTRn` singletons instead of `SoftwareInterrupt` values.
- In `esp-rtos` 0.4.0, `esp_rtos::sleep::configure` replaces `auto_light_sleep`.
  Its idle hook restores timekeeping and rearms the scheduler timer after light sleep.

## Additional features and integration checks

- UART supports software breaks; stable `read_ready` and `write_ready` take `&self`.
  SPI supports 3-wire transfers and octal data-line builders; I2S supports loopback.
- RMT configuration uses references and `Channel::with_pin`; use
  `Channel::apply_config` for reconfiguration and handle `rmt::ConfigError`.
- RNG supports `rand_core` 0.10; replace `Trng::default()` with explicit
  entropy-backed initialization. `ShaDigest` requires exclusive peripheral access.
- In `esp-storage` 0.10.0, byte and NOR operations are inherent methods; enable
  non-default `embedded-storage` for trait users, keeping existing dependency features.
- For diagnostics, select at most one of `halt-cores`, `custom-halt`, and
  `semihosting`. Use the diagnostics reference for timestamp hooks and panic dumps.

Files in this skill

  • SKILL.md12.2 KB
  • coverage.json1.4 KB
  • references/configuration-macros.md4.1 KB
  • references/crypto-analog.md4.3 KB
  • references/diagnostics.md2.3 KB
  • references/flash-storage.md2.5 KB
  • references/foundations-peripherals.md6 KB
  • references/gpio.md2.5 KB
  • references/interrupts-runtimes.md5.6 KB
  • references/memory-allocation.md4.2 KB
  • references/radio-networking.md10.2 KB
  • references/rmt-i2s-parallel.md6.9 KB
  • references/rtos-integration.md3.8 KB
  • references/sleep-low-power.md4.9 KB
  • references/spi-dma.md5.3 KB
  • references/time-clocks.md4.1 KB
  • references/uart-i2c-twai.md3.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.