newenclave/aikartos

Repository files navigation

AikaRTOS Logo

License: MITMade for STM32Work in Progress

AikaRTOS is a simple educational RTOS project originally targeting the STM32 NUCLEO-F411RE board, now also tested on the NUCLEO-H753ZI.

It is designed to explore basic task management, task scheduling, and memory allocation on embedded systems.

The project is written in C++20.

Note: This is a purely educational project. It was originally developed using a NUCLEO-F411RE board for experimentation purposes. Recently tested and confirmed to run on NUCLEO-H753ZI as well, though full multi-platform support is still a work in progress.


  • Basic task switching
  • Multiple scheduler implementations (e.g., Round-Robin, Fixed Priority)
  • Simple memory allocator implementations (e.g., bump, free list)
  • Simple startup sequence
  • Designed for STM32 Cortex-M4/M7 (tested on F411RE and H753ZI)
  • Written in C++20

All examples can be found in the aikartos/src/tests folder.

ExampleDescription
round_robin.cppDemonstrates basic Round-Robin task switching between three simple infinite loops.
edf.cppDemonstrates Earliest Deadline First (EDF) scheduling with tasks having different deadlines.
fixed_priority.cppDemonstrates Fixed Priority scheduling where tasks are executed based on static priorities.
lottery.cppDemonstrates Lottery Scheduling where tasks are chosen randomly based on ticket allocation.
priority_aging.cppDemonstrates Priority Scheduling with Aging to prevent starvation of low-priority tasks.
weighted_lottery.cppDemonstrates Weighted Lottery Scheduling where tasks have different chances of being selected based on weight.
stack_overflow.cppDemonstrates system behavior when a stack overflow occurs in a task. Useful for testing robustness.
producer_consumer.cppDemonstrates a simple Producer-Consumer system using a shared lock-free queue and cooperative task switching.
coop_preemptive.cppDemonstrates hybrid Cooperative-Preemptive scheduling where each task can have its own quantum or run cooperatively.
sch_cfs_like.cppDemonstrates a CFS-like scheduler where tasks are selected based on the smallest virtual runtime to ensure balanced CPU time distribution.
sch_mlfq.cppDemonstrates a Multilevel Feedback Queue scheduler with per-task quantum levels and automatic priority boosting.
memory_allocator_bump.cppDemonstrates a simple bump allocator used to manage memory in a linear fashion.
memory_allocator_free_list.cppDemonstrates a basic free-list memory allocator with support for reuse and fragmentation handling.
memory_allocator_dlist.cppDemonstrates a double-linked free-list allocator with bidirectional coalescing and minimal overhead on allocation.
memory_allocator_buddy.cppTests an arena-based buddy allocator (buddy::impl::region) that stores all metadata in external memory.
memory_allocator_buddy_fixed.cppTests a statically bounded buddy allocator (buddy::impl::fixed) with internal free list table.
memory_allocator_tlsf.cppTests a dynamic TLSF allocator (tlsf::impl::region) that places bucket index tables inside the managed memory block.
memory_allocator_tlsf_fixed.cppTests a statically sized TLSF allocator (tlsf::impl::fixed) with a fully internalized index table stored in std::array.

Preemptive

๐ŸŽฎ๐ŸŽฎ๐ŸŽฎ

AikaRTOS Snake Demo

A tiny cooperative Snake game demo running on AikaRTOS. Implements movement via timer-driven tasks, showcasing clean task switching and input handling.

the_snake.cpp

Preemptive

FPU demo

A small floating-point demo with smooth motion and fading trail. Uses trigonometric FPU math and per-frame task updates to draw a glowing animated path in the console. Demonstrates how one task can safely use the FPU while others do not, under a preemptive round-robin scheduler.

fpu_demo_01.cpp

FPU demo

fpu_demo_03.cpp

This project is licensed under the MIT License.


To build and run this project, you will need:

  • ARM toolchain (e.g., arm-none-eabi-gcc, arm-none-eabi-newlib)
  • STM32Cube Firmware Package for the selected platform (F4 or H7)
    This includes the necessary device headers like <stm32f4xx.h> or <stm32h7xx.h> and low-level drivers.

You can download the STM32Cube packages via:


This project uses CMake as its build system and can be built with Ninja, Make, or STM32CubeIDE.

  1. Clone the repository:
 git clone https://.com/newenclave/aikartos.git
 cd aikartos
  1. Configure the build (an example):
  cmake -G "Ninja" -B build_f411 \
    -DCMAKE_TOOLCHAIN_FILE=gcc-arm-none-eabi.cmake \
    -DPLATFORM=f411 \
    -DCMSIS_DIRECTORY="C:/soft/ST/STM32Cube_FW_F4/STM32Cube_FW_F4_V1.28.0/Drivers/CMSIS"

Note: paths must match your environment.

  1. Build
  cd build_f411
  ninja
  1. Flash using your preferred tool (e.g., ST-Link, OpenOCD, CubeProgrammer).

Releases

No releases published

Packages

No packages published