This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem entering custom hardfault handler

I am using SDK 14.2 in eclipse/GCC.

I have enabled HARDFAULT_HANDLER_ENABLED in sdk_config.h, hardfault_handler_gcc.c is in the project, and I also have hardfault_implementaion.c included. I have also added the DEBUG symbol to my project. 

The project compiles and runs, but doesn't enter my own "Hardfault_c_handler()".

I haven't changed hardfault_handler_gcc.c. My Hardfault_c_handler (called from "HardFault_Handler()" in hardfault_handler_gcc.c) just calls "HardFault_process()".

In "HardFault_process()" I simply turn on an LED and sit in a a "while(1) {}". 

However, when I cause a hardfault with "hardfault_genhf_invalid_fp();" in main, the processor restarts and doesn't sit in my custom hardfault handler. What am I missing to make the program use my hardfault handler. 

Parents Reply
  • So it seems like you have stumbled upon the bug that my colleague Vidar is talking about in the other case. As he says, there is no bug fix yet, but "this problem only seems to occur when some specific condition(s) are met, I haven't experienced it before I tried hardfault_genhf_invalid_fp() that branches to address 0. So the fault exception should be forwarded to the application in most cases." I.e. it sounds like this is mostly a problem when using hardfault_genhf_invalid_fp().

Children
No Data
Related