This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new d1be53e748 drivers/segger: make RTT_MODE configurable
d1be53e748 is described below

commit d1be53e748098e87e0f1637c8cd73d5fe1565bf2
Author: Xu Xingliang <xuxingli...@xiaomi.com>
AuthorDate: Sun Nov 13 20:45:17 2022 +0800

    drivers/segger: make RTT_MODE configurable
    
    CHAMPION-2373
    
    To allow use NO_BLOCK mode, so the system keeps running when debugger 
disconnected.
    
    Signed-off-by: Xu Xingliang <xuxingli...@xiaomi.com>
---
 drivers/segger/Kconfig                  | 15 +++++++++++++++
 drivers/segger/config/SEGGER_RTT_Conf.h |  8 +++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/segger/Kconfig b/drivers/segger/Kconfig
index faaf58ff24..88ebbbec89 100644
--- a/drivers/segger/Kconfig
+++ b/drivers/segger/Kconfig
@@ -62,6 +62,21 @@ config SEGGER_RTT_BUFFER_SIZE_DOWN
        ---help---
                Size of the buffer for terminal input to target from host 
(Usually keyboard input)
 
+choice
+       prompt "SEGGER_RTT_MODE"
+       default SEGGER_RTT_MODE_NO_BLOCK_SKIP
+
+config SEGGER_RTT_MODE_NO_BLOCK_SKIP
+       bool "Skip. Do not block, output nothing. (Default)"
+
+config SEGGER_RTT_MODE_NO_BLOCK_TRIM
+       bool "Trim: Do not block, output as much as fits."
+
+config SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
+       bool "Block: Wait until there is space in the buffer."
+
+endchoice # SEGGER_RTT_MODE
+
 if SEGGER_SYSVIEW
 
 config SEGGER_SYSVIEW_RTT_BUFFER_SIZE
diff --git a/drivers/segger/config/SEGGER_RTT_Conf.h 
b/drivers/segger/config/SEGGER_RTT_Conf.h
index a336ab0bda..a84bab9e4e 100644
--- a/drivers/segger/config/SEGGER_RTT_Conf.h
+++ b/drivers/segger/config/SEGGER_RTT_Conf.h
@@ -63,7 +63,13 @@
 
 /* Mode for pre-initialized terminal channel */
 
-#define SEGGER_RTT_MODE_DEFAULT         SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
+#if defined(CONFIG_SEGGER_RTT_MODE_NO_BLOCK_TRIM)
+#  define SEGGER_RTT_MODE_DEFAULT       SEGGER_RTT_MODE_NO_BLOCK_TRIM
+#elif defined(SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL)
+#  define SEGGER_RTT_MODE_DEFAULT       SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
+#else
+#  define SEGGER_RTT_MODE_DEFAULT       SEGGER_RTT_MODE_NO_BLOCK_SKIP
+#endif
 
 /* 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop */
 

Reply via email to