Overview
SRTOS is a small preemptive real-time operating system. It is designed for safety, clarity, and learning, providing a readable codebase for embedded developers.
All code is:
- Written in standard C (GNU11)
- Statically allocated (no dynamic memory)
- Built with strict warning flags (-Wall -Wextra -Werror -pedantic -Wconversion)
- Extensively documented for readability
- Hardware tested
Stack overflow detection and fault handlers are provided by default and developers can override them with custom implementations.
SRTOS is meant to be integrated as a drop-in library into any bare-metal project by copying the source (.c) and header (.h) files into your own directory and compiling alongside your main() function.
Supported Hardware
| Component | Status |
| Processor | ARM Cortex-M4 / M4F — fully supported |
| Board | STM32F411E-DISCO — fully supported |
| Others | Portable version in development; contributions welcome |
Installation and Usage
- Dependencies:
- make
- gcc-arm-embedded toolchain
- STM32_Programmer_CLI added to PATH. This is included in the installation of the STM32 Cube Programmer, you just need to add it to the PATH.
Integration Steps
- Copy all source files (Src/*.c) and header files (Inc/*.h) from this repository into your own directory.
Keep them alongside your application source file (which defines int main()).
- Copy the provided Makefile, startup_stm32f411vetx.s, and STM32F411VETX_FLASH.ld into the same directory.
Build: This generates build/main.elf and build/main.bin.
In the same directory, run:
Flash your board: (invokes STM32_Programmer_CLI -c port=SWD -w build/main.elf -rst)
In the same directory, run:
If the output indicates successful programming, SRTOS and your application are now running on the target.
Alternative - STM32CUBEIDE
You can also build and flash SRTOS directly inside STM32CubeIDE (refer to STM32CUBEIDE documentation for more information):
- Create a new STM32 project.
- Copy the SRTOS source and header files into your project.
- Replace the autogenerated main.c with your own.
- Use "Run" to build and flash.
Ensure the linker script and startup assembly file define the correct memory regions for your MCU.
Guides and Design
For getting started guides, please refer to GUIDES.md in the root directory of this repository. It is highly recommended to read about the design of SRTOS in DESIGN.md in the root of this repository.
Repository Structure
This section is constantly changing as new features are being added.
- All source files (.c) that are required for building SRTOS are located in Src/
- All header files (.h) that are required for building SRTOS are located in Inc/
- All source files that contain example usages of SRTOS are located in Examples/
- All source files that contain tests of SRTOS are located in Tests/
- All source files and markdown files (.md) that contain code and information about tests are located in Tests/
- A default startup and linkerscript is provided for the STM32F411E-DISCOVERY. The location of these scripts is not specified here, because they may be changing as the file structure design changes.
Contributing
Contributions are encouraged. Before opening a pull request:
- Follow the coding style in STYLE.md.
- Review the architecture description in DESIGN.md.
- Build with default compiler flags and ensure zero warnings.
Bug fixes, new ports, and documentation improvements are especially welcome.