Skip to main content
Available for a sales job
Associate II
February 10, 2019
Question

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 ?

  • February 10, 2019
  • 3 replies
  • 821 views

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.

    This topic has been closed for replies.

    3 replies

    S.Ma
    Principal
    February 10, 2019

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

    Note: F7 don't have bitbanded region.

    Tesla DeLorean
    Guru
    February 10, 2019

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

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Available for a sales job
    Associate II
    February 10, 2019

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