How freeRTOS switch from MSP to PSP

Hi,

How FreeRTOS switch from MSP to PSP?

Best Regards,
Mehdi.

Assuming you’re talking about Cortex M ports, this code changes from MSP to PSP the first time. Other similar code in port.c changes from MSP to PSP when returning from interrupt handlers. You can look in the architecture reference manual to see how the return-address register LR (R14) uses special exception-return values.