From cc8b56322bb04569a5adf944774b16862782c95b Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Tue, 18 Apr 2017 15:16:05 +0100 Subject: Add `ENABLE_ASSERTIONS` build option Add the new build option `ENABLE_ASSERTIONS` that controls whether or not assert functions are compiled out. It defaults to 1 for debug builds and to 0 for release builds. Additionally, a following patch will be done to allow this build option to hide auxiliary code used for the checks done in an `assert()`. This code is is currently under the DEBUG build flag. Assert messages are now only printed if LOG_LEVEL >= LOG_LEVEL_INFO, which is the default for debug builds. This patch also updates the User Guide. Change-Id: I1401530b56bab25561bb0f274529f1d12c5263bc Signed-off-by: Antonio Nino Diaz --- common/aarch32/debug.S | 6 ++++++ common/aarch64/debug.S | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'common') diff --git a/common/aarch32/debug.S b/common/aarch32/debug.S index 77298a12..bafce7ce 100644 --- a/common/aarch32/debug.S +++ b/common/aarch32/debug.S @@ -107,6 +107,11 @@ assert_msg2: * --------------------------------------------------------------------------- */ func asm_assert +#if LOG_LEVEL >= LOG_LEVEL_INFO + /* + * Only print the output if LOG_LEVEL is higher or equal to + * LOG_LEVEL_INFO, which is the default value for builds with DEBUG=1. + */ /* Stash the parameters already in r0 and r1 */ mov r5, r0 mov r6, r1 @@ -147,6 +152,7 @@ dec_print_loop: bl plat_crash_console_flush 1: +#endif /* LOG_LEVEL >= LOG_LEVEL_INFO */ no_ret plat_panic_handler endfunc asm_assert #endif diff --git a/common/aarch64/debug.S b/common/aarch64/debug.S index fb6924ea..3d8e0f41 100644 --- a/common/aarch64/debug.S +++ b/common/aarch64/debug.S @@ -78,6 +78,11 @@ dec_print_loop: * --------------------------------------------------------------------------- */ func asm_assert +#if LOG_LEVEL >= LOG_LEVEL_INFO + /* + * Only print the output if LOG_LEVEL is higher or equal to + * LOG_LEVEL_INFO, which is the default value for builds with DEBUG=1. + */ mov x5, x0 mov x6, x1 /* Ensure the console is initialized */ @@ -98,6 +103,7 @@ func asm_assert asm_print_line_dec bl plat_crash_console_flush _assert_loop: +#endif /* LOG_LEVEL >= LOG_LEVEL_INFO */ no_ret plat_panic_handler endfunc asm_assert #endif -- cgit v1.2.3