assert:add a Kconfig option to limit binfile size

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-01-31 19:50:22 +08:00 committed by Xiang Xiao
parent e6b204f438
commit 8a80c6ab28
2 changed files with 15 additions and 0 deletions

View File

@ -631,6 +631,15 @@ config DEBUG_ASSERTIONS
set CONFIG_DEBUG_ASSERTIONS=y during debug, but disable the
assertions on a final, buckled up system.
config DEBUG_ASSERTIONS_EXPRESSION
bool "Enable Debug Assertions show expression"
default n
depends on DEBUG_ASSERTIONS
---help---
This option can display the content information of the ASSERT()
function when it is triggered. This option maybe will take up a lot
of space.
comment "Subsystem Debug Options"
config DEBUG_AUDIO

View File

@ -48,8 +48,14 @@
#endif
#define PANIC() __assert(__FILE__, __LINE__, "panic")
#ifdef CONFIG_DEBUG_ASSERTIONS_EXPRESSION
#define ASSERT(f) do { if (!(f)) __assert(__FILE__, __LINE__, #f); } while (0)
#define VERIFY(f) do { if ((f) < 0) __assert(__FILE__, __LINE__, #f); } while (0)
#else
#define ASSERT(f) do { if (!(f)) __assert(__FILE__, __LINE__, "unknown"); } while (0)
#define VERIFY(f) do { if ((f) < 0) __assert(__FILE__, __LINE__, "unknown"); } while (0)
#endif
#ifdef CONFIG_DEBUG_ASSERTIONS
# define DEBUGPANIC() PANIC()