From 97b34a18692c31cc45e6ce2c821727074ebe16d2 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 17 Jun 2022 12:15:29 +0300 Subject: [PATCH] zephyr: panic: switch to __ASSERT_NO_MSG() for assert() Continue the changes done in commit bc39c0e91284 ("Make Zephyr build compatible with optional assert() with __unused") and switch to use __ASSERT_NO_MSG() as implementation of assert() when SOF is build with Zephyr. This allows for build time control of asserts with standard CONFIG_ASSERT option(s) and ensures same policy is used for asserts in both Zephyr and SOF code. This effectively disables assert checks in the default build for Zephyr, improves performance of a typical single ll scheduled audio component by 0.08 MCPS. Performance was tested with the Intel Tiger Lake system, build with XCC 12.0.8 as defined in sof/scripts/xtensa-build-zephyr.py. Signed-off-by: Kai Vehmanen --- src/include/sof/debug/panic.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/include/sof/debug/panic.h b/src/include/sof/debug/panic.h index 66921edfb..ac5078a34 100644 --- a/src/include/sof/debug/panic.h +++ b/src/include/sof/debug/panic.h @@ -34,11 +34,8 @@ void panic_dump(uint32_t p, struct sof_ipc_panic_info *panic_info, #include #define panic(x) k_panic() -#define assert(x) \ - do { \ - if (!(x)) \ - k_oops();\ - } while (0) +#define assert(x) __ASSERT_NO_MSG(x) + /* To print the asserted expression on failure: * #define assert(x) __ASSERT(x, #x) */