samples: net: openthread: shell: add sample application

Add simple application to test Thread and IEEE 802.15.4 using the
OpenThread shell.

Signed-off-by: Martin Jäger <martin@libre.solar>
This commit is contained in:
Martin Jäger 2024-12-30 13:42:40 +01:00 committed by Benjamin Cabé
commit 8eff86229e
6 changed files with 96 additions and 0 deletions

View file

@ -41,6 +41,9 @@ support in these samples, build them with ``overlay-ot.conf`` overlay config fil
See :zephyr:code-sample:`sockets-echo-server` and :zephyr:code-sample:`sockets-echo-client`
samples for details.
Zephyr also provides an :zephyr:code-sample:`openthread-shell`, which is useful for
testing and debugging Thread and its underlying IEEE 802.15.4 drivers.
Thread related APIs
*******************

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(openthread_shell)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -0,0 +1,35 @@
.. zephyr:code-sample:: openthread-shell
:name: OpenThread shell
:relevant-api: net_stats
Test Thread and IEEE 802.15.4 using the OpenThread shell.
Overview
********
This sample allows testing the Thread protocol and the underlying IEEE 802.15.4 drivers for various
boards using the OpenThread shell.
Building and Running
********************
Verify that the board and chip you are targeting provide IEEE 802.15.4 support.
For instance you can use Nordic's nRF52840 DK.
.. zephyr-app-commands::
:zephyr-app: samples/net/openthread/shell
:board: nrf52840dk/nrf52840
:goals: build
:compact:
Sample console interaction
==========================
.. code-block:: console
uart:~$ ot scan
| PAN | MAC Address | Ch | dBm | LQI |
+------+------------------+----+-----+-----+
| fe09 | abcdef1234567890 | 15 | -78 | 60 |
Done

View file

@ -0,0 +1,20 @@
# SPDX-License-Identifier: Apache-2.0
# Increased main stack size required for initialization
CONFIG_MAIN_STACK_SIZE=4096
# Enable Networking and OpenThread stack
CONFIG_NETWORKING=y
CONFIG_NET_L2_OPENTHREAD=y
# Use NVS as settings backend
CONFIG_NVS=y
# Logging
CONFIG_LOG=y
CONFIG_NET_LOG=y
# Networking and OpenThread shells
CONFIG_SHELL=y
CONFIG_NET_SHELL=y
CONFIG_OPENTHREAD_SHELL=y

View file

@ -0,0 +1,17 @@
common:
harness: net
tags:
- net
- openthread
depends_on: openthread
sample:
description: Test Thread and IEEE 802.15.4 using the OpenThread shell
name: OpenThread Shell
tests:
sample.net.openthread.shell:
build_only: true
platform_allow:
- nrf52840dk/nrf52840
- nrf52840dongle/nrf52840
integration_platforms:
- nrf52840dk/nrf52840

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2024 A Labs GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
int main(void)
{
/* Nothing to do here. The shell is automatically started in the background. */
return 0;
}