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:
parent
8316f097ce
commit
8eff86229e
6 changed files with 96 additions and 0 deletions
|
@ -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
|
||||
*******************
|
||||
|
||||
|
|
9
samples/net/openthread/shell/CMakeLists.txt
Normal file
9
samples/net/openthread/shell/CMakeLists.txt
Normal 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})
|
35
samples/net/openthread/shell/README.rst
Normal file
35
samples/net/openthread/shell/README.rst
Normal 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
|
20
samples/net/openthread/shell/prj.conf
Normal file
20
samples/net/openthread/shell/prj.conf
Normal 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
|
17
samples/net/openthread/shell/sample.yaml
Normal file
17
samples/net/openthread/shell/sample.yaml
Normal 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
|
12
samples/net/openthread/shell/src/main.c
Normal file
12
samples/net/openthread/shell/src/main.c
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue