1# Shell backends configuration options
2
3# Copyright (c) 2018 Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig SHELL_BACKENDS
7	bool "Shell backends"
8	default y
9	help
10	  Enable shell backends.
11
12if SHELL_BACKENDS
13
14# Workaround for not being able to have commas in macro arguments
15DT_CHOSEN_Z_SHELL_UART := zephyr,shell-uart
16
17config SHELL_BACKEND_SERIAL
18	bool "Serial backend"
19	# Serial (UART) requires interrupts and the RTT backend cannot be used from an ISR context.
20	default n if SHELL_BACKEND_RTT
21	default "$(dt_chosen_enabled,$(DT_CHOSEN_Z_SHELL_UART))" if HAS_DTS
22	default y if !HAS_DTS
23	select SERIAL
24	select RING_BUFFER
25	help
26	  Enable serial backend.
27
28if SHELL_BACKEND_SERIAL
29
30config SHELL_BACKEND_SERIAL_INIT_PRIORITY
31	int "Initialization priority"
32	default 55 if ACPI
33	default 0
34	range 0 99
35	help
36	  Initialization priority for UART backend. This must be bigger than
37	  the initialization priority of the used serial device.
38
39config SHELL_PROMPT_UART
40	string "Displayed prompt name"
41	default "uart:~$ "
42	help
43	  Displayed prompt name for UART backend. If prompt is set, the shell will
44	  send two newlines during initialization.
45
46# Internal config to enable UART interrupts if supported.
47config SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
48	bool "Interrupt driven"
49	default y
50	depends on SERIAL_SUPPORT_INTERRUPT
51	select UART_INTERRUPT_DRIVEN
52
53config SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE
54	int "Set TX ring buffer size"
55	default 8
56	depends on SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
57	help
58	  If UART is utilizing DMA transfers then increasing ring buffer size
59	  increases transfers length and reduces number of interrupts.
60
61config SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE
62	int "Set RX ring buffer size"
63	default 256 if MCUMGR_TRANSPORT_SHELL
64	default 64
65	help
66	  RX ring buffer size impacts accepted latency of handling incoming
67	  bytes by shell. If shell input is coming from the keyboard then it is
68	  usually enough if ring buffer is few bytes (more than one due to
69	  escape sequences). However, if bulk data is transferred it may be
70	  required to increase it.
71
72config SHELL_BACKEND_SERIAL_RX_POLL_PERIOD
73	int "RX polling period (in milliseconds)"
74	default 10
75	depends on !SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
76	help
77	  Determines how often UART is polled for RX byte.
78
79config SHELL_BACKEND_SERIAL_CHECK_DTR
80	bool "Check DTR signal before TX"
81	depends on SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
82	depends on UART_LINE_CTRL
83	help
84	  Check DTR signal before TX.
85
86module = SHELL_BACKEND_SERIAL
87default-timeout = 100
88source "subsys/shell/Kconfig.template.shell_log_queue_timeout"
89
90default-size = 512
91source "subsys/shell/Kconfig.template.shell_log_queue_size"
92
93choice
94	prompt "Initial log level limit"
95	default SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT
96
97config SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT
98	bool "System limit (LOG_MAX_LEVEL)"
99
100config SHELL_BACKEND_SERIAL_LOG_LEVEL_DBG
101	bool "Debug"
102
103config SHELL_BACKEND_SERIAL_LOG_LEVEL_INF
104	bool "Info"
105
106config SHELL_BACKEND_SERIAL_LOG_LEVEL_WRN
107	bool "Warning"
108
109config SHELL_BACKEND_SERIAL_LOG_LEVEL_ERR
110	bool "Error"
111
112config SHELL_BACKEND_SERIAL_LOG_LEVEL_NONE
113	bool "None"
114
115endchoice
116
117config SHELL_BACKEND_SERIAL_LOG_LEVEL
118	int
119	default 0 if SHELL_BACKEND_SERIAL_LOG_LEVEL_NONE
120	default 1 if SHELL_BACKEND_SERIAL_LOG_LEVEL_ERR
121	default 2 if SHELL_BACKEND_SERIAL_LOG_LEVEL_WRN
122	default 3 if SHELL_BACKEND_SERIAL_LOG_LEVEL_INF
123	default 4 if SHELL_BACKEND_SERIAL_LOG_LEVEL_DBG
124	default 5 if SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT
125
126endif # SHELL_BACKEND_SERIAL
127
128config SHELL_BACKEND_RTT
129	bool "RTT backend"
130	select CONSOLE
131	select RTT_CONSOLE
132	depends on USE_SEGGER_RTT
133	help
134	  Enable RTT backend.
135
136if SHELL_BACKEND_RTT
137
138config SHELL_PROMPT_RTT
139	string "Displayed prompt name"
140	default "rtt:~$ "
141	help
142	  Displayed prompt name for RTT backend. If prompt is set, the shell will
143	  send two newlines during initialization.
144
145config SHELL_BACKEND_RTT_BUFFER
146	int "Buffer number used for shell input and output."
147	range 0 SEGGER_RTT_MAX_NUM_UP_BUFFERS
148	default 0
149	help
150	  Select index of up-buffer used for shell output, by default it uses
151	  terminal up-buffer and its settings.
152
153config SHELL_RTT_RX_POLL_PERIOD
154	int "RX polling period (in milliseconds)"
155	default 10
156	help
157	  Determines how often RTT is polled for RX byte.
158
159module = SHELL_BACKEND_RTT
160default-timeout = 100
161source "subsys/shell/Kconfig.template.shell_log_queue_timeout"
162
163default-size = 512
164source "subsys/shell/Kconfig.template.shell_log_queue_size"
165
166choice
167	prompt "Initial log level limit"
168	default SHELL_RTT_INIT_LOG_LEVEL_DEFAULT
169
170config SHELL_RTT_INIT_LOG_LEVEL_DEFAULT
171	bool "System limit (LOG_MAX_LEVEL)"
172
173config SHELL_RTT_INIT_LOG_LEVEL_DBG
174	bool "Debug"
175
176config SHELL_RTT_INIT_LOG_LEVEL_INF
177	bool "Info"
178
179config SHELL_RTT_INIT_LOG_LEVEL_WRN
180	bool "Warning"
181
182config SHELL_RTT_INIT_LOG_LEVEL_ERR
183	bool "Error"
184
185config SHELL_RTT_INIT_LOG_LEVEL_NONE
186	bool "None"
187
188endchoice
189
190config SHELL_RTT_INIT_LOG_LEVEL
191	int
192	default 0 if SHELL_RTT_INIT_LOG_LEVEL_NONE
193	default 1 if SHELL_RTT_INIT_LOG_LEVEL_ERR
194	default 2 if SHELL_RTT_INIT_LOG_LEVEL_WRN
195	default 3 if SHELL_RTT_INIT_LOG_LEVEL_INF
196	default 4 if SHELL_RTT_INIT_LOG_LEVEL_DBG
197	default 5 if SHELL_RTT_INIT_LOG_LEVEL_DEFAULT
198
199module = SHELL_RTT
200module-str = RTT shell backend
201source "subsys/logging/Kconfig.template.log_config"
202
203endif # SHELL_BACKEND_RTT
204
205config SHELL_BACKEND_MQTT
206	bool "MQTT backend"
207	depends on NET_TCP
208	depends on NET_IPV4
209	depends on NETWORKING
210	select DNS_RESOLVER
211	select HWINFO
212	select MQTT_LIB
213	select NET_MGMT
214	select NET_MGMT_EVENT
215	help
216	  Enable MQTT backend.
217
218if SHELL_BACKEND_MQTT
219
220config SHELL_MQTT_SERVER_ADDR
221	string "MQTT server address"
222	default "192.168.0.100"
223	help
224	  MQTT server address.
225
226config SHELL_MQTT_SERVER_PORT
227	int "MQTT server port"
228	default 1883
229	help
230	  MQTT server port.
231
232config SHELL_MQTT_SERVER_USERNAME
233	string "MQTT server username"
234	help
235	  MQTT server username.
236
237config SHELL_MQTT_SERVER_PASSWORD
238	string "MQTT server password"
239	help
240	  MQTT server password.
241
242config SHELL_MQTT_RX_BUF_SIZE
243	int "RX buffer size"
244	default 256
245	help
246	  Buffer size for the MQTT data reception.
247
248config SHELL_MQTT_TX_BUF_SIZE
249	int "TX buffer size"
250	range 32 65535
251	default 256
252	help
253	  Buffer size for the MQTT data transmission.
254
255module = SHELL_BACKEND_MQTT
256default-timeout = 100
257source "subsys/shell/Kconfig.template.shell_log_queue_timeout"
258
259default-size = 512
260source "subsys/shell/Kconfig.template.shell_log_queue_size"
261
262choice
263	prompt "Initial log level limit"
264	default SHELL_MQTT_INIT_LOG_LEVEL_DEFAULT
265
266config SHELL_MQTT_INIT_LOG_LEVEL_DEFAULT
267	bool "System limit (LOG_MAX_LEVEL)"
268
269config SHELL_MQTT_INIT_LOG_LEVEL_DBG
270	bool "Debug"
271
272config SHELL_MQTT_INIT_LOG_LEVEL_INF
273	bool "Info"
274
275config SHELL_MQTT_INIT_LOG_LEVEL_WRN
276	bool "Warning"
277
278config SHELL_MQTT_INIT_LOG_LEVEL_ERR
279	bool "Error"
280
281config SHELL_MQTT_INIT_LOG_LEVEL_NONE
282	bool "None"
283
284endchoice # SHELL_MQTT_INIT_LOG_LEVEL
285
286config SHELL_MQTT_INIT_LOG_LEVEL
287	int
288	default 0 if SHELL_MQTT_INIT_LOG_LEVEL_NONE
289	default 1 if SHELL_MQTT_INIT_LOG_LEVEL_ERR
290	default 2 if SHELL_MQTT_INIT_LOG_LEVEL_WRN
291	default 3 if SHELL_MQTT_INIT_LOG_LEVEL_INF
292	default 4 if SHELL_MQTT_INIT_LOG_LEVEL_DBG
293	default 5 if SHELL_MQTT_INIT_LOG_LEVEL_DEFAULT
294
295module = SHELL_MQTT
296module-str = MQTT shell backend
297source "subsys/logging/Kconfig.template.log_config"
298
299endif # SHELL_BACKEND_MQTT
300
301config SHELL_BACKEND_TELNET
302	bool "TELNET backend."
303	depends on NET_TCP
304	depends on NET_IPV4 || NET_IPV6
305	help
306	  Enable TELNET backend.
307
308if SHELL_BACKEND_TELNET
309
310config SHELL_PROMPT_TELNET
311	string "Displayed prompt name"
312	default "~$ "
313	help
314	  Displayed prompt name for TELNET backend. If prompt is set, the shell will
315	  send two newlines during initialization.
316
317config SHELL_TELNET_PORT
318	int "Telnet port number"
319	default 23
320	help
321	  This option is used to configure on which port telnet is going
322	  to be bound.
323
324config SHELL_TELNET_LINE_BUF_SIZE
325	int "Telnet line buffer size"
326	default 80
327	help
328	  This option can be used to modify the size of the buffer storing
329	  shell output line, prior to sending it through the network.
330	  Of course an output line can be longer than such size, it just
331	  means sending it will start as soon as it reaches this size.
332	  It really depends on what type of output is expected.
333	  A lot of short lines: better reduce this value. On the contrary,
334	  raise it.
335
336config SHELL_TELNET_SEND_TIMEOUT
337	int "Telnet line send timeout"
338	default 100
339	help
340	  This option can be used to modify the duration of the timer that kick
341	  in when a line buffer is not empty but did not yet meet the line feed.
342
343config SHELL_TELNET_SUPPORT_COMMAND
344	bool "Add support for telnet commands (IAC) [EXPERIMENTAL]"
345	select EXPERIMENTAL
346	help
347	  Current support is so limited it's not interesting to enable it.
348	  However, if proven to be needed at some point, it will be possible
349	  to extend such support.
350
351module = SHELL_TELNET
352default-timeout = 100
353source "subsys/shell/Kconfig.template.shell_log_queue_timeout"
354
355default-size = 512
356source "subsys/shell/Kconfig.template.shell_log_queue_size"
357
358choice
359	prompt "Initial log level limit"
360	default SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT
361
362config SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT
363	bool "System limit (LOG_MAX_LEVEL)"
364
365config SHELL_TELNET_INIT_LOG_LEVEL_DBG
366	bool "Debug"
367
368config SHELL_TELNET_INIT_LOG_LEVEL_INF
369	bool "Info"
370
371config SHELL_TELNET_INIT_LOG_LEVEL_WRN
372	bool "Warning"
373
374config SHELL_TELNET_INIT_LOG_LEVEL_ERR
375	bool "Error"
376
377config SHELL_TELNET_INIT_LOG_LEVEL_NONE
378	bool "None"
379
380endchoice
381
382config SHELL_TELNET_INIT_LOG_LEVEL
383	int
384	default 0 if SHELL_TELNET_INIT_LOG_LEVEL_NONE
385	default 1 if SHELL_TELNET_INIT_LOG_LEVEL_ERR
386	default 2 if SHELL_TELNET_INIT_LOG_LEVEL_WRN
387	default 3 if SHELL_TELNET_INIT_LOG_LEVEL_INF
388	default 4 if SHELL_TELNET_INIT_LOG_LEVEL_DBG
389	default 5 if SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT
390
391module = SHELL_TELNET
392module-str = TELNET shell backend
393source "subsys/logging/Kconfig.template.log_config"
394
395endif # SHELL_TELNET_BACKEND
396
397config SHELL_BACKEND_DUMMY
398	bool "Dummy backend."
399	help
400	  Enable dummy backend which can be used to execute commands with no
401	  need for physical transport interface.
402
403if SHELL_BACKEND_DUMMY
404
405config SHELL_PROMPT_DUMMY
406	string "Displayed prompt name"
407	default "~$ "
408	help
409	  Displayed prompt name for DUMMY backend. If prompt is set, the shell will
410	  send two newlines during initialization.
411
412config SHELL_BACKEND_DUMMY_BUF_SIZE
413	int "Size of dummy buffer size"
414	default 400 if LOG_PRINTK
415	default 300
416	help
417	  This is size of output buffer that will be used by dummy backend, this limits number of
418	  characters that will be captured from command output.
419
420choice
421	prompt "Initial log level limit"
422	default SHELL_DUMMY_INIT_LOG_LEVEL_INF
423
424config SHELL_DUMMY_INIT_LOG_LEVEL_DEFAULT
425	bool "System limit (LOG_MAX_LEVEL)"
426
427config SHELL_DUMMY_INIT_LOG_LEVEL_DBG
428	bool "Debug"
429
430config SHELL_DUMMY_INIT_LOG_LEVEL_INF
431	bool "Info"
432
433config SHELL_DUMMY_INIT_LOG_LEVEL_WRN
434	bool "Warning"
435
436config SHELL_DUMMY_INIT_LOG_LEVEL_ERR
437	bool "Error"
438
439config SHELL_DUMMY_INIT_LOG_LEVEL_NONE
440	bool "None"
441
442endchoice
443
444config SHELL_DUMMY_INIT_LOG_LEVEL
445	int
446	default 0 if SHELL_DUMMY_INIT_LOG_LEVEL_NONE
447	default 1 if SHELL_DUMMY_INIT_LOG_LEVEL_ERR
448	default 2 if SHELL_DUMMY_INIT_LOG_LEVEL_WRN
449	default 3 if SHELL_DUMMY_INIT_LOG_LEVEL_INF
450	default 4 if SHELL_DUMMY_INIT_LOG_LEVEL_DBG
451	default 5 if SHELL_DUMMY_INIT_LOG_LEVEL_DEFAULT
452
453endif # SHELL_BACKEND_DUMMY
454
455endif # SHELL_BACKENDS
456