Problem with Hardfault Handler: Exception and interrupt vectors do not appear to be set in vector table

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Problem with Hardfault Handler: Exception and interrupt vectors do not appear to be set in vector table

      I am tracing a problem with an app running on a Cortex M0 using a JLink debugger and have been trying to analyse a hard fault. Execution freezes. If I pause exceution the call stack indicates HardFaultHandler() as the last function called and a call address in the vector table. The call address is ExternalISR9 rather than the address of the HardFault_Handler ???!!!

      Segger provides HardFaultHandler code which I've compiled and linked. However when the hard fault occurs, the code is not invoked. From the Segger symbol explorer I can see where the HardFaultHandler code resides in memory. I'd expect this address to be linked by the exception handler which is the second item of the vector table. However examining the vector table in memory shows:

      @180C0
      FE E7 FE E7 FE E7 FE E7 FE E7 FE E7 FE E7 FE E7
      FE E7 FE E7 FE E7 FE E7 FE E7 FE E7 FE E7 FE E7
      FE E7 FE E7 FE E7 FE E7 FE E7 FE E7 FE E7

      ???!!!

      What might be wrong about my set-up that would prevent the vector table being correctly initialised?

      Where can I learn about how the exception vector is used to calculate the address where the ISR resides?

      Relevant files attached

      Many thanks for any help

      Rob
      Files
    • Hello,

      Thank you for your inquiry.
      Generally our HardFault handler will only be able to reconstruct the pre fault conditions if they were "intact". If the stack is broken, memory access disabled or any other issue that might interfere with restoring it will not work. To have a better understanding on what is happending before a hard fault we suggest using a trace probe if your target device supports it: segger.com/products/debug-probes/j-trace/

      plainSpeak wrote:

      What might be wrong about my set-up that would prevent the vector table being correctly initialised?

      Where can I learn about how the exception vector is used to calculate the address where the ISR resides?
      Are you using any other startup code that might overwrite the vector table?
      Can you find HardFault_Handler in your map file?
      Did you rebuild your project after including the new files?

      Best regards,
      Nino
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support contact us per e-mail.
      Alternatively our support ticketing system can be used as well: segger.com/ticket/