Merge pull request #14534 from bergzand/pr/cortexm/irq_during_idle

cortexm_common: disable IRQ during thread_sched_idle
This commit is contained in:
Martine Lenders 2020-07-16 15:35:14 +02:00 committed by GitHub
commit ea8e867611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -462,6 +462,7 @@ void sched_arch_idle(void)
* According to [this](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHJICIE.html),
* dynamically changing the priority is not supported on CortexM0(+).
*/
unsigned state = irq_disable();
NVIC_SetPriority(PendSV_IRQn, CPU_CORTEXM_PENDSV_IRQ_PRIO + 1);
__DSB();
__ISB();
@ -471,5 +472,6 @@ void sched_arch_idle(void)
#else
__WFI();
#endif
irq_restore(state);
NVIC_SetPriority(PendSV_IRQn, CPU_CORTEXM_PENDSV_IRQ_PRIO);
}