diff --git a/Demo/CORTEX_Kinetis_K60_Tower_IAR/main-full.c b/Demo/CORTEX_Kinetis_K60_Tower_IAR/main-full.c index c71065e3c..19cfa685b 100644 --- a/Demo/CORTEX_Kinetis_K60_Tower_IAR/main-full.c +++ b/Demo/CORTEX_Kinetis_K60_Tower_IAR/main-full.c @@ -624,6 +624,12 @@ const unsigned long ulSysTickPendingBit = 0x04000000UL; /* How many times has it overflowed? */ ulTickCount = xTaskGetTickCountFromISR(); + + /* This is called from the context switch, so will be called from a + critical section. xTaskGetTickCountFromISR() contains its own critical + section, and the ISR safe critical sections are not designed to nest, + so reset the critical section. */ + portSET_INTERRUPT_MASK_FROM_ISR(); /* Is there a SysTick interrupt pending? */ if( ( *pulInterruptCTRLState & ulSysTickPendingBit ) != 0UL )