nros_platform/board/mod.rs
1// Phase 212.N.1 — trait surface only; consumers land in 212.N.2+.
2// Suppress `dead_code` workspace-wide until a family driver crate
3// pulls these in. Phase 216.A.1 — `DispatchStrategy` ships ahead of
4// its first consumer (Phase 216.A.2 trait extension), so
5// `unused_imports` joins the allowance.
6#![allow(dead_code, unused_imports)]
7
8//! Board trait family — Phase 212.N.1.
9//!
10//! Platform-agnostic Board taxonomy living in `nros-platform`. The
11//! board crate (`nros-board-{linux,freertos,threadx,…}`) implements
12//! the per-family/per-target surface; user Entry pkgs invoke
13//! `<Board as BoardEntry>::run(setup)` from `main.rs`.
14//!
15//! ## Surface
16//!
17//! ```text
18//! Board: BoardInit + BoardPrint + BoardExit
19//! │
20//! └── BoardEntry: Board {
21//! fn run<F, E>(setup: F) -> Result<(), E>
22//! where F: FnOnce(&mut RuntimeCtx) -> Result<(), E>;
23//! }
24//! ```
25//!
26//! `BoardEntry::run` owns the full boot lifecycle: hardware init →
27//! transport bringup → executor lifecycle → clean exit. The `setup`
28//! callback receives a [`RuntimeCtx`] for overlay (params / remaps /
29//! env) plus the codegen-emitted `run_plan(runtime)` call.
30//!
31//! ## Status
32//!
33//! Phase 212.N.1 ships the trait surface only. Per-board impls
34//! (212.N.2 family driver crates + 212.N.3 tier-1 per-board crates),
35//! codegen (212.N.4 / N.5 — lives in standalone `nros-cli` repo per
36//! CLAUDE.md), and cmake fn rename (212.N.6) follow.
37//!
38//! ## Relationship to the old `nros-board-common::Board*` traits
39//!
40//! `nros-board-common` once carried a second trait family (`Board`,
41//! `BoardInit`, `BoardPrint`, `BoardExit`, `BoardEntry`, ~~`DirectExec`~~
42//! and a generic `run`). Phase 313 W6 (#0243) deleted it; this module is
43//! the one board entry API.
44
45pub mod config;
46pub mod dispatch;
47pub mod entry;
48pub mod exit;
49pub mod init;
50pub mod network;
51pub mod print;
52pub mod rtic_entry;
53pub mod runtime;
54pub mod tier;
55
56pub use config::BoardConfig;
57pub use dispatch::DispatchStrategy;
58pub use entry::{BoardEntry, DeployOverlay, LinkKind};
59pub use exit::BoardExit;
60pub use init::BoardInit;
61pub use print::BoardPrint;
62pub use rtic_entry::RticBoardEntry;
63pub use runtime::{
64 NodeDispatchRuntime, NullNodeRuntime, RuntimeCtx, RuntimeError, SignaledCallback,
65};
66pub use tier::{
67 PriorityDirection, TierSpec, TierSpinGap, boot_tier_index, freertos_priority_for,
68 posix_nice_for, threadx_priority_for,
69};
70
71// Phase 313 W1 (issue #0243) — the phase-214.K.1 `NodeRuntime` →
72// `NodeDispatchRuntime` deprecation alias is removed (its one-release cycle long
73// elapsed; the only consumers were the internal re-exports). Impls use
74// `NodeDispatchRuntime` directly.
75
76/// Super-trait every board impl carries (mirrors
77/// `nros-board-common::board_init::Board`).
78///
79/// Blanket-implemented for any type carrying all three contracts;
80/// concrete board crates do NOT impl `Board` directly — they impl
81/// `BoardInit`/`BoardPrint`/`BoardExit` (and the optional mixins).
82pub trait Board: BoardInit + BoardPrint + BoardExit {}
83impl<T: BoardInit + BoardPrint + BoardExit> Board for T {}