The chip used is s32k312, with the compiler version being S32DS3.5 and RTD3.0. During the production of uds-boot, some valid information is fixed in pflash at address 0x0043E000.
Program the bootloader into the chip, and then flash the app program via the host computer. After the first flash, you can use the internal watchdog timeout reset to ensure the program correctly enters the app. However, when the program is running in the app and another app flash operation is performed, the program enters the HardFault_Handler after resetting. Please help me check if there is a configuration issue, or if there is a standard configuration method. As long as the information is not fixed in p_flash, but instead written to 0x0043E000 through instructions later, the program can run normally.
Thank you very much for your support.
Do you use RTD drivers?
The INFLS MCAL driver includes a feature that allows relocating code to SRAM:
If you use the C40_Ip driver, refer to this example:
https://community.nxp.com/t5/S32K-Knowledge-Base/S32K312-C40-Ip-SRAM-RTD-500-DS35/ta-p/2074245
Regards,
Daniel
These codes are indeed stored in the same block0 area, specifically the block0 area of the s32k312, with effective addresses ranging from 0x00400000 to 0x00500000. However, if they are not fixed and instead written through p_flash programming operations in the program later on, the HardFault_Handler will not appear. It's similar to the following.
Hi @sensen_1,
This is probably due to an RWW (Read-While-Write) collision on the flash block.
The executed code must not reside in the flash block that is currently being programmed.
Can you confirm if this is the issue?
Regards,
Daniel