I found that after upgrading to Teensyduino 1.54 my custom hardfault handlers did not get called any more. Here's the result of my investigations for future reference.
The cause is this commit. What it does is enable exception handlers for memory, bus and usage faults. This means that these types of faults no longer default to a hardfault, therefore one needs to set up the three corresponding interrupt handlers, rather than just one.
Pre-Teensyduino 1.54:
Post-Teensyduino 1.54:
In my application the custom handler saves core dumps to the Flash memory using this library: https://github.com/adamgreen/CrashCatcher
This lets me recover the stack trace info (including source files and line numbers) through gdb, without needing to have an active debugger connection at the time of the crash.
The cause is this commit. What it does is enable exception handlers for memory, bus and usage faults. This means that these types of faults no longer default to a hardfault, therefore one needs to set up the three corresponding interrupt handlers, rather than just one.
Pre-Teensyduino 1.54:
Code:
_VectorsRam[3] = hardfault_handler_isr; // hardfaults / mem / bus / usage
Post-Teensyduino 1.54:
Code:
_VectorsRam[3] = hardfault_handler_isr; // hardfaults
_VectorsRam[4] = hardfault_handler_isr; // mem
_VectorsRam[5] = hardfault_handler_isr; // bus
_VectorsRam[6] = hardfault_handler_isr; // usage
In my application the custom handler saves core dumps to the Flash memory using this library: https://github.com/adamgreen/CrashCatcher
This lets me recover the stack trace info (including source files and line numbers) through gdb, without needing to have an active debugger connection at the time of the crash.