Skip to content

Commit 1c6db0b

Browse files
committed
Bluetooth: Controller: Reduce assertion check code size
Reduce Controller assertion check code size for ARM Cortex-M CPUs by raising undefined instruction exception. `arm-none-eabi-addr2line` commandline can be used to get the source file and line number. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 9bf5ed6 commit 1c6db0b

File tree

1 file changed

+13
-2
lines changed
  • subsys/bluetooth/controller/hal

1 file changed

+13
-2
lines changed

subsys/bluetooth/controller/hal/debug.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,19 @@ void bt_ctlr_assert_handle(char *file, uint32_t line);
2727
BT_ASSERT_MSG(cond, fmt, ##__VA_ARGS__)
2828
#endif
2929

30-
#define LL_ASSERT_ERR(cond) LL_ASSERT(cond)
31-
#define LL_ASSERT_DBG(cond) LL_ASSERT(cond)
30+
#if defined(CONFIG_CPU_CORTEX_M)
31+
#define HAL_DEBUG_LL_ASSERT(x) \
32+
do { \
33+
if (!(x)) { \
34+
__asm__ inline volatile (".inst 0xde00\n"); \
35+
} \
36+
} while (0)
37+
#else
38+
#define HAL_DEBUG_LL_ASSERT(x) LL_ASSERT(x)
39+
#endif
40+
41+
#define LL_ASSERT_ERR(cond) HAL_DEBUG_LL_ASSERT(cond)
42+
#define LL_ASSERT_DBG(cond) HAL_DEBUG_LL_ASSERT(cond)
3243

3344
#if defined(CONFIG_BT_CTLR_ASSERT_VENDOR)
3445
#define LL_ASSERT_INFO1(cond, param) \

0 commit comments

Comments
 (0)