Boot Linux faster!

Check our new training course

Boot Linux faster!

Check our new training course
and Creative Commons CC-BY-SA
lecture and lab materials

Bootlin logo

Elixir Cross Referencer

# Shell backends configuration options

# Copyright (c) 2018 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

menuconfig SHELL_BACKENDS
	bool "Enable shell backends"
	default y
	help
	  Enable shell backends.

if SHELL_BACKENDS

config SHELL_BACKEND_SERIAL
	bool "Enable serial backend"
	default y
	select SERIAL
	select RING_BUFFER
	help
	  Enable serial backend.

if SHELL_BACKEND_SERIAL

config SHELL_BACKEND_SERIAL_INIT_PRIORITY
	int "Initialization priority"
	default 0
	range 0 99
	help
	  Initialization priority for UART backend. This must be bigger than
	  the initialization priority of the used serial device.

config SHELL_PROMPT_UART
	string "Displayed prompt name"
	default "uart:~$ "
	help
	  Displayed prompt name for UART backend.

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_SHELL_UART := zephyr,shell-uart

config UART_SHELL_ON_DEV_NAME
	string "Device Name of UART Device for SHELL_BACKEND_SERIAL"
	default "$(dt_chosen_label,$(DT_CHOSEN_Z_SHELL_UART))" if HAS_DTS
	default "UART_0"
	help
	  This option specifies the name of UART device to be used for the
	  SHELL UART backend.
	  In case when DTS is enabled (HAS_DTS), the default value is
	  set from DTS chosen node 'zephyr,shell-uart' but can be overridden
	  here.

# Internal config to enable UART interrupts if supported.
config SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
	bool "Interrupt driven"
	default y
	depends on SERIAL_SUPPORT_INTERRUPT
	select UART_INTERRUPT_DRIVEN

config SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE
	int "Set TX ring buffer size"
	default 8
	depends on SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
	help
	  If UART is utilizing DMA transfers then increasing ring buffer size
	  increases transfers length and reduces number of interrupts.

config SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE
	int "Set RX ring buffer size"
	default 64
	help
	  RX ring buffer size impacts accepted latency of handling incoming
	  bytes by shell. If shell input is coming from the keyboard then it is
	  usually enough if ring buffer is few bytes (more than one due to
	  escape sequences). However, if bulk data is transferred it may be
	  required to increase it.

config SHELL_BACKEND_SERIAL_RX_POLL_PERIOD
	int "RX polling period (in milliseconds)"
	default 10
	depends on !SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
	help
	  Determines how often UART is polled for RX byte.

module = SHELL_BACKEND_SERIAL
default-timeout = 100
source "subsys/shell/Kconfig.template.shell_log_queue_timeout"

default-size = 10
source "subsys/shell/Kconfig.template.shell_log_queue_size"

choice
	prompt "Initial log level limit"
	default SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT

config SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_INF
	bool "Info"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_ERR
	bool "Error"

config SHELL_BACKEND_SERIAL_LOG_LEVEL_NONE
	bool "None"

endchoice

config SHELL_BACKEND_SERIAL_LOG_LEVEL
	int
	default 0 if SHELL_BACKEND_SERIAL_LOG_LEVEL_NONE
	default 1 if SHELL_BACKEND_SERIAL_LOG_LEVEL_ERR
	default 2 if SHELL_BACKEND_SERIAL_LOG_LEVEL_WRN
	default 3 if SHELL_BACKEND_SERIAL_LOG_LEVEL_INF
	default 4 if SHELL_BACKEND_SERIAL_LOG_LEVEL_DBG
	default 5 if SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT

endif # SHELL_BACKEND_SERIAL

config SHELL_BACKEND_RTT
	bool "Enable RTT backend"
	select CONSOLE
	select RTT_CONSOLE
	depends on USE_SEGGER_RTT
	help
	  Enable RTT backend.

if SHELL_BACKEND_RTT

config SHELL_PROMPT_RTT
	string "Displayed prompt name"
	default "rtt:~$ "
	help
	  Displayed prompt name for RTT backend.

config SHELL_RTT_RX_POLL_PERIOD
	int "RX polling period (in milliseconds)"
	default 10
	help
	  Determines how often RTT is polled for RX byte.

module = SHELL_BACKEND_RTT
default-timeout = 100
source "subsys/shell/Kconfig.template.shell_log_queue_timeout"

default-size = 10
source "subsys/shell/Kconfig.template.shell_log_queue_size"

choice
	prompt "Initial log level limit"
	default SHELL_RTT_INIT_LOG_LEVEL_DEFAULT

config SHELL_RTT_INIT_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_RTT_INIT_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_RTT_INIT_LOG_LEVEL_INF
	bool "Info"

config SHELL_RTT_INIT_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_RTT_INIT_LOG_LEVEL_ERR
	bool "Error"

config SHELL_RTT_INIT_LOG_LEVEL_NONE
	bool "None"

endchoice

config SHELL_RTT_INIT_LOG_LEVEL
	int
	default 0 if SHELL_RTT_INIT_LOG_LEVEL_NONE
	default 1 if SHELL_RTT_INIT_LOG_LEVEL_ERR
	default 2 if SHELL_RTT_INIT_LOG_LEVEL_WRN
	default 3 if SHELL_RTT_INIT_LOG_LEVEL_INF
	default 4 if SHELL_RTT_INIT_LOG_LEVEL_DBG
	default 5 if SHELL_RTT_INIT_LOG_LEVEL_DEFAULT

module = SHELL_RTT
module-str = RTT shell backend
source "subsys/logging/Kconfig.template.log_config"

endif # SHELL_BACKEND_RTT

config SHELL_BACKEND_TELNET
	bool "Enable TELNET backend."
	depends on NET_TCP
	depends on NET_IPV4 || NET_IPV6
	help
	  Enable TELNET backend.

if SHELL_BACKEND_TELNET

config SHELL_PROMPT_TELNET
	string "Displayed prompt name"
	default "~$ "
	help
	  Displayed prompt name for TELNET backend.

config SHELL_TELNET_PORT
	int "Telnet port number"
	default 23
	help
	  This option is used to configure on which port telnet is going
	  to be bound.

config SHELL_TELNET_LINE_BUF_SIZE
	int "Telnet line buffer size"
	default 80
	help
	  This option can be used to modify the size of the buffer storing
	  shell output line, prior to sending it through the network.
	  Of course an output line can be longer than such size, it just
	  means sending it will start as soon as it reaches this size.
	  It really depends on what type of output is expected.
	  A lot of short lines: better reduce this value. On the contrary,
	  raise it.

config SHELL_TELNET_SEND_TIMEOUT
	int "Telnet line send timeout"
	default 100
	help
	  This option can be used to modify the duration of the timer that kick
	  in when a line buffer is not empty but did not yet meet the line feed.

config SHELL_TELNET_SUPPORT_COMMAND
	bool "Add support for telnet commands (IAC) [Experimental]"
	help
	  Current support is so limited it's not interesting to enable it.
	  However, if proven to be needed at some point, it will be possible
	  to extend such support.

module = SHELL_TELNET
default-timeout = 100
source "subsys/shell/Kconfig.template.shell_log_queue_timeout"

default-size = 10
source "subsys/shell/Kconfig.template.shell_log_queue_size"

choice
	prompt "Initial log level limit"
	default SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT

config SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT
	bool "System limit (LOG_MAX_LEVEL)"

config SHELL_TELNET_INIT_LOG_LEVEL_DBG
	bool "Debug"

config SHELL_TELNET_INIT_LOG_LEVEL_INF
	bool "Info"

config SHELL_TELNET_INIT_LOG_LEVEL_WRN
	bool "Warning"

config SHELL_TELNET_INIT_LOG_LEVEL_ERR
	bool "Error"

config SHELL_TELNET_INIT_LOG_LEVEL_NONE
	bool "None"

endchoice

config SHELL_TELNET_INIT_LOG_LEVEL
	int
	default 0 if SHELL_TELNET_INIT_LOG_LEVEL_NONE
	default 1 if SHELL_TELNET_INIT_LOG_LEVEL_ERR
	default 2 if SHELL_TELNET_INIT_LOG_LEVEL_WRN
	default 3 if SHELL_TELNET_INIT_LOG_LEVEL_INF
	default 4 if SHELL_TELNET_INIT_LOG_LEVEL_DBG
	default 5 if SHELL_TELNET_INIT_LOG_LEVEL_DEFAULT

module = SHELL_TELNET
module-str = TELNET shell backend
source "subsys/logging/Kconfig.template.log_config"

endif # SHELL_TELNET_BACKEND

config SHELL_BACKEND_DUMMY
	bool "Enable dummy backend."
	help
	  Enable dummy backend which can be used to execute commands with no
	  need for physical transport interface.

if SHELL_BACKEND_DUMMY

config SHELL_PROMPT_DUMMY
	string "Displayed prompt name"
	default "~$ "
	help
	  Displayed prompt name for DUMMY backend.

config SHELL_BACKEND_DUMMY_BUF_SIZE
	int "Size of dummy buffer size"
	default 300
	help
	  This is size of output buffer that will be used by dummy backend, this limits number of
	  characters that will be captured from command output.

endif # SHELL_BACKEND_DUMMY

endif # SHELL_BACKENDS