From e04e4c27e8359af2a9632e7202158bf2682f0b25 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 20 Dec 2019 15:42:38 +0100 Subject: [PATCH] kernel: panic: Option ASSERT_NO_FILE_INFO controls panic or oops print Use option ASSERT_NO_FILE_INFO to control panic or oops location print. The cause of the exception can be backtraced using the stackframe instead, which would give the user a way to reduce the footprint of the panic implementation. Signed-off-by: Joakim Andersson --- include/kernel.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/kernel.h b/include/kernel.h index 1ec67129cdf..c16d583d975 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -4930,6 +4930,12 @@ extern void z_sys_power_save_idle_exit(s32_t ticks); #define z_except_reason(reason) ARCH_EXCEPT(reason) #else +#if !defined(CONFIG_ASSERT_NO_FILE_INFO) +#define __EXCEPT_LOC() __ASSERT_PRINT("@ %s:%d\n", __FILE__, __LINE__) +#else +#define __EXCEPT_LOC() +#endif + /* NOTE: This is the implementation for arches that do not implement * ARCH_EXCEPT() to generate a real CPU exception. * @@ -4938,7 +4944,7 @@ extern void z_sys_power_save_idle_exit(s32_t ticks); * the fatal error handler. */ #define z_except_reason(reason) do { \ - printk("@ %s:%d:\n", __FILE__, __LINE__); \ + __EXCEPT_LOC(); \ z_fatal_error(reason, NULL); \ } while (false)