nros_platform/board/init.rs
1//! [`BoardInit`] — Phase 212.N.1.
2//!
3//! Per-board hardware-init contract. Mirrors the legacy
4//! `nros-board-common::board_init::BoardInit`, but lives in
5//! `nros-platform` so codegen + family-driver crates (212.N.2) can
6//! depend on `nros-platform` alone rather than pulling
7//! `nros-board-common`.
8//!
9//! ## Differences from the legacy trait
10//!
11//! - **No `Config` associated type.** Board config moves to the
12//! typed `RuntimeCtx` accessed by `BoardEntry::run`'s `setup`
13//! callback — codegen owns config plumbing, not the board. A
14//! target whose hardware genuinely needs a build-time const
15//! (clock tree pin, MMIO base) keeps that as a board crate
16//! const, not a trait associated type.
17//! - **`init_hardware()` is parameterless.** The runtime
18//! `RuntimeCtx` is opened later (`BoardEntry::run` constructs it
19//! after init). Boards that need to peek at config during init
20//! read from the board crate's `pub const` / static rather than
21//! a `&Self::Config` arg.
22
23/// Per-board hardware-init contract.
24///
25/// One impl per board (`pub struct Mps2An385; impl BoardInit for
26/// Mps2An385`). Vendor HAL calls — clock tree, pin mux, peripheral
27/// wakes — live in [`Self::init_hardware`]. Called once by
28/// [`crate::board::BoardEntry::run`] before any transport bringup or
29/// executor lifecycle.
30pub trait BoardInit {
31 /// Hardware init. Runs once on boot, before any allocation or
32 /// transport bringup. Panicking from here is the same as
33 /// panicking from `fn main()` — there's no recovery path.
34 fn init_hardware();
35}