AnsweredAssumed Answered

Writing in an Illegal memory location does not generate MM fault

Question asked by Muzahir Hussain on Nov 10, 2017
Latest reply on Nov 10, 2017 by Clive One

I am accessing an illegal memory location, but it does no generate MemManage fault or HardFault. Here's the compiling code that demonstrate the issue.

 

#define SCB_SHCSR (*((volatile unsigned long*) 0xE000ED24))    //System handler control and state register

 

void MemManage_Handler(void) 
{
   __asm(
      "MOV R4, 0x77777777\n\t"
      "MOV R5, 0x77777777\n\t"
   );
}

 

void HardFault_Handler(void)
{
   __asm(
      "MOV R4, 0x77777777\n\t"
      "MOV R5, 0x77777777\n\t"
   );
}

int main(void)
{
   SCB_SHCSR = 0x00010000;                // enable MemManage Fault

   __asm(
      "LDR R0, =0xE0100000\n\t"
      "MOV R1, 0x77777777\n\t"
      "STR R1, [R0,#0]"
   );
   return (1);
}

void SystemInit(void)
{}

 

So, 0xE0100000 is an illegal memory location and does not allow to read/write. But in main function I am writing at that location but it does not generate any fault i.e. MemManage or hardfault handler is not executed. Why is that?

It does however shows this error message: *** error 65: access violation at 0xE0100000 : no 'write' permission.

Outcomes