title: ARM Cortex M3 How do I determine the program counter value before a hard fault?
body: <p>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 the PC value from before the hard fault and store it for later debugging in the battery backed region.</p>
  
  <p>How would I determine the value of the program counter at the point of the hard fault? Obviously, the PC is now set to its location within the hardfault interrupt.</p>
  
  <p>Where should I look? It there an address for the normal mode register bank?</p>
  
  <p>Thanks!</p>