From c5db0bdafef547a572ac2b74b34f6bc9b337b7c3 Mon Sep 17 00:00:00 2001 From: Ryan Chu Date: Fri, 5 Mar 2021 15:11:41 +0100 Subject: [PATCH] samples: nrf5340: Trigger fatal error in an assertion handler Trigger BT_ASSERT with message to inform kernel when encountering an unrecoverable condition in order to dump all pending logging messages. In this change, the log level is configured by CONFIG_BT_LOG_LEVEL Signed-off-by: Ryan Chu --- samples/bluetooth/hci_rpmsg/src/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/samples/bluetooth/hci_rpmsg/src/main.c b/samples/bluetooth/hci_rpmsg/src/main.c index d328dc28718..536bbda1243 100644 --- a/samples/bluetooth/hci_rpmsg/src/main.c +++ b/samples/bluetooth/hci_rpmsg/src/main.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -30,9 +29,9 @@ #include #include -#define LOG_LEVEL LOG_LEVEL_INFO +#define BT_DBG_ENABLED 0 #define LOG_MODULE_NAME hci_rpmsg -LOG_MODULE_REGISTER(LOG_MODULE_NAME); +#include "common/log.h" static int endpoint_id; @@ -234,7 +233,7 @@ static int hci_rpmsg_send(struct net_buf *buf) #if defined(CONFIG_BT_CTLR_ASSERT_HANDLER) void bt_ctlr_assert_handle(char *file, uint32_t line) { - LOG_ERR("Controller assert in: %s at %d", file, line); + BT_ASSERT_MSG(false, "Controller assert in: %s at %d", file, line); } #endif /* CONFIG_BT_CTLR_ASSERT_HANDLER */