ARM Cortex M3 How do I determine the program counter value before a hard fault?

前端 未结 5 1202
醉话见心
醉话见心 2020-12-28 23:27

I have an embedded project using a STM32F103 (ARM Cortex M3), it is getting a occasionally getting hard fault in release mode. As part of recovery, I would like to retrieve

5条回答
  •  再見小時候
    2020-12-29 00:28

    You should look into the ARM Architecture Reference Manual in the section on Exceptions. You need to register to get it.

    Typically a relevant address will be put in the link register LR (R14), but the precise meaning varies according to the exception, and there are varying offsets.

    W.r.t. accessing the User/System mode register bank, I think you need to switch the mode to access it.

提交回复
热议问题