Skip to content
Permalink
Browse files

shell: prompt configuration during project generation

Adding possibility to modify shell prompt in Kconfig and in prj.config
file.
Fixes #14547.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
  • Loading branch information...
Jakub Rzeszutko authored and nashif committed Mar 22, 2019
1 parent 66431d2 commit 0e83ad65b41fa0cdb6c94a88d8c48a023d57c1a6
@@ -15,15 +15,21 @@ menuconfig SHELL_BACKENDS
if SHELL_BACKENDS

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

if SHELL_BACKEND_SERIAL

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

config UART_SHELL_ON_DEV_NAME
string "Device Name of UART Device for SHELL_BACKEND_SERIAL"
default "$(dt_str_val,DT_UART_SHELL_ON_DEV_NAME)" if HAS_DTS
@@ -107,14 +113,20 @@ config SHELL_BACKEND_SERIAL_LOG_LEVEL
endif #SHELL_BACKEND_SERIAL

config SHELL_BACKEND_RTT
bool "Enable RTT backend."
bool "Enable RTT backend"
select USE_SEGGER_RTT
select RTT_CONSOLE
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
@@ -176,6 +188,12 @@ config SHELL_BACKEND_TELNET

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
@@ -261,4 +279,11 @@ config SHELL_BACKEND_DUMMY
Enable dummy backend which can be used to execute commands with no
need for physical transport interface.

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

endif # SHELL_BACKENDS
@@ -8,8 +8,8 @@
#include <init.h>

SHELL_DUMMY_DEFINE(shell_transport_dummy);
SHELL_DEFINE(shell_dummy, "~$ ", &shell_transport_dummy, 1, 0,
SHELL_FLAG_OLF_CRLF);
SHELL_DEFINE(shell_dummy, CONFIG_SHELL_PROMPT_DUMMY, &shell_transport_dummy, 1,
0, SHELL_FLAG_OLF_CRLF);

static int init(const struct shell_transport *transport,
const void *config,
@@ -14,7 +14,7 @@ BUILD_ASSERT_MSG(!(IS_ENABLED(CONFIG_LOG_BACKEND_RTT) &&
"Conflicting log RTT backend enabled on the same channel");

SHELL_RTT_DEFINE(shell_transport_rtt);
SHELL_DEFINE(shell_rtt, "rtt:~$ ", &shell_transport_rtt,
SHELL_DEFINE(shell_rtt, CONFIG_SHELL_PROMPT_RTT, &shell_transport_rtt,
CONFIG_SHELL_BACKEND_RTT_LOG_MESSAGE_QUEUE_SIZE,
CONFIG_SHELL_BACKEND_RTT_LOG_MESSAGE_QUEUE_TIMEOUT,
SHELL_FLAG_OLF_CRLF);
@@ -16,7 +16,7 @@
#include "shell_telnet_protocol.h"

SHELL_TELNET_DEFINE(shell_transport_telnet);
SHELL_DEFINE(shell_telnet, "~$ ", &shell_transport_telnet,
SHELL_DEFINE(shell_telnet, CONFIG_SHELL_PROMPT_TELNET, &shell_transport_telnet,
CONFIG_SHELL_TELNET_LOG_MESSAGE_QUEUE_SIZE,
CONFIG_SHELL_TELNET_LOG_MESSAGE_QUEUE_TIMEOUT,
SHELL_FLAG_OLF_CRLF);
@@ -21,7 +21,7 @@ LOG_MODULE_REGISTER(shell_uart);
SHELL_UART_DEFINE(shell_transport_uart,
CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE,
CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE);
SHELL_DEFINE(shell_uart, "uart:~$ ", &shell_transport_uart,
SHELL_DEFINE(shell_uart, CONFIG_SHELL_PROMPT_UART, &shell_transport_uart,
CONFIG_SHELL_BACKEND_SERIAL_LOG_MESSAGE_QUEUE_SIZE,
CONFIG_SHELL_BACKEND_SERIAL_LOG_MESSAGE_QUEUE_TIMEOUT,
SHELL_FLAG_OLF_CRLF);

0 comments on commit 0e83ad6

Please sign in to comment.
You can’t perform that action at this time.