sparreal_macros

Attribute Macro entry

Source
#[entry]
Expand description

Attribute to declare the entry point of the program

IMPORTANT: This attribute must appear exactly once in the dependency graph. Also, if you are using Rust 1.30 the attribute must be used on a reachable item (i.e. there must be no private modules between the item and the root of the crate); if the item is in the root of the crate you’ll be fine. This reachability restriction doesn’t apply to Rust 1.31 and newer releases.

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
#[entry]
fn main() -> ! {
    loop {
        /* .. */
    }
}