diff options
-rw-r--r-- | builtin/assert.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/builtin/assert.h b/builtin/assert.h index f51ea7b57a..fb87f844ce 100644 --- a/builtin/assert.h +++ b/builtin/assert.h @@ -31,7 +31,7 @@ extern noreturn void panic_assert_fail(const char *fname, int linenum); #else /* !CONFIG_DEBUG_ASSERT_BRIEF */ extern noreturn void panic_assert_fail(const char *msg, const char *func, - const char *fname, int linenum); + const char *fname, int linenum); #define ASSERT(cond) \ do { \ if (!(cond)) \ @@ -42,11 +42,25 @@ extern noreturn void panic_assert_fail(const char *msg, const char *func, #else /* !CONFIG_DEBUG_ASSERT_REBOOTS */ -#define ASSERT(cond) \ - do { \ - if (!(cond)) \ - __asm("bkpt"); \ - __builtin_unreachable(); \ +#if defined(__arm__) +#define ARCH_SOFTWARE_BREAKPOINT __asm("bkpt") +#elif defined(__nds32__) +#define ARCH_SOFTWARE_BREAKPOINT __asm("break 0") +#elif defined(__riscv) +#define ARCH_SOFTWARE_BREAKPOINT __asm("ebreak") +#elif defined(VIF_BUILD) +/* The genvif utility compiles usb_pd_policy.c and needs an empty definition. */ +#define ARCH_SOFTWARE_BREAKPOINT +#else +#error "CONFIG_DEBUG_ASSERT_REBOOTS must be defined on this architecture" +#endif + +#define ASSERT(cond) \ + do { \ + if (!(cond)) { \ + ARCH_SOFTWARE_BREAKPOINT; \ + __builtin_unreachable(); \ + } \ } while (0) #endif /* CONFIG_DEBUG_ASSERT_REBOOTS */ |