
I wrote a small preemptive RTOS from scratch for ARM Cortex-M with STM32 Nucleo-F756ZG BSP
yo
Over the past couple weeks, I’ve been building a compact preemptive RTOS kernel completely from scratch in C for ARM Cortex-M (currently targeting the STM32F756ZG).
The original goal was purely educational: I wanted to deeply understand how RTOS kernels actually work internally instead of treating them like a black box.
Current features include:
- preemptive priority scheduler
- PendSV/SVC context switching
- separate PSP task stacks
- queues
- semaphores
- mutexes
- ISR-safe synchronization APIs
- stack watermarking
- runtime task diagnostics
- HardFault register dump + fault decoding
- UART-based OSI (Operating System Interface)
The project intentionally stays very close to the hardware and avoids heavy abstraction layers.
I’m fully aware it is NOT production-ready yet; there’s still no MPU support, stack overflow protection, priority inheritance, dynamic allocation, etc, but the core functionality is now stable enough that I’d love to open it up to contributors and discussion from people more experienced than me.
One of my main goals moving forward is exploring what it would take to evolve TinyRTOS into something significantly more robust while still keeping it small and understandable.
I’d genuinely appreciate:
- architecture critiques
- RTOS design feedback
- embedded debugging advice
- Cortex-M exception handling discussion
- contributors interested in helping improve it
Repo: https://github.com/iwilkey/tinyrtos
Let me know what you think!