3 Restore crash scene by dumping memory;

3.1 Dump memory method;

Refer to;Chapter;5.8 Dump memory method;dumpCrash;Memory;Scene;

3.2 Method of automatically restoring crash scene with Trace32;

Refer to;Chapter;[6.1 Use Trace32 to restore Hcpu crash scene;](…/tools/trace32.md/#61-用trace32Restore;hcpuCrash scene;)

3.3 Method of manually restoring crash scene with Trace32;

If automatic recovery fails, manually enter register values based on the crash scene to restore it;
Interrupt function when an interrupt occurs (hardfault is also an interrupt);:

HardFault_Handler->rt_hw_hard_fault_exception->handle_exception

Function;内会把Register;R0-R4,R12,R14(LR),PCStack push;到saved_stack_framesaved_stack_pointer变量中,
alt text

The stacked registers can be seen in Figure 2 below;,如下Figure;一的Crash scene;,Address;0x20054998上是R0,Address;0x200549AC是LR,Address;0x200549B0是PC:0x10CD6602,
Register PC: stores the program PC pointer before the crash;
Register LR: stores the program pointer to return after execution;
These registers can be used to restore the crash scene;,
The global variable saved_stack_pointer stores the base address of the stack;
The global variable saved_stack_frame stores the data that was pushed onto the stack;

alt text

alt text