Skip to main content

BoardEntry

Trait BoardEntry 

Source
pub trait BoardEntry: Board {
    // Required method
    fn run<F, E>(setup: F) -> Result<(), E>
       where F: FnOnce(&mut RuntimeCtx<'_>) -> Result<(), E>,
             E: Debug;

    // Provided methods
    fn run_with_deploy<F, E>(_deploy: &DeployOverlay, setup: F) -> Result<(), E>
       where F: FnOnce(&mut RuntimeCtx<'_>) -> Result<(), E>,
             E: Debug { ... }
    fn setup_transport(_deploy: &DeployOverlay) { ... }
}
Expand description

Per-board boot driver.

Implementations live in the family driver crates (nros-board-posix, nros-board-freertos, …). Per-board crates (nros-board-mps2-an385-freertos, …) plug the family.

Required Methods§

Source

fn run<F, E>(setup: F) -> Result<(), E>
where F: FnOnce(&mut RuntimeCtx<'_>) -> Result<(), E>, E: Debug,

Drive the full boot → user-closure → exit flow.

setup receives a &mut RuntimeCtx with overlay knobs from the launch file / CLI args. Returning Err from setup makes run route to super::BoardExit::exit_failure; Ok proceeds to executor spin + clean exit.

Returns Result, not !. The legacy nros-board-common::board_init::BoardEntry::run diverged; 212.N keeps the option to return so unit tests can drive it in a hosted process without exit() killing the test harness. Production boards still call exit_* from inside run’s body after spin returns.

Provided Methods§

Source

fn run_with_deploy<F, E>(_deploy: &DeployOverlay, setup: F) -> Result<(), E>
where F: FnOnce(&mut RuntimeCtx<'_>) -> Result<(), E>, E: Debug,

Boot like run but apply a deploy-metadata overlay to the board’s boot config first (issue #48 cause 1).

The default body ignores deploy and forwards to run; boards that compile a network/locator config (the FreeRTOS / bare-metal firmware boards) override it to overlay the supplied fields onto their Config::default(). nros::main!() calls this (not run) for target_os = "none" OwnedSpin targets so the [package.metadata.nros.deploy.<board>] block stops being inert.

Source

fn setup_transport(_deploy: &DeployOverlay)

Install a board custom transport selected by deploy.transport, BEFORE the linked RMW registers (phase-244.D1). nros::main!() calls this on target_os = "none" immediately before __register_linked_rmw() — the ordering an XRCE-over-UART vtable needs (set_custom_transport_ops must precede register). The default body is a no-op (the board’s built-in transport needs no pre-register install); boards with a feature-gated custom transport (e.g. mps2-an385 xrce-transport) override it. Failures are the board’s to handle (it owns exit_failure).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§