Hello,
I am working with uC S32K144. I am developing two applications that have different access rights, one runs under supervisor mode, the other under user mode for safety reason.
The problem is, the application that runs under user mode has sometimes the need to read some registers and maube write on them, so it gets rejected and SW resets.
For now I developed a patch to switch to the supervisor mode before running the function that access crticial registers.
Is there another solution for that ? Is there a way to allow limited access for some registers when we are on user mode ?
when implementing safety-critical applications that need strict separation between user mode and supervisor mode. You've made a smart decision by switching to supervisor mode to access critical registers, but it would be great to explore other ways to handle this situation more efficiently while maintaining the security and integrity of your system.
One potential solution could be leveraging a memory protection unit (MPU) or a hardware-based access control mechanism, depending on the specific capabilities of the S32K144. Some microcontrollers support configurable regions where certain registers or memory blocks can be accessed in user mode under specific conditions, without needing to fully switch to supervisor mode. This could be done by defining access rules for specific registers or memory regions. Another approach is using safe wrappers or gateways for register access, where the user mode application would call predefined functions that perform the access checks and only allow register access when it is deemed safe. These functions could then manage the transition to supervisor mode only when absolutely necessary, rather than switching modes manually within critical sections of the application.
It’s also worth checking whether the S32K144 offers features like secure supervisor mode or privileged access registers which could allow more fine-grained control over what the user mode application can access. Using these hardware security features could help you limit the scope of what is accessible without compromising the safety requirements of your system.