This repository contains the source code and documentation for a Custom Preemptive Round-Robin Task Scheduler on STM32, implemented from scratch without using any external RTOS. The project demonstrates low-level task management using ARM Cortex-M4 exception handling (SysTick and PendSV) and manual context switching.
- Preemptive Scheduling: Uses SysTick timer to generate periodic interrupts and trigger context switching via PendSV
- Manual Context Switching: Saves and restores task context (R4–R11) using Process Stack Pointer (PSP)
- Round-Robin Algorithm: Cycles through multiple tasks with equal priority for fair CPU allocation
- Task Delay Mechanism: Implements tick-based blocking/unblocking using a global tick counter
- Idle Task: Executes when no other task is ready
- Critical Section Handling: Uses PRIMASK to avoid race conditions during scheduling
- STM32 Nucleo Development Board
- Onboard LEDs (GPIO Output)
- STM32CubeIDE – Development and debugging
- STM32 HAL – Peripheral abstraction
- ARM Cortex-M4 – Exception handling (SysTick, PendSV, PSP/MSP switching)
- STM32CubeMX-Peripheral configuration and initialization code generation