Attribute Macro cortex_m_rt_macros::pre_init [−][src]
#[pre_init]
Expand description
Attribute to mark which function will be called at the beginning of the reset handler.
IMPORTANT: This attribute can appear at most 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 function must have the signature of unsafe fn()
.
The function passed will be called before static variables are initialized. Any access of static variables will result in undefined behavior.
Examples
#[pre_init] unsafe fn before_main() { // do something here }