Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
zassert.h File Reference

Zephyrs assertion framework. More...

#include <stdarg.h>
#include <zephyr/sys/util_macro.h>
#include <zephyr/toolchain.h>

Go to the source code of this file.

Macros

#define ZASSERT_LEVEL_OFF   0
 Assertions are disabled and compiled out.
#define ZASSERT_LEVEL_TERSE   1
 Assertions are checked; No additional information is reported.
#define ZASSERT_LEVEL_NORMAL   2
 Assertions are checked; only the failing location is reported.
#define ZASSERT_LEVEL_VERBOSE   3
 Assertions are checked; condition, location and message are reported.
#define ZASSERT_TERSE(_test, ...)
 Assertion that reports only a fixed banner (no location or message).
#define ZASSERT_NORMAL(_test, ...)
 Assertion that reports only the failing location.
#define ZASSERT_VERBOSE(_test, ...)
 Assertion that reports the condition, location and optional message.
#define ZASSERT_MODULE(...)
 Select the Kconfig-defined assertion module used by ZASSERT() in this file.
#define ZASSERT(_test, ...)
 Module-aware assertion.

Functions

FUNC_NORETURN void zassert_fail (const char *cond, const char *file, unsigned int line, const char *fmt,...)
 Report a failed assertion and take terminal action.
FUNC_NORETURN void zassert_post_action (const char *file, unsigned int line)
 Terminal action taken on assertion failure.
void zassert_vprint (const char *fmt, va_list ap)
 Emit assertion text (va_list form).
static void zassert_print (const char *fmt,...)
 Emit assertion text (printf like), routed through zassert_vprint().

Detailed Description

Zephyrs assertion framework.

The assertion framework provides a mechanism for checking conditions at runtime and reporting failures in a structured way. It allows for module-based assertion levels, enabling developers to control the verbosity and behavior of assertions on a per-module basis.

The framework also supports custom handling of assertion failures, allowing developers to override the default behavior and implement their own reporting and recovery/crash mechanism.