Skip to main content
davidharrison9
Visitor II
January 3, 2015
Question

Is there a General Exception handler for STM32F3x series?

  • January 3, 2015
  • 1 reply
  • 626 views
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 topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    January 3, 2015
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..