The crect project (pronounced correct) is a C++14 library for generating a scheduler for Cortex-M microcontrollers at compile-time. crect uses the Cortex-M’s Nested Vector Interrupt Controller (NVIC) to implement a Stack Resource Policy (SRP) scheduler which guarantees deadlock-free and data-race-free execution.
crect is built upon the Kvasir Meta-programming Library, which is also the foundation of the Kvasir framework. Use of C++ meta-programming and C++14 features allows priority ceilings and interrupt masks to be calculated at compile time. Resource locks are handled through RAII, and resource access is handled using a monitor pattern).
The most impressive thing about this framework is the minimal resource requirements:
- ~400 bytes of memory for the static elements (linked list, SysTick, time implementation)
- 4-5 instructions per job for initializing the NVIC
- 2-3 instructions per queue element for initializing the asynchronous queue
- 3-4 instructions + 4 bytes of stack space for a
lock - 1-3 instructions for an
unlock - 2-4 instructions for a
pend/clear - 20-30 instructions per item in the queue for
async
If you are working on a bare-metal ARM program with real-time concerns, crect is an RTOS alternative that can provides protection against common multithreading concerns like priority inversion, deadlocks, and race conditions.
Further Reading
For more on crect:
crecton GitHub- Real-time for the Masses
- Stack-Based Resource Allocation Policy for Realtime Processes
- Abstract Timers and their Implementation onto the ARM Corte-M Family of MCUs
- Real-time for the masses, step 1: Programming API and static priority SRP kernel primitives
Using C++ Without the Heap
Want to use C++, but worried about how much it relies on dynamic memory allocations? Our course provides a hands-on approach for learning a diverse set of patterns, tools, and techniques for writing C++ code that never uses the heap.
Learn More on the Course Page

One of the authors has a talk about CRECT here:
https://www.youtube.com/watch?v=SBij9W9GfBw
Ben,
I haven’t seen that talk yet, thank you very much for sharing the link .