Attribute Macro embassy_macros::main_riscv
source · #[main_riscv]Expand description
Creates a new executor instance and declares an application entry point for RISC-V spawning the corresponding function body as an async task.
The following restrictions apply:
- The function must accept exactly 1 parameter, an
embassy_executor::Spawnerhandle that it can use to spawn additional tasks. - The function must be declared
async. - The function must not use generics.
- Only a single
maintask may be declared.
A user-defined entry macro can be optionally provided via the entry argument to override the default of riscv_rt::entry.
Examples
Spawning a task:
#[embassy_executor::main]
async fn main(_s: embassy_executor::Spawner) {
// Function body
}Spawning a task using a custom entry macro:
#[embassy_executor::main(entry = "esp_riscv_rt::entry")]
async fn main(_s: embassy_executor::Spawner) {
// Function body
}