Hardfault Dump User Guide
Hardfault Dump to Flash
The SDK supports the function of dumping to flash after encountering a Hardfault during code execution. You can use the interface set_crash_dump_info(uint32_t crash_dump_addr, uint32_t crash_dump_size). This function is declared in the header file platform_ext.h. When using it, simply enter the starting address and size you wish to dump.
Currently, all RAM is supported for dumping, and whether to dump DSP share RAM is decided based on the DSP status.
RTL8763E Series:
-
If you want to dump everything, the size should be set to 580KB:
ITCM1_SIZE+DTCM0_SIZE+DTCM1_SIZE+EXT0_SIZE+DSP_SHM_SIZE
116+48+60+46+308 = 578
Aligned to 4k, 580KB
-
If flash is insufficient, it can be reduced to 352KB:
ITCM1_SIZE+DTCM0_SIZE+DTCM1_SIZE+EXT0_SIZE+80K
116+48+60+46+80 = 350
4K aligned, 352KB
RTL8773E Series:
-
If it is desired to dump everything, the size should be set to 800KB:
ITCM1_SIZE+DTCM0_SIZE+DTCM1_SIZE+EXT0_SIZE+DSP_SHM_SIZE
128+64+224+64+320 = 800
4K aligned, 800KB
-
If the flash is not enough, it can be reduced to 560KB:
ITCM1_SIZE+DTCM0_SIZE+DTCM1_SIZE+EXT0_SIZE+80K
128+64+224+64+80 = 560
4K aligned, 560KB
Note
MPPGTool-v6.2.83.2_Watch and subsequent versions support dumping flash, allowing configuration of addresses and sizes to be read back; Hardfault records are stored in
ReadbackFlash0.bin.DebugAnalyzer-v4.0.0.29 and subsequent versions support reverse parsing of real-time log files after dumping by selecting Decode From File, checking Parse Flash Log, and clicking Start.
If manually constructing Hardfaults for testing, avoid frequent triggers to prevent erasing content that has already been dumped.
Dump PSRAM After Hardfault
If you want to print PSRAM data when a Hardfault occurs, you can call the interface set_psram_dump_info(uint32_t psram_dump_addr, uint32_t psram_dump_size). This function is declared in the header file platform_ext.h, and you can fill in the starting address and size you wish to dump when using it.