Hi all, PIC32MZ port misses the portYIELD_FROM_ISR implementation on portmacro.h
It has however portEND_SWITCHING_ISR which will trigger a software interrupt to switch to the scheduler.
On the documentation of freeRTOS there is:
“either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() - refer to the documentation page for the port being used.”
but on other targets I notice they implement the two defines differently.
Moreover, PIC32MZ, has on port_asm.S has a vPortYieldISR, which from my understanding, it is never called anyplace and there is any define that points to it.
On the PIC32MZ port, you can use portEND_SWITCHING_ISR directly in your ISR to trigger a context switch.
On other platforms (like Cortex-M, RISC-V, etc.), these macros may not be aliases, and can map to different implementations:
#define portYIELD_FROM_ISR( x ) do { if( x != pdFALSE ) { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; ( void ) portSYS_SSIR1_REG; } } while( 0 )
So the distinction is maintained because on some ports:
portYIELD_FROM_ISR() uses direct low-level register access.
portEND_SWITCHING_ISR() may wrap it for more semantic clarity.
You can see this code snippet in port_asm.S
/***************************************************************
* The following is needed to locate the vPortYieldISR function
* into the correct vector
***************************************************************/
.equ __vector_dispatch_1, vPortYieldISR
.global __vector_dispatch_1
.section .vector_1, code
On PIC32MZ, when a software interrupt is triggered (typically Software Interrupt 0, vector number 0), the interrupt controller invokes the handler associated with that interrupt. vPortYieldISR is the ISR that gets registered for that software interrupt vector.
The above code places vPortYieldISR into section .vector_1, which the linker script maps to vector 1 — Software Interrupt 0 on PIC32MZ.