Add a panic() function
- Oct 05, 2019
-
-
rahix authored
Unify unrecoverable errors to use panic() in all cases. This will allow further changes to panic() to work for all critical errors. Signed-off-by:
Rahix <rahix@rahix.de>
-
rahix authored
Newlib assert uses __assert_func and thus our panic() function while MXC_ASSERT uses a custom assertion logic. Newlib assert is also more portable as it works in expression position while MXC_ASSERT only works as a statement. Signed-off-by:
Rahix <rahix@rahix.de>
-
rahix authored
Define `__assert_func()` so a failing `assert()` will trigger a panic. Signed-off-by:
Rahix <rahix@rahix.de>
-
rahix authored
In unrecoverable situations we should provide a common way to output the cause of the error and then reset the CPU. The panic() function is mean to be exactly that. It outputs the error-cause, stack-trace, and firmware revision, accompanied by a link to the issue-tracker to encourage people to report the error. After a timeout of ~1.5s it resets the CPU and reboots. Future Work: - Right now, the stack-trace only has a depth of one which is the return address from where panic() was called. In the future it might make sense to provide a deeper stack-trace if a robust implementation is possible. - Integration of @msgctl's faultscreen (!79) so users who don't have the serial console open at all times can also see what happened. Signed-off-by:
Rahix <rahix@rahix.de>
-
rahix authored
In severe error conditions, asynchronous prints will never work. For such cases we need a way to make prints happen synchronously again, the same way it works during early boot. Add a serial_return_to_synchronous() function which unconditionally switches the serial driver code to synchronous mode. Only use this function in unrecoverable error conditions! Signed-off-by:
Rahix <rahix@rahix.de>
-
rahix authored
card10_reset() won't ever return to where it was called from. Telling the compiler this can help with program-flow analysis. Signed-off-by:
Rahix <rahix@rahix.de>
-