A lightweight header-only rtos scheduler for Cortex M4/M33 mcus (in this case STM32F411CE/STM32H562VG) with usual RTOS primitives
- Priority driven scheduler
- No isr locks in the kernel
- MPU support
- Mutexes, semaphores, message queues
- Software timers
- Dynamic memory allocation using buddy allocator and pools
- Depends only on the linker file and startup code
- Include the header and dependencies in your project.
- Define "BAD_RTOS_IMPLEMENTATION" and include the header
#define BAD_RTOS_IMPLEMENTATION
#include "bad_rtos.h"- Perform your setup in bad_user_setup
void bad_user_setup(){
bad_task_descr_t task1_descr = {
.stack = 0,
.stack_size = TASK1_STACK_SIZE,
.entry = task1,
.regions = task1_regions,
.ticks_to_change = 500,
.base_priority = TASK2_PRIORITY
};
task1h = task_make(&task1_descr);
bad_task_descr_t task2_descr = {
.stack = task2_stack,
.stack_size = TASK2_STACK_SIZE,
.entry = task2,
.ticks_to_change = 500,
.base_priority = TASK2_PRIORITY
};
task2h = task_make(&task2_descr);
}```
4. Start the scheduler
```c
bad_rtos_start();- bad_rtos_start() can only be called in the translation unit where implementation was included
- API is written with static and or zero initilisation in mind, no need to call stuff_init on everything, read the comments for more information
You can freely modify or copy whatever you need.