Re: __ASSERT - transfer to error handler

Boie, Andrew P

It's better to call k_oops() or k_panic() than _SysFatalErrorHandler() directly. You will actually get useful information about where the error occurred, instead of having to pass in a NULL exception stack frame.




From: devel@... [mailto:devel@...] On Behalf Of Skøien, Kristoffer
Sent: Friday, November 9, 2018 12:11 AM
To: devel@...
Subject: [Zephyr-devel] __ASSERT - transfer to error handler


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 { to automatically receive all group messages.