AnsweredAssumed Answered

S32K148 switch to supervisor mode and back

Question asked by Michael Kirches on Aug 1, 2019
Latest reply on Aug 1, 2019 by Michael Kirches

Dear NXP community,

 

I have a question about application modes on the S32K148.

 

To test some particularities in our current application, it would be helpful to be able to check, if the application is currently running in user or supervisor mode and to switch to supervisor mode if required. These checks are related to CAN and a third party CAN stack we have to integrate.

 

We want to check, if the CAN stack tries to access registers which may be protected, we want to achieve something similar to this pseudo-code function:

 

Function ReadFromProtectedRegister(Pointer_To_Address)
VAR content
IF Application in User Mode THEN
   Switch to Supervisor Mode
   content = Content of memory at Pointer_To_Address
   Switch back to User Mode
ELSE
   content = Content of memory at Pointer_To_Address
ENDIF
RETURN content
END

 

Could anyone please give us a hint on how to achieve this? Thanks a lot in advance.

 

Regards,

Michael

Outcomes