cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a General Exception handler for STM32F3x series?

davidharrison9
Associate II
Posted on January 03, 2015 at 16:11

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.
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Posted on January 03, 2015 at 17:40

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..