cancel
Showing results for 
Search instead for 
Did you mean: 

Writing in an Illegal memory location does not generate MM fault

Muzahir Hussain
Associate III
Posted on November 10, 2017 at 13:18

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.

&sharpdefine 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,&sharp0]'

   );

   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.

#stm32f103rb #stm32 #keil #cortex-m3 #memory-protection
4 REPLIES 4
Posted on November 10, 2017 at 16:47

>>

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

Run on real hardware not the 'simulation'

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 10, 2017 at 17:03

So, if I run it on hardware, will the interrupt handlers get executed?

Posted on November 10, 2017 at 17:53

You won't get 'error 65'

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 10, 2017 at 21:06

https://community.st.com/0D50X00009XkX8dSAF

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..