cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding HARD FAULT traps. Does the STM32 (or cortex cpus in general) have any kind of memory region that is read-only, and does not issue a hard fault when written to ?

The intend is to detect whether an array (size 256 bytes) is present in RAM at a location pointed to, and does not trap a HARDFAULT when the pointer written to it. A subsequent read from the same location should produce a value different from the value written. E.g. the complement or a value from a constant table. So a sequence such as :

typedef char barray[256];

char *ptr = /* a pointer from an array of pointers to barrays */ ;

*ptr = 0x55;

printf (*ptr == 0x55 ? "That RAM !" : "That's NOT RAM");

result in the result being printed without causing a HARD FAULT;

Further the HARDFAULT mechanism should not be disabled, so that it will still trap a HARDFAULT for other unwritable memory regions. If have considered the bitbanded memory space for this.

3 REPLIES 3
S.Ma
Principal

Read-only region is the FLASH area, or its chip ID region.

Note: F7 don't have bitbanded region.

Could you use the MPU and manage the handling in a memory manager fault?​

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

No memory manager in a F103C8T6 , or does it have ?