esp_hal

Attribute Macro main

#[main]
Expand description

Attribute to declare the entry point of the program

The specified function will be called by the reset handler after RAM has been initialized. If present, the FPU will also be enabled before the function is called.

The type of the specified function must be [unsafe] fn() -> ! (never ending function)

§Properties

The entry point will be called by the reset handler. The program can’t reference to the entry point, much less invoke it.

§Examples

  • Simple entry point
#[main]
fn main() -> ! {
    loop { /* .. */ }
}