Skip to main content

run_app_core

Function run_app_core 

Source
pub fn run_app_core<const N: usize, const SWI: u8, F>(
    cpu_ctrl: CPU_CTRL<'static>,
    sw_int: SoftwareInterrupt<'static, SWI>,
    stack: &'static mut Stack<N>,
    prio: Priority,
    init: F,
) -> AppCoreGuard<'static>
where F: FnOnce(SendSpawner) + Send + 'static,
Expand description

Park + start the APP core running an [InterruptExecutor] at prio; init runs on the APP core with the executor’s [SendSpawner] to spawn its tasks.

Encapsulates the defensive park_core(AppCpu) reset — probe-rs’s JTAG reset doesn’t always return the APP-core control registers to power-on state, so a JTAG-flashed boot can find the core reported “running” and start_app_core panics with CoreAlreadyRunning; parking clears that, and start_app_core unparks before the core runs. (Documented perf tradeoff on CoreS3: the disturbance measurably slows LCD render — accepted for boot reliability.)

Call from the PRO core (main). The returned [AppCoreGuard] must be kept alive for the program’s lifetime — dropping it stops the APP core.

sw_int is one of SystemResources::sw_int.software_interruptN; stack is a &'static mut Stack<N> the caller allocates (e.g. mk_static!/StaticCell).