cpu/cortexm_common: flush pipeline after PendSV

https://interrupt.memfault.com/blog/arm-cortex-m-exceptions-and-nvic#pendsv-example
This commit is contained in:
Marian Buschsieweke 2020-09-25 13:51:38 +02:00
parent ad9e35c445
commit 304f4ec7d4
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -297,6 +297,9 @@ void thread_yield_higher(void)
/* trigger the PENDSV interrupt to run scheduler and schedule new thread if
* applicable */
SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
/* flush the pipeline. Otherwise we risk that subsequent instructions are
* executed before the IRQ has actually triggered */
__ISB();
}
void __attribute__((naked)) __attribute__((used)) isr_pendsv(void) {