Carving out HardFault error storage location in high RAM via linker script
STM32CubeIDE Version: 1.12 & STM32G0B0RE
We have had a HardFault error in the field and wanted to use an old technique of storing the info in RAM until after the micro is reset and more stable and then move it into flash. We used the STM32G0B0RETX_FLASH.ld file and modified two spots:
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 143K
RAM_FOR_FAULT (rw) : ORIGIN = 0x20023C00, LENGTH = 1K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 502K
...
}
and
.faultData :
{
. = ALIGN(4);
__faultData_start__ = .;
*faultData.o (.text .text*)
__faultData_end__ = .;
. = ALIGN(4); */
} > RAM_FOR_FAULT /* new RAM for hard faults */
ASSERT( LENGTH(RAM_FOR_FAULT) >= (__faultData_end__ - __faultData_start__), "faultData overflowed !")
Cube's IDE show the sections seems to work:
But once the debugger is loaded there seems to be a lot of random data around the 0x20033C00 memory spot:
Could the stack still be using the chips high RAM address or is there something else we need to do to isolate the highest 1K of RAM?
Thanks...
