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