Skip to content

Commit

Permalink
cortexm_common: Clear PendSV request after idle sleep
Browse files Browse the repository at this point in the history
The PendSV interrupt is used to request a scheduling operation. An
interrupt during the idle sleep can re-request the PendSV interrupt,
while the PendSV is still busy scheduling the next thread. This clears
the request after sleep to prevent triggering an extra PendSV interrupt
after the current PendSV handler finished.
  • Loading branch information
bergzand committed Jul 21, 2020
1 parent e8a8d12 commit 0eb66a4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cpu/cortexm_common/thread_arch.c
Expand Up @@ -474,4 +474,5 @@ void sched_arch_idle(void)
#endif
irq_restore(state);
NVIC_SetPriority(PendSV_IRQn, CPU_CORTEXM_PENDSV_IRQ_PRIO);
SCB->ICSR = SCB_ICSR_PENDSVCLR_Msk;
}

0 comments on commit 0eb66a4

Please sign in to comment.