Hi all. I’m just starting to work with FreeRTOS. Reading through “Mastering the FreeRTOS™ Real Time Kernel”. The good news is that almost all of the topics are familiar from my college days. The not so good news is that college was a LONG time ago.
The FreeRTOS port I’m working with is v8.2.0 for the ESP32 processor as implemented in the Arduino ESP32 core.
Anyway, on the topic of synchronizing an ISR to a Task (Section 6.4), the guide contains the following code for the ISR (comments removed for brevity):
static uint32_t ulExampleInterruptHandler( void ) {
BaseType_t xHigherPriorityTaskWoken;
xHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR( xBinarySemaphore, &xHigherPriorityTaskWoken );
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
My question is about the xSemaphoreGiveFromISR( xBinarySemaphore, &xHigherPriorityTaskWoken ) and portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) macros.
It looks like this port’s implementation of the xSemaphoreGiveFromISR macro does indeed take two arguments – a SemaphoreHandle_t and a BaseType_t *.
However, its implementation of the portYIELD_FROM_ISR macro doesn’t take any arguments. In fact, it resolves to a call to _frxt_setup_switch(). The source code for this function is not included with the Arduino ESP32 core.
It seems pretty important that you should request a context switch when returning from the ISR if giving the token results in a higher-priority task (than the one that was interrupted) becoming ready to run.
So, is perhaps this context switch check is performed “automatically” by this particular port?
Thanks.