The __ASSERT macro is extensively used in the Zephyr code base 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
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.