__ASSERT - transfer to error handler

Skøien, Kristoffer <Kristoffer.Skoien@...>

Current implementation:

The __ASSERT macro is extensively used in the Zephyr codebase and in application code for debugging during development.

In case of an ASSERT, the code jumps to __ASSERT_POST which spins the given thread in a while(1).



During development and debugging, simply looping the thread will mask that the ASSERT has triggered. The only feedback the user gets of an assert is a printout.

This can be missed if e.g.:

- The RTT or Serial debug interface is down or unused

- There is too much logging so that the “ASSERTION FAIL” can be missed


Proposed solution:

In __ASSERT_POST provide a function call that will end up a user definable error handler. E.g. _SysFatalErrorHandler


This will let the developer set given SOC pins in case of an ASSERT, ask for a specific LED pattern to be set or print further debug messages.


Feedback is appreciated.


Kind regards


Join devel@lists.zephyrproject.org to automatically receive all group messages.