Hello,
If you need to switch to User mode, just set the nPRIV bit in CONTROL register
// switch to User (unprivileged) mode
__asm__("mov r0, #0x01");
__asm__("msr control, r0"); // nPRIV = 1
And to switch it back, you need to do it in SVC handler
// make a supervisor call (SVC) to transfer control to privileged software
__asm__("svc #0x00");
void SVC_Handler(void){
// switch to Supervisor (privileged) mode
__asm__("mov r0, #0x00");
__asm__("msr control, r0"); // nPRIV = 0
}
Unfortunately, I’m not familiar with MCAL.
Could you please create a service ticket?
https://community.nxp.com/docs/DOC-329745
Regards,
Daniel