AnsweredAssumed Answered

How to enable MemManage_Handler when MPU violation happens?

Question asked by anita tranzillo on Sep 30, 2019
Latest reply on Oct 1, 2019 by Daniel Martynek

Hello, I have a problem wih MPU.

I'm using S32K144 uC.

I'm using MPU to detect stack overflow/underflow.

I have enabled MPU protection for two regions which surrounds the stack. 

After this, I enable MemManage_Handler and then the MPU, like this:

 

    S32_SCB->SHCSR |= 1<<16;
    MPU->CESR |= MPU_CESR_VLD_MASK;

 

The problem is that when I try to write in a protected region, HardFault exception Always occurs.

Do you have experience on this issue?

Is there any restriction to enable MemManage exception?

 

I have also redefined MemManage handler

void MemManage_Handler(void)

{
  FailureCbk();

since I need to apply a recovery action.

 

I hope you will help me

Outcomes