HardFault Handler

I am dealing with a HardFault occuring in my code, and I am unable to trace the error. The output when the HardFault occurs is <error> hardfault: HARD FAULT at 0xD0D0D02A
<error> hardfault: R0: 0x20007A8C R1: 0x00000000 R2: 0x00000000 R3: 0x20007ACF
<error> hardfault: R12: 0x20007A8C LR: 0x00044343 PSR: 0x61000000
<error> hardfault: Cause: The processor has attempted to execute an undefined instruction.

The address of 0xD0D0D02A is garbage code.

Parents Reply
  • I enter the LR address (0x00044343) into the memory search and my Segger Embedded Studio crashes. 

    That sounds like a bug in Segger embedded studio. Not sure what version you are using, but I haven't experienced this myself.

    Does not mean much. Stack based buffer overflow can also destroy the LR saved on the stack - we have no idea if that value was vaild or not.

    I didn't suspect a stack buffer overrun in this case because it's only the stacked PC value that is obviously corrupted, so I think checking the LR or inspecting the full call stack is a good first step.

Children
Related