rusty_rtos_heap_core/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2#![forbid(unsafe_code)]
3//! `rusty_rtos_heap-core` — the pure heart of `rusty_rtos_heap`.
4//!
5//! Rules this crate lives by (from the Kairos mission plan):
6//!
7//! 1. `no_std` by default; `alloc` is a feature, never an assumption.
8//! 2. No CPU, no registers, no allocator, no operating system. Ports and
9//! backends are separate WRAP crates.
10//! 3. Every type that crosses to another Kairos package comes from
11//! `rusty_rtos_core`, so packages compose without conversions.
12//! 4. Handles are indices, never pointers; nothing on a hot path allocates.
13//! 5. `forbid(unsafe)`. The C kernel's trace is the oracle; the scalar path
14//! is the oracle; any faster path is gated identical against it.
15
16#[cfg(feature = "alloc")]
17extern crate alloc;
18
19pub mod heap1;
20/// `heap_3.c`: the platform's allocator behind the family's heap surface.
21///
22/// Needs `alloc`, which is the honest dependency: it IS the "use the
23/// platform's allocator" heap, so a build without one has nothing to route
24/// to.
25#[cfg(feature = "alloc")]
26pub mod heap3;
27pub mod heap4;
28pub mod heap5;
29/// A fixed-size block pool: the allocation an RTOS actually makes.
30///
31/// Not a FreeRTOS file, and it does not pretend to be. `heap_4` answers a
32/// general question and its cost is that generality; most RTOS allocation
33/// -- TCBs, queue items, timer records, event blocks -- is one size known
34/// when the system is declared, and that question is far cheaper to answer.
35/// 55.2% fewer instructions than `heap_4` on the host, 73.9% at the 32-bit
36/// width every Kairos target has.
37pub mod pool;
38
39pub use heap1::Heap1;
40#[cfg(feature = "alloc")]
41pub use heap3::Heap3;
42pub use heap4::{Heap4, Region};
43pub use heap5::Heap5;
44pub use pool::{Pool, Slot};
45pub use rusty_rtos_core as rtos_core;
46
47/// The names a firmware wants in scope.
48pub mod prelude {
49 pub use rusty_rtos_core::prelude::*;
50}
51
52/// Crate version, for manifests and logs.
53pub const VERSION: &str = env!("CARGO_PKG_VERSION");