[][src]Attribute Macro riscv_rt::pre_init


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.


unsafe fn before_main() {
    // do something here