Hello, I'm encountering an issue with my project and would appreciate your assistance.
We are using the S32K312 chip and have adopted the official startup code provided with EB tools. The problem occurs when the program executes the MemAcc_Init function: this function calls MemFls_Init, but the program immediately enters the fault handler. The root cause appears to be an exception related to an unloaded global configuration variable.
Specifically, this global configuration variable maps the symbol address of MemFls_Init to an initialization pointer (InitPtr). When the fault occurs, the ConfigPtr (which points to this global configuration variable) becomes 0x0 (as shown in the call stack in Figures 1 and 2). Consequently, accessing InitPtr within this function attempts to dereference a null pointer, and the Program Counter (PC) trying to access address 0x0 triggers the fault interrupt.
Notably, the global array gunFlsInitAddress—which I added to track values—also shows all zeros during the fault. This confirms that the entire memory region storing these pointers remains uninitialized to 0x0. In contrast, Figure 3 shows the normal state of gunFlsInitAddress, where elements 2 to 4 contain the value 4693161 (hex: 0x479CA9), which corresponds to the correct address of MemFls_Init.
To further investigate, I used the T32 tool to dump memory blocks (Figures 4 and 5). The left panel (ROM) shows valid data, including the expected 0x479CA9 values, while the right panel (RAM) shows all 0x00 values during the fault—indicating a failure to properly load data from ROM to RAM.





I have attempted troubleshooting steps including:
- Modifying the linker script (.ld file) to relocate the sector containing the initialization configuration structure to other memory regions.
- Disabling the Cache functionality.
However, the exception persists. I would greatly appreciate any insights into identifying the root cause.