hal::smp
Core identity, for kernels that run on more than one.
Symmetric cores only. Every core FlintOS runs on is assumed to be a peer: same instruction set, same speed, same view of memory. That covers the ESP32’s two LX6s and an RP2040’s two M0s.
Asymmetric parts — an M7 beside an M0 — are deliberately out of scope. In practice those run two different images rather than one kernel across both, and guessing at which of the many possible splits to support would be designing against a hypothetical.
Structs
Section titled “Structs”CoreId
Section titled “CoreId”struct CoreId(u8);Which core is executing.
A small integer rather than an enum: cores are numbered on every part that has more than one, and a kernel that wants to say “core 1” should not need a variant added first.
Implements: Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, StructuralPartialEq
Traits
Section titled “Traits”MultiCore
Section titled “MultiCore”trait MultiCore { fn current_core() -> CoreId fn cores() -> u8 fn request_reschedule(_core: CoreId) -> bool fn context_id() -> u8}Reading core identity.
One method, because everything else a kernel needs about a core — its stack, its current task — is the kernel’s own bookkeeping indexed by this.
Constants
Section titled “Constants”MAX_CORES
Section titled “MAX_CORES”const MAX_CORES: usize;The most cores any supported part has.
Sizes per-core arrays. Two today; raising it costs a little static memory and nothing else.