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
  • I removed the accesses to soft device functions from the hardfault handler, so that is no longer an issues.

    However, "hardfault_genhf_invalid_fp();" still doesn't enter my custom hardfault handler. I have implemented a divide by zero, and that successfully enters my non-default hardfault handler. 

    Do you have any idea why "hardfault_genhf_invalid_fp();" doesn't enter my custom hardfault handler?

    Can you get "hardfault_genhf_invalid_fp();" to enter a custom hardfault handler?

Reply
  • I removed the accesses to soft device functions from the hardfault handler, so that is no longer an issues.

    However, "hardfault_genhf_invalid_fp();" still doesn't enter my custom hardfault handler. I have implemented a divide by zero, and that successfully enters my non-default hardfault handler. 

    Do you have any idea why "hardfault_genhf_invalid_fp();" doesn't enter my custom hardfault handler?

    Can you get "hardfault_genhf_invalid_fp();" to enter a custom hardfault handler?

Children
Related