Skip to content

OceanBhatnagar/ARM-Cortex-M4-Round-Robin-Task-Scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

STM32-Custom-Preemptive-Round-Robin-Scheduler

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.


Features

  • 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

Components Used

  • STM32 Nucleo Development Board
  • Onboard LEDs (GPIO Output)

🧰 Tools & Technologies

  • 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

About

Built a custom RTOS-style scheduler from scratch using ARM Cortex-M4 exception model (SysTick + PendSV). Achieved context switching by manually handling PSP, stack frames, and register preservation, enabling true task-level concurrency without an external OS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors