Free, extremely simple and very fast real-time operating system (RTOS) designed for deeply embedded applications. Target: ARM Cortex-M, STM8, x86_64. It was inspired by the concept of a state machine. Procedure executed by the task (task state) doesn't have to be noreturn-type. It will be executed into an infinite loop. There's a dedicated function for immediate change the task state.
The API is documented in the header files, the documentation generated with doxygen is available on GitHub Pages. How to port the system to another processor, compiler or device is described in Porting StateOS.
Clone the repository with the submodule common (kernel, ports, startup code, CMSIS, build scripts):
git clone --recursive https://github.com/stateos/StateOS.git
include/osconfig.h: configuration of the kernelsrc/main.cpp: the application (src/main.cin C)examples: complete programs that show the use of every object, in C and C++stdc++: examples of the C++ thread support librarytest: unit tests of the kernel
The project is built for the STM32F4-Discovery board:
- make:
make -f makefile.gnucc(ormakefile.clang,makefile.armcc,makefile.iarcc,makefile.csmcc) - CMake:
cmake -S . -B build -G Ninjaandcmake --build build
Another board is selected in the makefile (include $(COMMON)/stateos/make/<board>/makefile.<compiler>) or in CMakeLists.txt (CMAKE_TOOLCHAIN_FILE);
the supported boards are in common/stateos/make and common/stateos/cmake.
- kernel can operate in preemptive or cooperative mode
- kernel can operate with 16, 32 or 64-bit timer counter
- kernel can operate in tick-less mode
- implemented basic protection using MPU (use nullptr, stack overflow)
- implemented functions for asynchronous communication with unmasked interrupt handlers
- spin locks
- once flags
- events
- signals with protection mask
- flags (any, all, new)
- barriers
- semaphores (binary, limited, counting)
- mutexes with configurable type, protocol and robustness
- condition variables
- read/write locks
- memory pools
- raw buffers
- message queues
- mailbox queues
- event queues
- job queues
- timers (one-shot, periodic)
- hierarchical state machine
- cmsis-rtos api
- cmsis-rtos2 api
- c++ wrapper
- support for std::thread
- API documentation generated with doxygen from the header files
- examples and templates are in separate repositories on GitHub
- archival releases on sourceforge
- std::thread, std::jthread, std::stop_callback, std::this_thread, ...
- std::mutex, std::shared_mutex, std::condition_variable, ...
- std::binary_semaphore, std::counting_semaphore, ...
- std::lock_guard, std::unique_lock, std::shared_lock, ...
- std::future, std::promise, std::async, ...
- std::barrier, std::latch, ...
- std::chrono, ...
- thread local storage (thread_local)
- and more ...
- ARM Cortex-M0(+), M3, M4(F), M7: compilers armcc, clang, csmcc, gnucc, iarcc
- STM8: compilers csmc, iarc, sdcc
- x86_64 (PC: Linux, Windows): compiler gcc, for testing purposes; preemptive mode on Linux and Windows 11
This project is licensed under the terms of the MIT License (MIT).