Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# Include
/include/*.h @nrfconnect/ncs-bm
/include/bluetooth/ @nrfconnect/ncs-bm
/include/shell/ @nrfconnect/ncs-bm
/include/s115/ @nrfconnect/ncs-bm @nrfconnect/ncs-dragoon

# Libraries
Expand All @@ -58,11 +59,13 @@
/samples/boot/ @nrfconnect/ncs-pluto
/samples/mcumgr/ @nrfconnect/ncs-pluto
/samples/peripherals/ @nrfconnect/ncs-bm
/samples/shell/ @nrfconnect/ncs-bm

# Samples documentation
/samples/**/*.rst @nrfconnect/ncs-bm-doc
/samples/bluetooth/**/*.rst @nrfconnect/ncs-bm-doc
/samples/peripherals/**/*.rst @nrfconnect/ncs-bm-doc
/samples/shell/**/*.rst @nrfconnect/ncs-bm-doc

# Scripts
/scripts/ @nrfconnect/ncs-bm
Expand All @@ -73,6 +76,7 @@
/subsys/bm_installs/ @nrfconnect/ncs-pluto
/subsys/logging/ @nrfconnect/ncs-bm
/subsys/mgmt/mcumgr/ @nrfconnect/ncs-pluto
/subsys/shell/ @nrfconnect/ncs-bm
/subsys/softdevice/ @nrfconnect/ncs-bm @nrfconnect/ncs-dragoon
/subsys/softdevice_handler/ @nrfconnect/ncs-bm
/subsys/storage/flash_map/ @nrfconnect/ncs-pluto
Expand Down
17 changes: 17 additions & 0 deletions boards/nordic/bm_nrf54l15dk/include/board-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ extern "C" {
#define BOARD_CONSOLE_UARTE_PIN_CTS NRF_PIN_PORT_TO_PIN_NUMBER(7, 1)
#endif

/* UART Shell configuration */
#ifndef BOARD_SHELL_UARTE_INST
#define BOARD_SHELL_UARTE_INST 30
#endif
#ifndef BOARD_SHELL_UARTE_PIN_TX
#define BOARD_SHELL_UARTE_PIN_TX NRF_PIN_PORT_TO_PIN_NUMBER(0, 0)
#endif
#ifndef BOARD_SHELL_UARTE_PIN_RX
#define BOARD_SHELL_UARTE_PIN_RX NRF_PIN_PORT_TO_PIN_NUMBER(1, 0)
#endif
#ifndef BOARD_SHELL_UARTE_PIN_RTS
#define BOARD_SHELL_UARTE_PIN_RTS NRF_PIN_PORT_TO_PIN_NUMBER(2, 0)
#endif
#ifndef BOARD_SHELL_UARTE_PIN_CTS
#define BOARD_SHELL_UARTE_PIN_CTS NRF_PIN_PORT_TO_PIN_NUMBER(3, 0)
#endif

/* Application UART configuration */
#ifndef BOARD_APP_UARTE_INST
#define BOARD_APP_UARTE_INST 30
Expand Down
13 changes: 13 additions & 0 deletions doc/nrf-bm/sample/shell.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _shell_samples:

Shell samples
#############

This section lists the available samples for shell support.

.. toctree::
:maxdepth: 1
:caption: Subpages
:glob:

../samples/shell/bm_uarte/README.rst
1 change: 1 addition & 0 deletions doc/nrf-bm/samples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ All other samples and applications that are included in the distribution must be

sample/ble
sample/peripheral
sample/shell
8 changes: 8 additions & 0 deletions include/shell/backend_bm_uarte.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Get pointer to BM UARTE shell backend */
const struct shell *shell_backend_bm_uarte_get_ptr(void);
12 changes: 12 additions & 0 deletions samples/shell/bm_uarte/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(shell_bm_uarte)

target_sources(app PRIVATE src/main.c)
59 changes: 59 additions & 0 deletions samples/shell/bm_uarte/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.. _shell_bm_uarte_sample:

UARTE shell sample
##################

.. contents::
:local:
:depth: 2

The Shell sample demonstrates how to initialize and use the shell subsystem with an nrfx UARTE based backend with |BMlong|.

Requirements
************

The sample supports the following development kits:

.. list-table::
:header-rows: 1

* - Hardware platform
- PCA
- Board target
* - `nRF54L15 DK`_
- PCA10156
- bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice
* - `nRF54L15 DK`_ (emulating nRF54L10)
- PCA10156
- bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice
* - `nRF54L15 DK`_ (emulating nRF54L05)
- PCA10156
- bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice

Overview
********

The sample initializes and starts an interactive shell, which can be terminated by using the ``terminate`` shell command.

Building and running
********************

This sample can be found under :file:`samples/shell/bm_uarte/` in the |BMshort| folder structure.

.. include:: /includes/create_sample.txt

.. include:: /includes/configure_and_build_sample.txt

.. include:: /includes/program_sample.txt

Testing
=======

You can test this sample by performing the following steps:

1. Compile and program the application.
#. Observe that the ``bm-uarte:~$`` prompt is printed.
#. Type ``terminate`` and press Enter.
#. Observe that the ``goodbye`` message is printed.
#. Observe that the ``bm-uarte:~$`` prompt is printed.
#. Observe that shell is now unresponsive.
3 changes: 3 additions & 0 deletions samples/shell/bm_uarte/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_SHELL=y
CONFIG_SHELL_MINIMAL=y
CONFIG_SHELL_BACKEND_BM_UARTE=y
15 changes: 15 additions & 0 deletions samples/shell/bm_uarte/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sample:
name: Shell sample
tests:
sample.shell.bm_uarte:
sysbuild: true
build_only: true
integration_platforms:
- bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice
- bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice
- bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice
platform_allow:
- bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice
- bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice
- bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice
tags: ci_build
38 changes: 38 additions & 0 deletions samples/shell/bm_uarte/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#include <zephyr/shell/shell.h>
#include <zephyr/sys/atomic.h>
#include <shell/backend_bm_uarte.h>

#include <zephyr/shell/shell.h>

static atomic_t running = ATOMIC_INIT(1);

static int sample_terminate_cmd(const struct shell *sh, size_t argc, char **argv)
{
shell_print(sh, "goodbye");
atomic_set(&running, 0);
return 0;
}

SHELL_CMD_REGISTER(terminate, NULL, "terminate shell", sample_terminate_cmd);

int main(void)
{
const struct shell_backend_config_flags cfg_flags = SHELL_DEFAULT_BACKEND_CONFIG_FLAGS;

shell_init(shell_backend_bm_uarte_get_ptr(), NULL, cfg_flags, false, 0);
shell_start(shell_backend_bm_uarte_get_ptr());
printk("shell started\n");
while (atomic_get(&running)) {
shell_process(shell_backend_bm_uarte_get_ptr());
k_busy_wait(10000);
}
shell_uninit(shell_backend_bm_uarte_get_ptr(), NULL);
printk("shell terminated\n");
return 0;
}
1 change: 1 addition & 0 deletions subsys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
add_subdirectory(bluetooth)
add_subdirectory(bm_installs)
add_subdirectory(logging)
add_subdirectory(shell)
add_subdirectory_ifdef(CONFIG_NCS_BM_MCUMGR mgmt/mcumgr)
add_subdirectory_ifdef(CONFIG_NRF_SDH softdevice_handler)
add_subdirectory_ifdef(CONFIG_SOFTDEVICE softdevice)
Expand Down
1 change: 1 addition & 0 deletions subsys/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rsource "bluetooth/Kconfig"
rsource "bm_installs/Kconfig"
rsource "logging/Kconfig"
rsource "mgmt/mcumgr/Kconfig"
rsource "shell/Kconfig"
rsource "softdevice/Kconfig"
rsource "softdevice_handler/Kconfig"
rsource "storage/flash_map/Kconfig"
Expand Down
7 changes: 7 additions & 0 deletions subsys/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

add_subdirectory(backends)
10 changes: 10 additions & 0 deletions subsys/shell/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2025 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
menu "Shell"

rsource "backends/Kconfig"

endmenu
10 changes: 10 additions & 0 deletions subsys/shell/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

zephyr_sources_ifdef(
CONFIG_SHELL_BACKEND_BM_UARTE
bm_uarte.c
)
11 changes: 11 additions & 0 deletions subsys/shell/backends/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) 2025 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

menu "Backends"

rsource "Kconfig.bm_uarte"

endmenu
43 changes: 43 additions & 0 deletions subsys/shell/backends/Kconfig.bm_uarte
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (c) 2025 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

config SHELL_BACKEND_BM_UARTE
bool "UARTE shell backend"
select RING_BUFFER
help
When enabled, the backend uses the nrfx UARTE driver as the shell transport layer.

if SHELL_BACKEND_BM_UARTE

config SHELL_BACKEND_BM_UARTE_RX_RBUF_SIZE
int "Receive ring buffer size in bytes"
default 128
help
The size of the receive ring buffer the receive double buffer
is copied to.

config SHELL_BACKEND_BM_UARTE_RX_DBUF_SIZE
int "Receive double buffer size in bytes"
default 64
help
The total size of the receive double buffer.

config SHELL_BACKEND_BM_UARTE_IRQ_PRIO
int "IRQ priority"
range 3 7
default 5

config SHELL_BACKEND_BM_UARTE_USE_HWFC
bool "Use hardware flow control"

config SHELL_BACKEND_BM_UARTE_PARITY_INCLUDED
bool "Use parity"

# Disable zephyrs default serial (UART) backend
config SHELL_BACKEND_SERIAL
default n

endif
Loading