From c9a9a5901b4f04d74e6d5bc7b937dc17f86de909 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 27 Jun 2023 17:02:35 +0200 Subject: [PATCH 1/2] core/lib: do not use DEBUG_BREAKPOINT by default --- core/lib/assert.c | 4 ++++ core/lib/include/assert.h | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/core/lib/assert.c b/core/lib/assert.c index e8b27723d8..002aed0bda 100644 --- a/core/lib/assert.c +++ b/core/lib/assert.c @@ -31,7 +31,9 @@ __NORETURN void _assert_failure(const char *file, unsigned line) printf("failed assertion. Backtrace:\n"); backtrace_print(); #endif +#ifdef DEBUG_ASSERT_BREAKPOINT DEBUG_BREAKPOINT(1); +#endif core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION."); } @@ -41,7 +43,9 @@ __NORETURN void _assert_panic(void) #if IS_USED(MODULE_BACKTRACE) backtrace_print(); #endif +#ifdef DEBUG_ASSERT_BREAKPOINT DEBUG_BREAKPOINT(1); +#endif core_panic(PANIC_ASSERT_FAIL, "FAILED ASSERTION."); } diff --git a/core/lib/include/assert.h b/core/lib/include/assert.h index 1307ba3ce8..55bfd29386 100644 --- a/core/lib/include/assert.h +++ b/core/lib/include/assert.h @@ -44,6 +44,20 @@ extern "C" { * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #define DEBUG_ASSERT_VERBOSE + +/** + * @brief Activate breakpoints for @ref assert() when defined + * + * Without this macro defined the @ref assert() macro will just print some + * information about the failed assertion, see @ref assert and + * @ref DEBUG_ASSERT_VERBOSE. + * If @ref DEBUG_ASSERT_BREAKPOINT is defined, the execution will stop on a + * failed assertion instead of producing the output. If the architecture + * defines the macro @ref DEBUG_BREAKPOINT, a breakpoint is inserted and the + * execution is stopped directly in the debugger. Otherwise the execution stops + * in an endless while loop. + */ +#define DEBUG_ASSERT_BREAKPOINT #else /* we should not include custom headers in standard headers */ #define _likely(x) __builtin_expect((uintptr_t)(x), 1) @@ -112,6 +126,12 @@ __NORETURN void _assert_failure(const char *file, unsigned line); * If the `backtrace` module is enabled (and implemented for architecture in use) * a backtrace will be printed in addition to the location of the failed assertion. * + * If @ref DEBUG_ASSERT_BREAKPOINT is defined, the execution will stop on a + * failed assertion instead of producing the above output. If the architecture + * defines the macro @ref DEBUG_BREAKPOINT, a breakpoint is inserted and the + * execution is stopped directly in the debugger. Otherwise the execution stops + * in an endless while loop. + * * @see http://pubs.opengroup.org/onlinepubs/9699919799/functions/assert.html */ #define assert(cond) (_likely(cond) ? (void)0 : _assert_failure(__FILE__, __LINE__)) From 6eb358bfee77aaa82893b48e6b119a517338680c Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Wed, 28 Jun 2023 11:39:08 +0200 Subject: [PATCH 2/2] tests/sys/sema_inv: boards with insufficient RAM --- tests/sys/sema_inv/Makefile.ci | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sys/sema_inv/Makefile.ci b/tests/sys/sema_inv/Makefile.ci index 90da2e6a7a..29b1d9aae2 100644 --- a/tests/sys/sema_inv/Makefile.ci +++ b/tests/sys/sema_inv/Makefile.ci @@ -1,5 +1,9 @@ BOARD_INSUFFICIENT_MEMORY := \ + arduino-duemilanove \ + arduino-nano \ + arduino-uno \ atmega328p \ + atmega328p-xplained-mini \ nucleo-f031k6 \ nucleo-l011k4 \ #