Murat Cakmak

Kinetis K8x MPU and Supervisor/User Modes

Discussion created by Murat Cakmak on Dec 24, 2016
Latest reply on Jan 8, 2017 by Hui_Ma

I am trying to understand MPU on K8x family. This family does not include a Cortex M4 MPU, instead, it has Kinetis specific MPU.

 

In the Kinetis K82 Sub-Family Reference Manual,

3.1.5 Core privilege levels
The ARM documentation uses different terms than this document to distinguish between privilege levels.
If you see this term... it also means this term...

  • Privileged -> Supervisor
  • Unprivileged or user -> User

 

Now, Great but when I look at the MPU example in Kinetis SDK v2.1 for FRDM-82F, I cannot see that relation.

As you know, region 0 gives access to User mode for all device at startup.

In the example,  a different region is also set to limit user access to a specific region.

First, application is able to write the sepecific region and execution is in Privileged Mode.

And then example removes rights from Region 0 (which gives access to user mode for all device) using MPU_SetRegionRwxMasterAccessRights() function.

After that when example tries to access same region again, it gets "Bus Fault".

 

Problem is that execution still in Privileged Mode and no operation to pass Unprivileged mode during example.

Example just changes regions access but execution is always in privileged mode and SuperVisor (privileged) mode has rights to access to this region but getting Bus Fault.

 

Am I missing something?

 

Only I need, differentiate memory access with ARM Cortex Privileged/Unprivileged Modes.

Outcomes