0
0
ARM Architectureknowledge~3 mins

Why PendSV and SysTick exceptions in ARM Architecture? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your tiny device could juggle many tasks perfectly without you lifting a finger?

The Scenario

Imagine trying to manage multiple tasks on a tiny microcontroller without any automatic help. You have to constantly check timers and switch between tasks by hand, like juggling many balls without dropping any.

The Problem

Doing this manually is slow and error-prone. You might miss a timer event or switch tasks too late, causing your system to freeze or behave unpredictably. It's like trying to drive a car while manually shifting gears without any help.

The Solution

PendSV and SysTick exceptions are special signals in ARM processors that help automate task switching and timing. SysTick triggers regular time checks, and PendSV handles switching tasks smoothly in the background, so your system runs efficiently without your constant attention.

Before vs After
Before
while(1) {
  check_timer();
  if(task_switch_needed) {
    save_state();
    load_next_task();
  }
}
After
void SysTick_Handler(void) {
  trigger_PendSV();
}
void PendSV_Handler(void) {
  switch_tasks();
}
What It Enables

It enables smooth multitasking and precise timing on tiny devices without slowing down your main program.

Real Life Example

In a smartwatch, SysTick keeps track of time to update the display every second, while PendSV switches between monitoring heart rate and handling user input seamlessly.

Key Takeaways

Manual task management on microcontrollers is slow and unreliable.

PendSV and SysTick automate timing and task switching efficiently.

This leads to smoother multitasking and better device performance.