A program can exit normally at the end of main() or
it can exit prematurely because of an error.
The behavior of the assert macro depends
on the conditions in operation at the most recent occurrence of #include
<assert.h>:
If the NDEBUG macro is defined (on the
command line or as part of a source file), the assert macro
has no effect.
If the NDEBUG macro is not defined,
the assert expression (the expression given to
the assert macro) is evaluated. If the result
is TRUE, that is != 0, the assert macro
has no more effect.
If the assert expression evaluates
to FALSE, the assert macro
calls the __aeabi_assert() function if any
of the following are true:
you are
compiling with --strict
you are using -O0 or -O1
you are compiling with --library_interface=aeabi_clib or --library_interface=aeabi_glibc
__ASSERT_MSG is defined
_AEABI_PORTABILITY_LEVEL is defined
and not 0.
If the assert expression evaluates
to FALSE and the conditions specified in point
3 do not apply, the assert macro calls abort().
Then:
abort() calls __rt_raise().
If __rt_raise() returns, abort() tries
to finalize the library.
If you are creating an application that does not use the library, __aeabi_assert() works
if you re-implement abort() and the stdio functions.
Another solution for retargeting is to re-implement the __aeabi_assert() function
itself. The function prototype is:
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.