Skip to content

Commit

Permalink
Add Telink Platform (#6682)
Browse files Browse the repository at this point in the history
* Add Telink Platform

* [Telink] remove unnecessary steps from workflow

* [Telink] update Readme.md flash section with new instruction

* [Telink] Fix compilation errors

* [Telink] Fix remarks from reviewers

* [Telink] update last changes in Matter

* [Telink] Update endpoint numbers for lighting

* [Telink] Remove PublishService and Service module as it is no longer required

* [Telink] Move Zephyr shared files to config/zephyr

* [Telink] Fix after restyle check

* [Telink] remove unnecessary container volume

* [Telink] Add MBEDTLS_ECDSA_DETERMINISTIC to fix compilation error

* [Telink] update after rebase
  • Loading branch information
rikorsev authored and pull[bot] committed Jul 2, 2021
1 parent 8572fe3 commit 1891569
Show file tree
Hide file tree
Showing 56 changed files with 3,455 additions and 92 deletions.
3 changes: 3 additions & 0 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,6 @@ labelPRBasedOnFilePath:

zephyr:
- src/platform/Zephyr/*

telink:
- src/platform/telink/*
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,6 @@ openthread:

zephyr:
- src/platform/Zephyr/*

telink:
- src/platform/telink/*
41 changes: 41 additions & 0 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2020 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.

name: Build example - Telink

on:
push:
pull_request:

jobs:
telink:
name: Telink
env:
BUILD_TYPE: telink

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-telink:latest
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"

steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build example Telink Lighting App on TLSR9518ADK80D
run: scripts/examples/telink_example.sh lighting-app tlsr9518adk80d
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@
"${workspaceFolder}/examples/shell/nrfconnect/build/nrf5340dk_nrf5340_cpuapp"
]
}
},
{
"label": "Build Telink Lighting Example (TLSR9518ADK80D)",
"type": "shell",
"command": "source scripts/activate.sh && scripts/examples/telink_example.sh lighting-app tlsr9518adk80d",
"group": "build",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceFolder}/examples/lighting-app/telink/build/tlsr9518adk80d"
]
}
}
]
}
2 changes: 1 addition & 1 deletion config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if (CONFIG_CHIP)

include(ExternalProject)
include(zephyr-util.cmake)
include(../../zephyr/zephyr-util.cmake)

# ==============================================================================
# Declare configuration variables and define constants
Expand Down
92 changes: 3 additions & 89 deletions config/nrfconnect/chip-module/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020 Project CHIP Authors
# Copyright (c) 2021 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.
Expand All @@ -14,76 +14,7 @@
# limitations under the License.
#

menuconfig CHIP
bool "Connected Home over IP protocol stack"
default n
select CPLUSPLUS
imply LIB_CPLUSPLUS
imply REQUIRES_FULL_LIBC
imply CBPRINTF_LIBC_SUBSTS
imply POSIX_API if !ARCH_POSIX
imply EVENTFD if !ARCH_POSIX
imply REBOOT
imply ENTROPY_GENERATOR
imply NET_UDP
imply NET_IPV6
imply NET_CONFIG_NEED_IPV6
imply NET_SOCKETS
help
This option enables Connected Home over IP libraries.

if CHIP

config CHIP_PROJECT_CONFIG
string "Project configuration file for CHIP"
help
Project configuration file for CHIP. If specified, CHIP generic
configuration files will include the project configuration file which can
be used to override any CHIP default or platform-specific settings.

config CHIP_OPENTHREAD_CONFIG
string "Custom OpenThread configuration file"
help
This option can be used to replace Zephyr-supplied OpenThread
configuration file with a custom one.

config CHIP_ZEPHYR_SHELL
bool "Enable Zephyr-based CHIP shell"
default n
imply SHELL
help
Add CHIP commands to the Zephyr shell.

config CHIP_STANDALONE_SHELL
bool "Enable CHIP shell library"
default n
depends on !CHIP_ZEPHYR_SHELL
help
Link the application with the library containing CHIP shell commands.

config CHIP_PW_RPC
bool "Enable Pigweed RPC library"
default n
help
Link the application with the library containing Pigweed RPC functionalities.

config CHIP_BUILD_TESTS
bool "Build CHIP unit tests"
default n
help
This option enables building CHIP unit tests.

config CHIP_DISABLE_CHIPOBLE_ADVERTISING_WHEN_PROVISIONED
bool "Disable CHIPoBLE advertising when device is fully provisioned"
default y
help
Disable CHIPoBLE advertising when the device achieves a fully provisioned state.

config CHIP_ENABLE_PAIRING_AUTOSTART
bool "Enable pairing autostart"
default n
help
Open pairing window automatically at application boot time.
rsource "../../zephyr/Kconfig"

config CHIP_NFC_COMMISSIONING
bool "Enable NFC commissioning support"
Expand All @@ -95,21 +26,4 @@ config CHIP_NFC_COMMISSIONING
imply NFC_NDEF_URI_REC
imply NFC_NDEF_URI_MSG
help
Enables NFC commissioning by sharing onboarding payload in NFC tag.

config CHIP_ENABLE_DNSSD_SRP
bool "Enable support for service registration"
default y
imply OPENTHREAD_ECDSA
imply OPENTHREAD_SRP_CLIENT
help
Enables DNS-SD SRP client support

config APP_LINK_WITH_CHIP
bool "Link 'app' with Connected Home over IP"
default y
help
Add Connected Home over IP header files to the 'app' include path
and link the 'app' with Connected Home over IP libraries.

endif
Enables NFC commissioning by sharing onboarding payload in NFC tag.
19 changes: 19 additions & 0 deletions config/telink/app/enable-gnu-std.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2021 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.
#

add_library(gnu17 INTERFACE)
target_compile_options(gnu17 INTERFACE -std=gnu++17 -D_SYS__PTHREADTYPES_H_)
target_link_libraries(app PRIVATE gnu17)
94 changes: 94 additions & 0 deletions config/telink/app/zephyr.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#
# Copyright (c) 2021 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.
#

CONFIG_CHIP=y

CONFIG_STD_CPP14=y

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_PRINTK=y
CONFIG_ASSERT=y
CONFIG_CBPRINTF_LIBC_SUBSTS=y

# Generic networking options
CONFIG_NETWORKING=y
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=n

# Disable TCP and IPv4 (TCP disabled to avoid heavy traffic)
CONFIG_NET_TCP=n
CONFIG_NET_IPV4=n

CONFIG_NET_CONFIG_NEED_IPV4=n
CONFIG_NET_CONFIG_MY_IPV4_ADDR=""
CONFIG_NET_CONFIG_PEER_IPV4_ADDR=""

# Application stack size
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_INIT_STACKS=y

# Disable certain parts of Zephyr IPv6 stack
CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_MLD=n

CONFIG_NET_MAX_CONN=1
CONFIG_NET_MAX_CONTEXTS=1

# Network buffers
CONFIG_NET_PKT_RX_COUNT=8
CONFIG_NET_PKT_TX_COUNT=8
CONFIG_NET_BUF_RX_COUNT=32
CONFIG_NET_BUF_TX_COUNT=32

# Bluetooth Low Energy configs
CONFIG_BT=n

# L2 OpenThread enabling
CONFIG_NET_L2_OPENTHREAD=y
CONFIG_OPENTHREAD_DEBUG=y
CONFIG_OPENTHREAD_L2_DEBUG=y
CONFIG_OPENTHREAD_L2_LOG_LEVEL_INF=y

CONFIG_OPENTHREAD_CHANNEL=26

CONFIG_NET_CONFIG_IEEE802154_DEV_NAME="IEEE802154_b91"

CONFIG_NET_CONFIG_MY_IPV6_ADDR="fdde:ad00:beef::1"
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="fdde:ad00:beef::2"

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_OPENTHREAD_SLAAC=y
CONFIG_OPENTHREAD_DHCP6_CLIENT=y
CONFIG_OPENTHREAD_SNTP_CLIENT=y
CONFIG_OPENTHREAD_DNS_CLIENT=y
CONFIG_OPENTHREAD_MTD_NETDIAG=y
CONFIG_OPENTHREAD_ENABLE_SERVICE=y
CONFIG_OPENTHREAD_MANUAL_START=y
CONFIG_OPENTHREAD_THREAD_STACK_SIZE=6144
CONFIG_OPENTHREAD_MBEDTLS=y

# mbedTLS tweaks
CONFIG_MBEDTLS_DEBUG=y

CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y
CONFIG_MBEDTLS_USER_CONFIG_FILE="telink-mbedtls-config.h"

# TBD: Something wrong with this heap. Need to be investigated. Cirrently just set minimal size
CONFIG_MBEDTLS_HEAP_SIZE=4
29 changes: 29 additions & 0 deletions config/telink/chip-gn/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2021 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
target_cpu = "riscv"
target_os = "zephyr"

import("${chip_root}/config/telink/chip-gn/args.gni")
}
36 changes: 36 additions & 0 deletions config/telink/chip-gn/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) 2021 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${build_root}/chip/tests.gni")

assert(current_os == "zephyr")

declare_args() {
chip_build_pw_rpc_lib = false
}

group("telink") {
deps = [ "${chip_root}/src/lib" ]

if (chip_build_tests) {
deps += [ "${chip_root}/src:tests" ]
}
}

group("default") {
deps = [ ":telink" ]
}
Loading

0 comments on commit 1891569

Please sign in to comment.