1# Console driver configuration options
2
3# Copyright (c) 2014-2015 Wind River Systems, Inc.
4# Copyright (c) 2016 Cadence Design Systems, Inc.
5# SPDX-License-Identifier: Apache-2.0
6
7# Setting shared by different subsystems
8
9menuconfig CONSOLE
10	bool "Console drivers"
11
12if CONSOLE
13
14config CONSOLE_INPUT_MAX_LINE_LEN
15	int "Console maximum input line length"
16	default 128
17	help
18	  This option can be used to modify the maximum length a console input
19	  can be.
20
21config CONSOLE_HAS_DRIVER
22	bool
23	help
24	  This is an option to be enabled by console drivers to signal
25	  that some kind of console exists.
26
27config CONSOLE_HANDLER
28	bool "Console input handler"
29	depends on UART_CONSOLE && SERIAL_SUPPORT_INTERRUPT
30	select UART_INTERRUPT_DRIVEN
31	help
32	  This option enables console input handler allowing to write simple
33	  interaction between serial console and the OS.
34
35config CONSOLE_INIT_PRIORITY
36	int "Console init priority"
37	default 60 if UART_CONSOLE || XTENSA_SIM_CONSOLE
38	default KERNEL_INIT_PRIORITY_DEFAULT
39	help
40	  Console driver device initialization priority.
41
42config UART_CONSOLE
43	bool "Use UART for console"
44	depends on SERIAL && SERIAL_HAS_DRIVER
45	select CONSOLE_HAS_DRIVER
46	help
47	  Enable this option to use one UART for console.
48
49config UART_CONSOLE_DEBUG_SERVER_HOOKS
50	bool "Debug server hooks in debug console"
51	depends on UART_CONSOLE
52	help
53	  This option allows a debug server agent such as GDB to take over the
54	  handling of traffic that goes through the console logic. The debug
55	  server looks at characters received and decides to handle them itself if
56	  they are some sort of control characters, or let the regular console
57	  code handle them if they are of no special significance to it.
58
59config UART_CONSOLE_MCUMGR
60	bool "UART console mcumgr passthrough"
61	depends on UART_CONSOLE
62	help
63	  Enables the UART console to receive mcumgr frames for image upgrade
64	  and device management.  When enabled, the UART console does not
65	  process mcumgr frames, but it hands them up to a higher level module
66	  (e.g., the shell).  If unset, incoming mcumgr frames are dropped.
67
68config UART_CONSOLE_INPUT_EXPIRED
69	bool "Support for UART console input expired mechanism"
70	default y
71	depends on UART_CONSOLE && PM
72	help
73	  This option allows a notification to the power management module that
74	  the module for UART console is in use now. If the interval of console
75	  module doesn't receive any input message exceeds expired timeout, such
76	  as UART_CONSOLE_INPUT_EXPIRED_TIMEOUT, the power management module is
77	  allowed to enter sleep/deep sleep state and turn off the clock of UART
78	  console module. This mechanism gives a window in which the users can
79	  organize input message if CONFIG_PM is enabled.
80
81config UART_CONSOLE_INPUT_EXPIRED_TIMEOUT
82	int "Fixed amount of time to keep the UART console in use flag true"
83	default 15000
84	depends on UART_CONSOLE_INPUT_EXPIRED
85	help
86	  Fixed amount of time which unit is milliseconds to keep the UART
87	  console in use flag true.
88
89config JAILHOUSE_DEBUG_CONSOLE
90	bool "Use JAILHOUSE_DEBUG console"
91	select CONSOLE_HAS_DRIVER
92	depends on ARM64
93	help
94	  Emit console messages to a jailhouse hypervisor debug console.
95	  Useful in board bring-up if there aren't any working serial
96	  drivers.
97
98# Workaround for not being able to have commas in macro arguments
99DT_CHOSEN_Z_RAM_CONSOLE := zephyr,ram-console
100
101config RAM_CONSOLE
102	bool "Use RAM console"
103	select CONSOLE_HAS_DRIVER
104	select RAM_CONSOLE_BUFFER_SECTION if $(dt_chosen_enabled,$(DT_CHOSEN_Z_RAM_CONSOLE))
105	help
106	  Emit console messages to a RAM buffer "ram_console" which can
107	  be examined at runtime with a debugger. Useful in board bring-up
108	  if there aren't any working serial drivers.
109
110config RAM_CONSOLE_BUFFER_SECTION
111	bool "Use dedicated section as RAM console buffer"
112	depends on RAM_CONSOLE && $(dt_chosen_enabled,$(DT_CHOSEN_Z_RAM_CONSOLE))
113	select KERNEL_DIRECT_MAP if MMU
114	help
115	  Use a dedicated section as the RAM console buffer, whose address is
116	  known before build so that the console output messages can be easily
117	  examined by a debugger or software tool from a parallel-running OS.
118
119config RAM_CONSOLE_BUFFER_SIZE
120	int "Ram Console buffer size"
121	default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_RAM_CONSOLE)) if RAM_CONSOLE_BUFFER_SECTION
122	default 1024
123	depends on RAM_CONSOLE
124	help
125	  Total size of the RAM console buffer, to ensure it's always
126	  NULL-terminated leave one byte unused, the actual length is
127	  one byte less. Messages will wrap around if the actual length
128	  is exceeded.
129
130config RTT_CONSOLE
131	bool "Use RTT console"
132	depends on USE_SEGGER_RTT
133	select CONSOLE_HAS_DRIVER
134	help
135	  Emit console messages to a RAM buffer that is then read by the
136	  Segger J-Link software and displayed on a computer in real-time.
137	  Requires support for Segger J-Link on the companion IC onboard.
138
139if RTT_CONSOLE
140
141config RTT_TX_RETRY_CNT
142	int "Number of TX retries"
143	default 2
144	help
145	  Number of TX retries before dropping the byte and assuming that
146	  RTT session is inactive.
147
148config RTT_TX_RETRY_DELAY_MS
149	int "Delay between TX retries in milliseconds"
150	default 2
151	help
152	  Sleep period between TX retry attempts. During RTT session, host pulls data
153	  periodically. Period starts from 1-2 milliseconds and can be increased
154	  if traffic on RTT increases (also from host to device). In case of
155	  heavy traffic data can be lost and it may be necessary to increase
156	  delay or number of retries.
157
158config RTT_TX_RETRY_IN_INTERRUPT
159	bool "Busy wait in the interrupt context for TX retry"
160	help
161	  If enabled RTT console will busy wait between TX retries when console
162	  assumes that RTT session is active. In case of heavy traffic data can
163	  be lost and it may be necessary to increase delay or number of
164	  retries.
165
166endif
167
168config IPM_CONSOLE_SENDER
169	bool "Inter-processor Mailbox console sender"
170	select CONSOLE_HAS_DRIVER
171	help
172	  Enable the sending side of IPM console
173
174config IPM_CONSOLE_RECEIVER
175	bool "Inter-processor Mailbox console receiver"
176	select RING_BUFFER
177	help
178	  Enable the receiving side of IPM console
179
180config IPM_CONSOLE_STACK_SIZE
181	int "Stack size for IPM console receiver thread"
182	depends on IPM_CONSOLE_RECEIVER
183	default 2048 if COVERAGE_GCOV
184	default 512
185	help
186	  Each instance of the IPM console receiver driver creates a worker
187	  thread to print out incoming messages from the remote CPU. Specify the
188	  stack size for these threads here.
189
190config IPM_CONSOLE
191	bool "Inter-processor Mailbox console"
192	depends on IPM
193	select CONSOLE_HAS_DRIVER
194	help
195	  Enable console over Inter-processor Mailbox.
196
197config IPM_CONSOLE_LINE_BUF_LEN
198	int "IPM console line buffer length"
199	default 128
200	depends on IPM_CONSOLE
201	help
202	  IPM console line buffer length specify amount of the buffer
203	  where characters are stored before sending the whole line.
204
205config UART_MCUMGR
206	bool "Mcumgr UART driver"
207	select UART_INTERRUPT_DRIVEN
208	help
209	  Enable the mcumgr UART driver. This driver allows the application to
210	  communicate over UART using the mcumgr protocol for image upgrade and
211	  device management. The driver doesn't inspect received data (as
212	  contrary to console UART driver) and all aspects of received protocol
213	  data are handled by an application provided callback.
214
215if UART_MCUMGR
216
217config UART_MCUMGR_RX_BUF_SIZE
218	int "Size of receive buffer for mcumgr fragments received over UART, in bytes"
219	default 128
220	help
221	  Specifies the size of the mcumgr UART receive buffer, in bytes. This
222	  value must be large enough to accommodate any line sent by an mcumgr
223	  client.
224
225config UART_MCUMGR_RX_BUF_COUNT
226	int "Number of receive buffers for mcumgr fragments received over UART"
227	default 2
228	help
229	  Specifies the number of the mcumgr UART receive buffers.  Receive
230	  buffers hold received mcumgr fragments prior to reassembly.  This
231	  setting's value must satisfy the following relation:
232	  UART_MCUMGR_RX_BUF_COUNT * UART_MCUMGR_RX_BUF_SIZE >=
233	  MCUMGR_TRANSPORT_UART_MTU
234
235endif # UART_MCUMGR
236
237config XTENSA_SIM_CONSOLE
238	bool "Use Xtensa simulator console"
239	depends on SIMULATOR_XTENSA
240	depends on !WINSTREAM_CONSOLE
241	select CONSOLE_HAS_DRIVER
242	default y
243	help
244	  Use simulator console to print messages.
245
246config POSIX_ARCH_CONSOLE
247	bool "Use the host terminal for console"
248	depends on ARCH_POSIX
249	select CONSOLE_HAS_DRIVER
250	help
251	  Zephyr's printk messages will be directed to the host terminal stdout
252
253config POSIX_ARCH_CONSOLE_INIT_PRIORITY
254	int "Init priority"
255	default 99
256	depends on POSIX_ARCH_CONSOLE
257	help
258	  Device driver initialization priority.
259
260config SEMIHOST_CONSOLE
261	bool "Use semihosting for console"
262	select CONSOLE_HAS_DRIVER
263	depends on SEMIHOST
264	help
265	  Enable this option to use semihosting for console.
266	  See SEMIHOST for a more complete description of semihosting.
267
268module = UART_CONSOLE
269module-str = UART console
270source "subsys/logging/Kconfig.template.log_config"
271
272config EFI_CONSOLE
273	bool "Use EFI console for console output"
274	select CONSOLE_HAS_DRIVER
275	help
276	  Enable this option to use EFI console output.
277
278config WINSTREAM_CONSOLE
279	bool "Use Winstream console"
280	depends on WINSTREAM
281	select CONSOLE_HAS_DRIVER
282	help
283	  Use winstream as a console.
284
285	  See the WINSTREAM Kconfig help for more information.
286
287endif # CONSOLE
288