-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Telink] Add Shell app demo (#28097)
* UTCSH-274: add Telink draft shell app * UTCSH-274: add shell draft app * [Telink]: Examples: Shell: Introduced shell sample for Telink platform Introduced shell sample for Telink platform. Signed-off-by: Misha Tkachenko <[email protected]> * using common main.cpp file in shell folder * [Telink] Fix code style issues * [Telink] Fix workflow issues * [Telink] Fix workflow issues * [Telink] Fix workflow issues --------- Signed-off-by: Misha Tkachenko <[email protected]> Co-authored-by: dmytro.k <[email protected]> Co-authored-by: Misha Tkachenko <[email protected]> Co-authored-by: dmytro.kashkarov <[email protected]>
- Loading branch information
1 parent
3acb641
commit bce4625
Showing
11 changed files
with
266 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
cmake_minimum_required(VERSION 3.13.1) | ||
|
||
set(BOARD tlsr9518adk80d) | ||
|
||
get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) | ||
get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) | ||
get_filename_component(APP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. REALPATH) | ||
|
||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") | ||
set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") | ||
else() | ||
unset(LOCAL_DTC_OVERLAY_FILE) | ||
endif() | ||
|
||
if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") | ||
set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") | ||
else() | ||
unset(GLOBAL_DTC_OVERLAY_FILE) | ||
endif() | ||
|
||
if(DTC_OVERLAY_FILE) | ||
set(DTC_OVERLAY_FILE | ||
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" | ||
CACHE STRING "" FORCE | ||
) | ||
else() | ||
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) | ||
endif() | ||
|
||
set(CONF_FILE ${CHIP_ROOT}/config/telink/app/zephyr.conf prj.conf) | ||
|
||
# Load NCS/Zephyr build system | ||
list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) | ||
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) | ||
|
||
project(chip-telink-shell-example) | ||
|
||
include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) | ||
include(${CHIP_ROOT}/src/app/chip_data_model.cmake) | ||
|
||
target_compile_options(app PRIVATE -fpermissive) | ||
|
||
target_include_directories(app PRIVATE | ||
include | ||
${GEN_DIR}/app-common | ||
${APP_ROOT}/shell_common/include) | ||
|
||
add_definitions( | ||
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>" | ||
) | ||
|
||
target_sources(app PRIVATE | ||
${APP_ROOT}/shell_common/globals.cpp | ||
${APP_ROOT}/shell_common/cmd_misc.cpp | ||
${APP_ROOT}/shell_common/cmd_otcli.cpp | ||
${APP_ROOT}/standalone/main.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Matter Telink Shell Example Application | ||
|
||
You can use this example as a reference for creating your own application. | ||
|
||
![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) | ||
|
||
## Build and flash | ||
|
||
1. Pull docker image from repository: | ||
|
||
```bash | ||
$ docker pull connectedhomeip/chip-build-telink:latest | ||
``` | ||
|
||
1. Run docker container: | ||
|
||
```bash | ||
$ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" connectedhomeip/chip-build-telink:latest | ||
``` | ||
|
||
here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay | ||
attention that OUTPUT_DIR should contains ABSOLUTE path to output dir** | ||
|
||
1. Activate the build environment: | ||
|
||
```bash | ||
$ source ./scripts/activate.sh | ||
``` | ||
|
||
1. In the example dir run: | ||
|
||
```bash | ||
$ west build | ||
``` | ||
|
||
1. Flash binary: | ||
|
||
``` | ||
$ west flash --erase | ||
``` | ||
|
||
## Usage | ||
|
||
### UART | ||
|
||
To get output from device, connect UART to following pins: | ||
|
||
| Name | Pin | | ||
| :--: | :---------------------------- | | ||
| RX | PB3 (pin 17 of J34 connector) | | ||
| TX | PB2 (pin 16 of J34 connector) | | ||
| GND | GND | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Example project configuration file for CHIP. | ||
* | ||
* This is a place to put application or project-specific overrides | ||
* to the default configuration values for general CHIP features. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
// Use a default pairing code if one hasn't been provisioned in flash. | ||
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 | ||
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 | ||
|
||
/** | ||
* CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE | ||
* | ||
* Reduce packet buffer pool size to 8 (default 15) to reduce ram consumption | ||
*/ | ||
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8 | ||
|
||
// Enable support functions for parsing command-line arguments | ||
#define CHIP_CONFIG_ENABLE_ARG_PARSER 1 | ||
|
||
#define CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING 1 | ||
|
||
// shell app uses openthread but does not have the NETWORK_COMMISSIONING cluster or zap config | ||
// Do not instantiate the NETWORK_COMMISSIONING thread driver | ||
#define _NO_NETWORK_COMMISSIONING_DRIVER_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# This sample uses sample-defaults.conf to set options common for all | ||
# samples. This file should contain only options specific for this sample | ||
# or overrides of default values. | ||
|
||
# enable GPIO | ||
CONFIG_GPIO=y | ||
|
||
# enable PWM | ||
CONFIG_PWM=y | ||
|
||
# OpenThread configs | ||
#CONFIG_OPENTHREAD_MTD=n | ||
CONFIG_OPENTHREAD_FTD=y | ||
# CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y | ||
CONFIG_CHIP_THREAD_SSED=n | ||
|
||
# Default OpenThread network settings | ||
CONFIG_OPENTHREAD_PANID=4660 | ||
CONFIG_OPENTHREAD_CHANNEL=15 | ||
CONFIG_OPENTHREAD_NETWORK_NAME="OpenThreadDemo" | ||
CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" | ||
|
||
# Disable Matter OTA DFU | ||
CONFIG_CHIP_OTA_REQUESTOR=n | ||
|
||
# CHIP configuration | ||
CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" | ||
CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" | ||
|
||
CONFIG_CHIP_DEVICE_VENDOR_ID=65521 | ||
# 32786 == 0x8012 (example shell-app) | ||
CONFIG_CHIP_DEVICE_PRODUCT_ID=32786 | ||
CONFIG_CHIP_DEVICE_TYPE=65535 | ||
|
||
CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1 | ||
CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2023" | ||
|
||
# Enable CHIP pairing automatically on application start. | ||
CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y | ||
|
||
# CHIP shell | ||
CONFIG_CHIP_LIB_SHELL=y | ||
CONFIG_OPENTHREAD_SHELL=y | ||
CONFIG_SHELL=y | ||
|
||
# Disable factory data support. | ||
CONFIG_CHIP_FACTORY_DATA=n | ||
CONFIG_CHIP_FACTORY_DATA_BUILD=n | ||
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n | ||
CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n | ||
|
||
# Enable Power Management | ||
CONFIG_PM=n | ||
|
||
# Custom RF power values | ||
CONFIG_B91_BLE_CTRL_RF_POWER_P9P11DBM=y | ||
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters