Expand description
§Overview
Procedural macros for use with the esp-hal family of HAL packages. In
general, you should not need to depend on this package directly, as the
relevant procmacros are re-exported by the various HAL packages.
Provides macros for:
- Placing statics and functions into RAM
- Marking interrupt handlers
- Blocking and Async
#[main]macros
These macros offer developers a convenient way to control memory placement and define interrupt handlers in their embedded applications, allowing for optimized memory usage and precise handling of hardware interrupts.
Key Components:
-
handler- Attribute macro for marking interrupt handlers. Interrupt handlers are used to handle specific hardware interrupts generated by peripherals. -
ram- Attribute macro for placing statics and functions into specific memory sections, such as SRAM or RTC RAM (slow or fast) with different initialization options. See its documentation for details. -
main- A unified entry point macro. For blocking functions it sets the bare-metal entry point; for async functions it creates anesp_rtos::embassy::Executorand spawns the function body as a task.
§Examples
§Blocking entry point
#[main]
fn main() -> ! {
loop { /* .. */ }
}§Async entry point (requires the embassy feature in esp-rtos)
#[main]
async fn main(spawner: Spawner) {
// Your application's async entry point
}§Feature Flags
rtc-slow— Indicates the target device has RTC slow memory available.rtc-fast— Indicates the target device has RTC fast memory available.dcache-reclaimed— Indicates the target device has a data cache that when not used, is available in a memory section separate from DRAM.
§Low-power Core Feature Flags
has-lp-core— Indicate that the SoC contains an LP core.has-ulp-core— Indicate that the SoC contains a ULP core.is-lp-core— Provide an#[entry]macro for running applications on the ESP32-C6’s LP core.is-ulp-core— Provide an#[entry]macro for running applications on the ESP32-S2/S3’s ULP core.
Macros§
Attribute Macros§
- doc_
replace - Replaces placeholders in rustdoc doc comments.
- handler
- Mark a function as an interrupt handler.
- main
- Attribute to declare the entry point of the program.
- ram
- Sets which segment of RAM to use for a function or static and how it should be initialized.
Derive Macros§
- Builder
Lite - Automatically implement the Builder Lite pattern for a struct.