1# Copyright (c) 2016 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4config ZEPHYR_SEGGER_MODULE
5	bool
6
7config HAS_SEGGER_RTT
8	bool
9	help
10	  Indicates that the platform supports SEGGER J-Link RTT.
11
12config USE_SEGGER_RTT
13	bool "SEGGER RTT libraries."
14	depends on HAS_SEGGER_RTT
15	select STM32_ENABLE_DEBUG_SLEEP_STOP if SOC_FAMILY_STM32
16	help
17	  Enable Segger J-Link RTT libraries for platforms that support it.
18	  Selection of this option enables use of RTT for various subsystems.
19	  Note that by enabling this option, RTT buffers consume more RAM.
20
21if USE_SEGGER_RTT
22
23config SEGGER_RTT_CUSTOM_LOCKING
24	bool "Custom locking"
25	help
26	  Enable custom locking using Zephyr APIs.
27
28config SEGGER_RTT_CB_ALIGNMENT
29	int "Alignment of the RTT control block"
30	default 16
31	help
32	  Specify the alignment of the RTT control block in memory. The default
33	  alignment of 16 bytes is chosen because PyOCD fails to discover blocks
34	  where the 16 byte `acID` field falls across a 32 byte boundary.
35
36config SEGGER_RTT_MAX_NUM_UP_BUFFERS
37	int "Maximum number of up-buffers"
38	default 3
39
40config SEGGER_RTT_MAX_NUM_DOWN_BUFFERS
41	int "Maximum number of down-buffers"
42	default 3
43
44config SEGGER_RTT_BUFFER_SIZE_UP
45	int "Size of the buffer for terminal output of target, up to host"
46	default 1024
47
48config SEGGER_RTT_BUFFER_SIZE_DOWN
49	int "Size of the buffer for terminal input of target, from host"
50	default 16
51
52config SEGGER_RTT_PRINTF_BUFFER_SIZE
53	int "Size of buffer for RTT printf to bulk-send chars via RTT"
54	default 64
55
56choice SEGGER_RTT_MODE
57	prompt "Mode for pre-initialized terminal channel (buffer 0)"
58	default SEGGER_RTT_MODE_NO_BLOCK_SKIP
59
60config SEGGER_RTT_MODE_NO_BLOCK_SKIP
61	bool "Skip. Do not block, output nothing."
62
63config SEGGER_RTT_MODE_NO_BLOCK_TRIM
64	bool "Trim: Do not block, output as much as fits."
65
66config SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
67	bool "Block: Wait until there is space in the buffer."
68
69endchoice
70
71config SEGGER_RTT_MODE
72	int
73	default 2 if SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
74	default 1 if SEGGER_RTT_MODE_NO_BLOCK_TRIM
75	default 0
76
77config SEGGER_RTT_MEMCPY_USE_BYTELOOP
78	bool "Use a simple byte-loop instead of standard memcpy"
79
80choice SEGGER_RTT_SECTION
81	prompt "Choose RTT data linker section"
82	default SEGGER_RTT_SECTION_CUSTOM
83
84config SEGGER_RTT_SECTION_NONE
85	bool "Place RTT data in the default linker section"
86
87config SEGGER_RTT_SECTION_DTCM
88	bool "Place RTT data in the DTCM linker section"
89
90config SEGGER_RTT_SECTION_CCM
91	bool "Place RTT data in the CCM linker section"
92
93if CPU_CORTEX_M
94
95config SEGGER_RTT_SECTION_CUSTOM
96	bool "Place RTT data in custom linker section at RAM start"
97
98config SEGGER_RTT_SECTION_CUSTOM_DTS_REGION
99	bool "Place RTT data in custom linker section defined by a memory region in DTS"
100
101endif
102
103endchoice
104
105if SEGGER_RTT_SECTION_CUSTOM || SEGGER_RTT_SECTION_CUSTOM_DTS_REGION
106
107config SEGGER_RTT_SECTION_CUSTOM_NAME
108	string "Name of RTT data custom linker section"
109	default ".rtt_buff_data"
110
111endif
112
113choice SEGGER_RTT_INIT_MODE
114	prompt "RTT Initialization mode"
115	help
116		RTT initialization function can avoid re-init of Control Block
117		if another program (e.g. bootloader) has already initialized it.
118	default SEGGER_RTT_INIT_MODE_STRONG_CHECK if SEGGER_RTT_SECTION_CUSTOM
119	default SEGGER_RTT_INIT_MODE_STRONG_CHECK
120
121config SEGGER_RTT_INIT_MODE_ALWAYS
122	bool "RTT Initialization done without conditions"
123
124config SEGGER_RTT_INIT_MODE_STRONG_CHECK
125	bool "RTT Initialization done if full check on Control Block ID fails"
126
127config SEGGER_RTT_INIT_MODE_WEAK_CHECK
128	bool "RTT Initialization done if partial check on Control Block ID fails"
129
130endchoice
131
132endif
133