#![no_std]
use core::mem::size_of;
use rusty_rtos_core::config::PosixDemoConfig;
use rusty_rtos_core::hooks::NoTickHook;
use rusty_rtos_core::trace::NoTrace;
use rusty_rtos_kernel_core::kernel::Kernel;
use rusty_rtos_kernel_core::{list_slots_for, lists_for};
use rusty_rtos_port_core::sim::SimPort;
const PRIOS: u8 = 5;
macro_rules! ksize {
($tasks:literal, $queues:literal, $slots:literal,
$buffers:literal, $bytes:literal, $timers:literal, $groups:literal) => {
size_of::<
Kernel<
PosixDemoConfig,
SimPort,
NoTrace,
NoTickHook,
$tasks,
{ list_slots_for($tasks, $timers, lists_for(PRIOS, $queues, $groups)) },
{ lists_for(PRIOS, $queues, $groups) },
$queues,
$slots,
$buffers,
$bytes,
$timers,
$groups,
{ <PosixDemoConfig as ::rusty_rtos_core::config::Config>::TIMER_QUEUE_LENGTH },
>,
>()
};
}
const BASE: usize = ksize!(8, 8, 64, 4, 1024, 16, 2);
const TASKS_16: usize = ksize!(16, 8, 64, 4, 1024, 16, 2);
const QUEUES_16: usize = ksize!(8, 16, 64, 4, 1024, 16, 2);
const SLOTS_128: usize = ksize!(8, 8, 128, 4, 1024, 16, 2);
const BUFFERS_8: usize = ksize!(8, 8, 64, 8, 1024, 16, 2);
const BYTES_2048: usize = ksize!(8, 8, 64, 4, 2048, 16, 2);
const TIMERS_32: usize = ksize!(8, 8, 64, 4, 1024, 32, 2);
const GROUPS_4: usize = ksize!(8, 8, 64, 4, 1024, 16, 4);
const CORPUS: usize = ksize!(24, 12, 128, 8, 2048, 32, 4);
macro_rules! probe {
($sym:ident, $size:expr) => {
#[no_mangle]
pub static $sym: [u8; $size] = [0; $size];
};
}
probe!(KAIROS_RAM_BASE, BASE);
probe!(KAIROS_RAM_TASKS_16, TASKS_16);
probe!(KAIROS_RAM_QUEUES_16, QUEUES_16);
probe!(KAIROS_RAM_SLOTS_128, SLOTS_128);
probe!(KAIROS_RAM_BUFFERS_8, BUFFERS_8);
probe!(KAIROS_RAM_BYTES_2048, BYTES_2048);
probe!(KAIROS_RAM_TIMERS_32, TIMERS_32);
probe!(KAIROS_RAM_GROUPS_4, GROUPS_4);
probe!(KAIROS_RAM_CORPUS, CORPUS);
const TINY: usize = ksize!(2, 1, 8, 0, 0, 1, 0);
const SMALL: usize = ksize!(4, 2, 16, 0, 0, 2, 1);
const SMALL_SB: usize = ksize!(4, 2, 16, 1, 256, 2, 1);
probe!(KAIROS_RAM_TINY, TINY);
probe!(KAIROS_RAM_SMALL, SMALL);
probe!(KAIROS_RAM_SMALL_SB, SMALL_SB);
type Base = Kernel<
PosixDemoConfig,
SimPort,
NoTrace,
NoTickHook,
8,
{ list_slots_for(8, 16, lists_for(PRIOS, 8, 2)) },
{ lists_for(PRIOS, 8, 2) },
8,
64,
4,
1024,
16,
2,
{ <PosixDemoConfig as ::rusty_rtos_core::config::Config>::TIMER_QUEUE_LENGTH },
>;
probe!(KAIROS_FP_TOTAL, Base::FOOTPRINT);
probe!(KAIROS_FP_TCBS, Base::FOOTPRINT_TCBS);
probe!(KAIROS_FP_QUEUES, Base::FOOTPRINT_QUEUES);
probe!(KAIROS_FP_LISTS, Base::FOOTPRINT_LISTS);
probe!(KAIROS_FP_SLOTS, Base::FOOTPRINT_SLOTS);
probe!(KAIROS_FP_BUFFERS, Base::FOOTPRINT_BUFFERS);
probe!(KAIROS_FP_TIMERS, Base::FOOTPRINT_TIMERS);
probe!(KAIROS_FP_GROUPS, Base::FOOTPRINT_GROUPS);
probe!(KAIROS_FP_TIMER_MESSAGES, Base::FOOTPRINT_TIMER_MESSAGES);
probe!(KAIROS_FP_BYTES, Base::FOOTPRINT_BYTES);
probe!(KAIROS_FP_FREE_LISTS, Base::FOOTPRINT_FREE_LISTS);
probe!(KAIROS_FP_PER_TASK_SIDE, Base::FOOTPRINT_PER_TASK_SIDE);
probe!(KAIROS_FP_ACCOUNTED, Base::FOOTPRINT_ACCOUNTED);
type T32 = Kernel<
PosixDemoConfig,
SimPort,
NoTrace,
NoTickHook,
8,
{ list_slots_for(8, 32, lists_for(PRIOS, 8, 2)) },
{ lists_for(PRIOS, 8, 2) },
8,
64,
4,
1024,
32,
2,
{ <PosixDemoConfig as ::rusty_rtos_core::config::Config>::TIMER_QUEUE_LENGTH },
>;
probe!(KAIROS_T32_TOTAL, T32::FOOTPRINT);
probe!(KAIROS_T32_TIMERS, T32::FOOTPRINT_TIMERS);
probe!(KAIROS_T32_LISTS, T32::FOOTPRINT_LISTS);
probe!(KAIROS_T32_ACCOUNTED, T32::FOOTPRINT_ACCOUNTED);
type T17 = Kernel<
PosixDemoConfig,
SimPort,
NoTrace,
NoTickHook,
8,
{ list_slots_for(8, 17, lists_for(PRIOS, 8, 2)) },
{ lists_for(PRIOS, 8, 2) },
8,
64,
4,
1024,
17,
2,
{ <PosixDemoConfig as ::rusty_rtos_core::config::Config>::TIMER_QUEUE_LENGTH },
>;
probe!(KAIROS_T17_TOTAL, T17::FOOTPRINT);
probe!(KAIROS_T17_TIMERS, T17::FOOTPRINT_TIMERS);
probe!(KAIROS_T17_LISTS, T17::FOOTPRINT_LISTS);
#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {}
}