Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. kernel
  6. static_init_state

static_init_state

Macro static_init_state 

Source
macro_rules! static_init_state {
    ($vis:vis static mut $name:ident: InitKernelState<$kernel:ty>) => { ... };
}
Expand description

Initializes an InitKernelState in static storage.

§Examples

Here’s an example of using static_init_state! on Cortex-M:

struct Arch;

#[cortex_m_rt::entry]
fn main() -> ! {
    Target::console_init();

    kernel::static_init_state!(static mut INIT_STATE: InitKernelState<Arch>);

    // SAFETY: `main` is only executed once, so we never generate more than one
    // `&mut` reference to `INIT_STATE`.
    kernel::Kernel::main(Arch, unsafe { &mut INIT_STATE });
}