This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex-R5 MPU: writing to Region Base Register randomly causes Abort Exception

Hi all,

I am using MPU of Cortex-R5, in doing so when writing to Base Register, via standard CP15 access. (MCR p15, 0, Rd, c6, c1, 0) it randomly causes Prefetch Abort Exception, i.e. sometimes it works fine aswell. and IFSR shows PERMISSION type fault.

The regions' base address are aligned to their respective sizes.

So, what can be a possible reason for this behaviour ?

Thanks in advance.

Parents
  • Hi Uali,

    A permission fault would suggest that the MPU is preventing access to a region of code. For instance if the MCR instruction is in a region that is set to Privilege access only, but you try branching to this location to execute it from user mode, then it would cause this sort of fault. (If the MCR instruction is in a region that _is_ executable in user mode and you call it from user mode, it should cause an undefined instruction abort)

    However if you call the function from a privileged mode (such as sys, svc, IRQ or FIQ) then it should work fine. Is your MCR within a function that is called from different execution modes? When the fault occurs, what instruction is the fault status register pointing to?

    regards,

    Jon

Reply
  • Hi Uali,

    A permission fault would suggest that the MPU is preventing access to a region of code. For instance if the MCR instruction is in a region that is set to Privilege access only, but you try branching to this location to execute it from user mode, then it would cause this sort of fault. (If the MCR instruction is in a region that _is_ executable in user mode and you call it from user mode, it should cause an undefined instruction abort)

    However if you call the function from a privileged mode (such as sys, svc, IRQ or FIQ) then it should work fine. Is your MCR within a function that is called from different execution modes? When the fault occurs, what instruction is the fault status register pointing to?

    regards,

    Jon

Children