FreeRTOS FAQ – ISR’s
This is a subsection of the full FAQ
Can a context switch occur within an ISR?
Yes. Each RTOS port provides a macro to request a context switch from within an ISR. The name of the macro is dependent on the port (for historic reasons). It will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR. Refer to the documentation page for the port being used.
Every official port comes with a demo application that demonstrates context switching from an ISR.
How do I write an RTOS safe ISR?
That is very dependent on the microcontroller and tool chain port of FreeRTOS being used. Refere to the documentation page and demo application for the RTOS port being used.
Can interrupts be nested?
It depends on the port. See the description of the configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY configuration parameters for additional information.