Re: Debugging unhandled exception.
Posted: Thu Mar 16, 2017 2:56 pm
Sorry to be digging up an old thread, but I'm having trouble debugging unhandled exceptions and perhaps someone can help.
Observation: as soon as I change any of the aliases (that all point to the same _unhandled_exception function) then the program no longer works. It gets stuck in the _unhandled_exception trap as soon as I continue from the ResetHandler using the debugger. I have not been able to find an instruction that is executed before it goes into error mode.
What I did was the following modifications to vectors.c:
If I try defining some of the error functions, instead of using the alias declarations, like ulikoehler suggested, I get a different but similar issue. The debugger gets stuck in the __DSB(); function of NVIC_SystemReset() and blocks indefinitely.
Using ChibiOS 3.0.2
Does someone have an idea what might be going wrong?
Observation: as soon as I change any of the aliases (that all point to the same _unhandled_exception function) then the program no longer works. It gets stuck in the _unhandled_exception trap as soon as I continue from the ResetHandler using the debugger. I have not been able to find an instruction that is executed before it goes into error mode.
What I did was the following modifications to vectors.c:
Code: Select all
/**
* @brief Unhandled exceptions handler.
* @details Any undefined exception vector points to this function by default.
* This function simply stops the system into an infinite loop.
*
* @notapi
*/
/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
void _unhandled_exception(void) {
/*lint -restore*/
while (true) {
}
}
/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
void _hard_fault(void) {
/*lint -restore*/
while (true) {
}
}
void Reset_Handler(void) __attribute__((weak, alias("_unhandled_exception")));
void NMI_Handler(void) __attribute__((weak, alias("_unhandled_exception")));
//void HardFault_Handler(void) __attribute__((weak, alias("_unhandled_exception")));
void HardFault_Handler(void) __attribute__((weak, alias("_hard_fault")));
void MemManage_Handler(void) __attribute__((weak, alias("_unhandled_exception")));
void BusFault_Handler(void) __attribute__((weak, alias("_unhandled_exception")));
void UsageFault_Handler(void) __attribute__((weak, alias("_unhandled_exception")));
If I try defining some of the error functions, instead of using the alias declarations, like ulikoehler suggested, I get a different but similar issue. The debugger gets stuck in the __DSB(); function of NVIC_SystemReset() and blocks indefinitely.
Using ChibiOS 3.0.2
Does someone have an idea what might be going wrong?