From e0d38bf6a10bd9cd978a2c0761f1f9182fecbbec Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Wed, 26 Feb 2020 10:38:49 +0100 Subject: [PATCH] Bluetooth: samples: hci_uart: Add debug configuration using RTT Add debug configuration to easily enable logging through RTT. Required to use RTT since the UART is otherwise used for the h4 UART driver. Signed-off-by: Joakim Andersson --- doc/guides/debugging/probes.rst | 2 ++ samples/bluetooth/hci_uart/README.rst | 12 ++++++++++++ samples/bluetooth/hci_uart/debug.conf | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 samples/bluetooth/hci_uart/debug.conf diff --git a/doc/guides/debugging/probes.rst b/doc/guides/debugging/probes.rst index 185e72328c1..dd8ff0bb5b1 100644 --- a/doc/guides/debugging/probes.rst +++ b/doc/guides/debugging/probes.rst @@ -184,6 +184,8 @@ and debug tool. Flash and debug can be done as follows: :goals: debug +.. _jlink-rtt-debug-probe: + Using Segger J-Link ------------------- diff --git a/samples/bluetooth/hci_uart/README.rst b/samples/bluetooth/hci_uart/README.rst index 71b6e9c3a62..b2b48bf0d90 100644 --- a/samples/bluetooth/hci_uart/README.rst +++ b/samples/bluetooth/hci_uart/README.rst @@ -113,3 +113,15 @@ BlueZ loads and initializes the attached controller. Once the controller is attached follow the instructions in the :ref:`bluetooth_ctlr_bluez` section to use BlueZ with it. + +Debugging the controller +======================== + +The sample can be debugged using RTT since the UART is otherwise used by this +application. To enable debug over RTT the debug configuration file can be used. + +.. code-block:: console + + west build samples/bluetooth/hci_uart -- -DOVERLAY_CONFIG='debug.conf' + +Then attach RTT as described here: :ref:`jlink-rtt-debug-probe` diff --git a/samples/bluetooth/hci_uart/debug.conf b/samples/bluetooth/hci_uart/debug.conf new file mode 100644 index 00000000000..a8c95cee6cf --- /dev/null +++ b/samples/bluetooth/hci_uart/debug.conf @@ -0,0 +1,22 @@ +CONFIG_ASSERT=y + +CONFIG_THREAD_NAME=y +CONFIG_THREAD_ANALYZER=y +CONFIG_THREAD_ANALYZER_AUTO=y +CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y + +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_CONSOLE=y +CONFIG_BT_DEBUG_LOG=y +CONFIG_LOG_BUFFER_SIZE=4096 +CONFIG_RTT_CONSOLE=y +CONFIG_LOG_BACKEND_RTT=y +CONFIG_LOG_BACKEND_RTT_MODE_DROP=n +CONFIG_USE_SEGGER_RTT=y +CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096 +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1024 +CONFIG_LOG_STRDUP_BUF_COUNT=20 + +CONFIG_LOG_DEFAULT_LEVEL=3