2015-01-03 07:11 AM
Hi, is there a general exception handler routine that can be overwritten to provide useful information when an exception occurs such as filename, line number, exception code etc.
Thanks.2015-01-03 08:40 AM
Well there's the assert() type stuff, you'd have to build the infrastructure to output the information via a USART, or SWV debug/diagnostic channel. At a failure level you could add a Hard Fault handler to output processor state at the fault. Joseph Yiu has provided some excellent examples of this online and in his books on the Cortex-Mx family.
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf(''Wrong parameters value: file %s on line %d
'', file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif