Skip to main content

main

Attribute Macro main 

Source
#[main]
Expand description

Declare the application entry point. See rivet_macros::main for the full docs and an example. Declare the application entry point. Expands to the #[no_mangle] extern "C" fn rivet_main() -> ! that rivet-rt’s boot code (_start on RISC-V, Reset on Cortex-M) calls after bss/data init, with rivet::init inserted automatically before the function body runs.

#[rivet::main]
fn main() -> ! {
    rivet::println!("hello");
    rivet::spawn_ptask!(stack = 512, priority = 1, entry = my_task, arg = ());
    rivet::run()
}

Takes no arguments; the annotated function must take no parameters (link the board/arch you want via use rivet_bsp_... as _; instead — see docs/porting.md).