I’ve been developing on an ARM Cortex M33 (nRF9160) with the MPU enabled. I am trying to move all my tasks to unprivileged mode. I keep running into what I call the “MPU wall” in this attempt. On my platform, I’ve decided to place all state variables used by drivers that service multiple tasks and are static within the driver module (not visible globally), in a shared memory pool that is setup to be shared and allowed by the MPU. I seem to be putting more and more of these state variables into this shared pool. Now, I’ve hit another obstacle where I’m calling a library function (Nordic library) and the MPU is running interference again. I’m wondering how to resolve this when I try to use other 3rd party libraries (I don’t necessarily have access to the source code either).
I’ve been bypassing this up until now by making the task a privileged task. However, this makes almost all my tasks privileged defeating the purpose of the MPU in the first place. So, I’m beginning to wonder about the feasibility of using the MPU at all.