Skip to main content

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 existing `nros-board-common::Board*` traits
39//!
40//! The legacy traits in `nros-board-common::board_init`
41//! (`Board`, `BoardInit`, `BoardPrint`, `BoardExit`, `BoardEntry`,
42//! `DirectExec`, `run`) stay as-is during the transition. Phase
43//! 212.N.7 retires the M.5.a FreeRTOS BSP baker and migrates every
44//! Node pkg to the new shape; at that point the legacy
45//! `nros-board-common` traits become `pub use` re-exports of this
46//! module (or get retired entirely if no consumer remains).
47
48pub mod config;
49pub mod dispatch;
50pub mod embassy_entry;
51pub mod entry;
52pub mod exit;
53pub mod init;
54pub mod network;
55pub mod print;
56pub mod rtic_entry;
57pub mod runtime;
58pub mod tier;
59
60pub use config::BoardConfig;
61pub use dispatch::DispatchStrategy;
62pub use embassy_entry::EmbassyBoardEntry;
63pub use entry::{BoardEntry, DeployOverlay};
64pub use exit::BoardExit;
65pub use init::BoardInit;
66pub use print::BoardPrint;
67pub use rtic_entry::RticBoardEntry;
68pub use runtime::{
69    NodeDispatchRuntime, NullNodeRuntime, RuntimeCtx, RuntimeError, SignaledCallback,
70};
71pub use tier::{
72    PriorityDirection, TierSpec, TierSpinGap, boot_tier_index, freertos_priority_for,
73    posix_nice_for, threadx_priority_for,
74};
75
76// Phase 313 W1 (issue #0243) — the phase-214.K.1 `NodeRuntime` →
77// `NodeDispatchRuntime` deprecation alias is removed (its one-release cycle long
78// elapsed; the only consumers were the internal re-exports). Impls use
79// `NodeDispatchRuntime` directly.
80
81/// Super-trait every board impl carries (mirrors
82/// `nros-board-common::board_init::Board`).
83///
84/// Blanket-implemented for any type carrying all three contracts;
85/// concrete board crates do NOT impl `Board` directly — they impl
86/// `BoardInit`/`BoardPrint`/`BoardExit` (and the optional mixins).
87pub trait Board: BoardInit + BoardPrint + BoardExit {}
88impl<T: BoardInit + BoardPrint + BoardExit> Board for T {}