Skip to main content

main

Attribute Macro main 

Source
#[main]
Expand description

#[ove::main] proc-macro: marks the application entry point. Expands into the extern "C" fn ove_main() trampoline. Attribute macro: mark a function as the oveRTOS application entry point.

Generates an #[unsafe(no_mangle)] pub extern "C" fn ove_main() trampoline that calls the annotated function.

§Forms

Sync:

#[ove::main]
fn app_main() {
    ove::log::try_init();
    log::info!("hello");
    ove::run();
}

Async (requires ove feature async):

use embassy_executor::Spawner;

#[ove::main]
async fn app_main(spawner: Spawner) {
    spawner.must_spawn(my_task());
    // Executor::run() never returns; ove::run() is implicit.
}