#[entry]
Expand description
Creates an unsafe
program entry point (i.e. a kmain
function).
It’s unsafe
because you are not supposed to call it - it should only be
called from the start-up code once initialisation is complete.
When placed on a function like:
ⓘ
#[entry]
fn foo() -> ! {
panic!("On no")
}
You get something like:
#[doc(hidden)]
#[export_name = "kmain"]
pub unsafe extern "C" fn __cortex_ar_rt_kmain() -> ! {
foo()
}
fn foo() -> ! {
panic!("On no")
}
The symbol kmain
is what the assembly code in both the cortex-r-rt and
cortex-a-rt start-up code will jump to, and the extern "C"
makes it sound
to call from assembly.