
QDK™
R8C/Tau-NC30
www.state-machine.com/m16c
5.6 Assertion Handling Policy in Q_onAssert()
As described in Chapter 6 of [PSiCC2], all QP components use internally assertions to detect errors
in the way application is using the QP services. You need to define how the application reacts in
case of assertion failure by providing the callback function
Q_onAssert()
. Typically, you would put
the system in fail-safe state and try to reset. It is also a good idea to log some information as to
where the assertion failed.
The following code fragment shows the
Q_onAssert()
callback for M16C/R8C. The function simply
locks all interrupts and enters a for-ever loop. This policy is only adequate for testing, but probably
is not adequate for production release.
void Q_onAssert(char const Q_ROM * const Q_ROM_VAR file, int line) {
(void)file; /* avoid compiler warning */
(void)line; /* avoid compiler warning */
QF_INT_LOCK(); /* lock the interrupts */
for (;;) { /* hang in this for-ever loop */
}
}
Copyright © Quantum Leaps, LLC. All Rights Reserved.
21 of 26
Comentarios a estos manuales