Przeglądaj źródła

[Telink] RAM/ROM optimization & Update Telink image to 12 (#29373)

* [Telink] Disabled MBEDTLS_TEST and MBEDTLS_ERROR_C (saved 7Kb of flash)

* [Telink] Disabled debug logs (saved 11.5Kb of flash)

* [Telink] Disable all unused buttons

* [Telink] Enable all buttons by default

* [Telink] Disable Interaction model Event support in server

* [Telink] Reduce number of message buffers in the buffer pool

* [Telink] Set packet buffer pool size into 0

* [Telink] Decrease stack and buffer size

* [Telink] Update Stack sizes

* [Telink] Use B9X

* [Telink] Use LAMBDA_EVENT_SIZE minimal value to build OTA

* [Telink] Use Kconfigs and make PM dependency

* [Telink] Set BLE device name via config

* [Telink] Fix after tests

* [Telink] decrease some values for FTD as well

* [Telink]: Added public BLE MAC readout from vendor flash section
The BLE MAC can be generated randomly or read from flash area.

* [Telink] Increase BLE_CTRL_THREAD_STACK after B92 BLE stack update

* [Telink] Update Telink image to 12

* [Telink] Enable NL_ASSERT_USE_FLAGS by default

* [Telink] Increase stack size after OTA tests

* [Telink] minor chnages

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <commits@restyled.io>
Alex Tsitsiura 2 lat temu
rodzic
commit
ccc27ed033
100 zmienionych plików z 838 dodań i 893 usunięć
  1. 1 1
      .github/workflows/chef.yaml
  2. 1 1
      .github/workflows/examples-telink.yaml
  3. 0 147
      config/telink/app/zephyr.conf
  4. 2 2
      config/telink/chip-gn/args.gni
  5. 4 0
      config/telink/chip-module/CMakeLists.txt
  6. 14 10
      config/telink/chip-module/Kconfig
  7. 264 0
      config/telink/chip-module/Kconfig.defaults
  8. 1 1
      examples/all-clusters-app/telink/CMakeLists.txt
  9. 19 0
      examples/all-clusters-app/telink/Kconfig
  10. 7 10
      examples/all-clusters-app/telink/Readme.md
  11. 1 0
      examples/all-clusters-app/telink/include/AppConfig.h
  12. 0 7
      examples/all-clusters-app/telink/include/CHIPProjectConfig.h
  13. 15 19
      examples/all-clusters-app/telink/prj.conf
  14. 0 7
      examples/all-clusters-app/telink/src/AppTask.cpp
  15. 1 1
      examples/all-clusters-minimal-app/telink/CMakeLists.txt
  16. 19 0
      examples/all-clusters-minimal-app/telink/Kconfig
  17. 7 10
      examples/all-clusters-minimal-app/telink/Readme.md
  18. 1 0
      examples/all-clusters-minimal-app/telink/include/AppConfig.h
  19. 0 7
      examples/all-clusters-minimal-app/telink/include/CHIPProjectConfig.h
  20. 18 19
      examples/all-clusters-minimal-app/telink/prj.conf
  21. 0 7
      examples/all-clusters-minimal-app/telink/src/AppTask.cpp
  22. 1 1
      examples/bridge-app/telink/CMakeLists.txt
  23. 19 0
      examples/bridge-app/telink/Kconfig
  24. 7 10
      examples/bridge-app/telink/README.md
  25. 1 0
      examples/bridge-app/telink/include/AppConfig.h
  26. 0 7
      examples/bridge-app/telink/include/CHIPProjectConfig.h
  27. 13 21
      examples/bridge-app/telink/prj.conf
  28. 0 7
      examples/bridge-app/telink/src/AppTask.cpp
  29. 0 82
      examples/bridge-app/telink/src/main.cpp
  30. 0 7
      examples/chef/telink/CHIPProjectConfig.h
  31. 1 1
      examples/chef/telink/CMakeLists.txt
  32. 19 0
      examples/chef/telink/Kconfig
  33. 6 2
      examples/chef/telink/main.cpp
  34. 8 19
      examples/chef/telink/prj.conf
  35. 1 1
      examples/contact-sensor-app/telink/CMakeLists.txt
  36. 19 0
      examples/contact-sensor-app/telink/Kconfig
  37. 7 10
      examples/contact-sensor-app/telink/README.md
  38. 1 0
      examples/contact-sensor-app/telink/include/AppConfig.h
  39. 0 7
      examples/contact-sensor-app/telink/include/CHIPProjectConfig.h
  40. 12 20
      examples/contact-sensor-app/telink/prj.conf
  41. 0 7
      examples/contact-sensor-app/telink/src/AppTask.cpp
  42. 1 1
      examples/light-switch-app/telink/CMakeLists.txt
  43. 19 0
      examples/light-switch-app/telink/Kconfig
  44. 7 10
      examples/light-switch-app/telink/README.md
  45. 2 1
      examples/light-switch-app/telink/include/AppConfig.h
  46. 0 7
      examples/light-switch-app/telink/include/CHIPProjectConfig.h
  47. 11 19
      examples/light-switch-app/telink/prj.conf
  48. 0 7
      examples/light-switch-app/telink/src/AppTask.cpp
  49. 1 1
      examples/lighting-app/telink/CMakeLists.txt
  50. 19 0
      examples/lighting-app/telink/Kconfig
  51. 7 10
      examples/lighting-app/telink/README.md
  52. 1 0
      examples/lighting-app/telink/include/AppConfig.h
  53. 0 7
      examples/lighting-app/telink/include/CHIPProjectConfig.h
  54. 11 19
      examples/lighting-app/telink/prj.conf
  55. 0 7
      examples/lighting-app/telink/src/AppTask.cpp
  56. 1 1
      examples/lock-app/telink/CMakeLists.txt
  57. 19 0
      examples/lock-app/telink/Kconfig
  58. 7 10
      examples/lock-app/telink/README.md
  59. 2 1
      examples/lock-app/telink/include/AppConfig.h
  60. 0 7
      examples/lock-app/telink/include/CHIPProjectConfig.h
  61. 11 19
      examples/lock-app/telink/prj.conf
  62. 0 7
      examples/lock-app/telink/src/AppTask.cpp
  63. 0 82
      examples/lock-app/telink/src/main.cpp
  64. 1 1
      examples/ota-requestor-app/telink/CMakeLists.txt
  65. 19 0
      examples/ota-requestor-app/telink/Kconfig
  66. 7 10
      examples/ota-requestor-app/telink/Readme.md
  67. 1 0
      examples/ota-requestor-app/telink/include/AppConfig.h
  68. 0 7
      examples/ota-requestor-app/telink/include/CHIPProjectConfig.h
  69. 17 20
      examples/ota-requestor-app/telink/prj.conf
  70. 0 7
      examples/ota-requestor-app/telink/src/AppTask.cpp
  71. 2 0
      examples/platform/telink/common/include/AppTaskCommon.h
  72. 13 1
      examples/platform/telink/common/src/AppTaskCommon.cpp
  73. 6 4
      examples/platform/telink/common/src/mainCommon.cpp
  74. 7 2
      examples/platform/telink/project_include/OpenThreadConfig.h
  75. 1 1
      examples/pump-app/telink/CMakeLists.txt
  76. 19 0
      examples/pump-app/telink/Kconfig
  77. 7 10
      examples/pump-app/telink/README.md
  78. 2 1
      examples/pump-app/telink/include/AppConfig.h
  79. 0 7
      examples/pump-app/telink/include/CHIPProjectConfig.h
  80. 13 21
      examples/pump-app/telink/prj.conf
  81. 0 7
      examples/pump-app/telink/src/AppTask.cpp
  82. 1 1
      examples/pump-controller-app/telink/CMakeLists.txt
  83. 19 0
      examples/pump-controller-app/telink/Kconfig
  84. 7 10
      examples/pump-controller-app/telink/README.md
  85. 2 1
      examples/pump-controller-app/telink/include/AppConfig.h
  86. 0 7
      examples/pump-controller-app/telink/include/CHIPProjectConfig.h
  87. 11 19
      examples/pump-controller-app/telink/prj.conf
  88. 0 7
      examples/pump-controller-app/telink/src/AppTask.cpp
  89. 1 1
      examples/resource-monitoring-app/telink/CMakeLists.txt
  90. 19 0
      examples/resource-monitoring-app/telink/Kconfig
  91. 7 10
      examples/resource-monitoring-app/telink/README.md
  92. 1 0
      examples/resource-monitoring-app/telink/include/AppConfig.h
  93. 0 7
      examples/resource-monitoring-app/telink/include/CHIPProjectConfig.h
  94. 11 19
      examples/resource-monitoring-app/telink/prj.conf
  95. 0 7
      examples/resource-monitoring-app/telink/src/AppTask.cpp
  96. 1 1
      examples/shell/telink/CMakeLists.txt
  97. 19 0
      examples/shell/telink/Kconfig
  98. 7 10
      examples/shell/telink/README.md
  99. 0 7
      examples/shell/telink/include/CHIPProjectConfig.h
  100. 8 20
      examples/shell/telink/prj.conf

+ 1 - 1
.github/workflows/chef.yaml

@@ -96,7 +96,7 @@ jobs:
         if: github.actor != 'restyled-io[bot]'
 
         container:
-            image: ghcr.io/project-chip/chip-build-telink:10
+            image: ghcr.io/project-chip/chip-build-telink:12
             options: --user root
 
         steps:

+ 1 - 1
.github/workflows/examples-telink.yaml

@@ -36,7 +36,7 @@ jobs:
         if: github.actor != 'restyled-io[bot]'
 
         container:
-            image: ghcr.io/project-chip/chip-build-telink:10
+            image: ghcr.io/project-chip/chip-build-telink:12
             volumes:
                 - "/tmp/bloat_reports:/tmp/bloat_reports"
 

+ 0 - 147
config/telink/app/zephyr.conf

@@ -1,147 +0,0 @@
-#
-#   Copyright (c) 2021-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.
-#
-
-CONFIG_CHIP=y
-CONFIG_STD_CPP17=y
-
-# Logging (set CONFIG_SERIAL to 'y' to enable logging and 'n' to disable logging)
-CONFIG_SERIAL=y
-CONFIG_LOG=y
-CONFIG_LOG_MODE_MINIMAL=y
-CONFIG_PRINTK=y
-# CONFIG_ASSERT=y
-CONFIG_CBPRINTF_LIBC_SUBSTS=y
-
-# Set the maximum log level (DEBUG)
-CONFIG_LOG_DEFAULT_LEVEL=4
-CONFIG_MATTER_LOG_LEVEL_DBG=y
-CONFIG_MCUBOOT_BOOTUTIL_LIB=y
-CONFIG_MCUBOOT_UTIL_LOG_LEVEL_DBG=y
-CONFIG_NET_LOG=y
-CONFIG_IEEE802154_DRIVER_LOG_LEVEL_DBG=y
-CONFIG_NVS_LOG_LEVEL_DBG=y
-CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y
-CONFIG_OPENTHREAD_L2_LOG_LEVEL_DBG=y
-
-# Set the actual log level
-# - 0 OFF, logging is turned off
-# - 1 ERROR, maximal level set to LOG_LEVEL_ERR
-# - 2 WARNING, maximal level set to LOG_LEVEL_WRN
-# - 3 INFO, maximal level set to LOG_LEVEL_INFO
-# - 4 DEBUG, maximal level set to LOG_LEVEL_DBG
-CONFIG_LOG_MAX_LEVEL=3
-
-# Generic networking options
-CONFIG_NETWORKING=y
-CONFIG_NET_SOCKETS=y
-CONFIG_NET_SOCKETS_POSIX_NAMES=n
-CONFIG_NET_CONFIG_INIT_TIMEOUT=0
-
-# 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
-CONFIG_IDLE_STACK_SIZE=512
-
-# 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=y
-CONFIG_BT_DEBUG_LOG=n
-CONFIG_BT_PERIPHERAL=y
-CONFIG_BT_MAX_CONN=1
-CONFIG_BT_DEVICE_NAME_DYNAMIC=y
-CONFIG_BT_GATT_DYNAMIC_DB=y
-# CONFIG_BT_DEVICE_NAME_MAX=15
-CONFIG_BT_L2CAP_TX_MTU=247
-CONFIG_BT_BUF_ACL_RX_SIZE=251
-CONFIG_BT_BUF_ACL_TX_SIZE=251
-
-# L2 OpenThread enabling
-CONFIG_NET_L2_OPENTHREAD=y
-CONFIG_OPENTHREAD_DEBUG=y
-CONFIG_OPENTHREAD_L2_DEBUG=y
-
-# OpenThread configs
-CONFIG_OPENTHREAD_SLAAC=y
-CONFIG_OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE=608
-CONFIG_OPENTHREAD_MANUAL_START=y
-
-# mbedTLS tweaks
-CONFIG_MBEDTLS_TEST=y
-CONFIG_MBEDTLS_PKCS5_C=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=0
-CONFIG_OPENTHREAD_EXTERNAL_HEAP=y
-
-# Config dynamic interrupts to have posibility to switch between BLE/Thread radio drivers
-CONFIG_DYNAMIC_INTERRUPTS=y
-
-# Set multiplicator of Name Value Storage (NVS) as 1 to reach NVS sector size 4KB
-# nvs_sector_size = flash_page_size * mult = 4KB * 1 = 4KB
-CONFIG_SETTINGS_NVS_SECTOR_SIZE_MULT=1
-
-# Enable NVS lookup cache
-CONFIG_NVS_LOOKUP_CACHE=y
-CONFIG_NVS_LOOKUP_CACHE_SIZE=2048
-
-# Reboot system when fault happened
-CONFIG_TELINK_B9X_REBOOT_ON_FAULT=y
-
-# Shell settings
-CONFIG_SHELL=n
-
-# BLE MAC address
-CONFIG_B9X_BLE_CTRL_MAC_FLASH_ADDR=0x1FE000
-
-# getopt version
-CONFIG_GETOPT_LONG=y
-
-# flash stream functionality
-CONFIG_STREAM_FLASH=y
-CONFIG_STREAM_FLASH_ERASE=y
-
-# In current config/zephyr/Kconfig
-# next deprecated values are selected
-# warning: Deprecated symbol CPLUSPLUS is enabled.
-# warning: Deprecated symbol LIB_CPLUSPLUS is enabled.
-# new one are:
-# CONFIG_CPP
-# CONFIG_LIBCPP_IMPLEMENTATION
-# See https://docs.zephyrproject.org/latest/releases/release-notes-3.3.html
-# Since not only Telink is using Zephyr just suppress warnings
-CONFIG_WARN_DEPRECATED=n

+ 2 - 2
config/telink/chip-gn/args.gni

@@ -20,8 +20,8 @@ chip_device_platform = "telink"
 
 chip_build_tests = false
 
-chip_project_config_include = ""
-chip_system_project_config_include = ""
+chip_project_config_include = "<CHIPProjectConfig.h>"
+chip_system_project_config_include = "<CHIPProjectConfig.h>"
 chip_ble_project_config_include = ""
 
 chip_crypto = "mbedtls"

+ 4 - 0
config/telink/chip-module/CMakeLists.txt

@@ -52,6 +52,8 @@ if (CONFIG_POSIX_API)
     matter_add_flags(-isystem${ZEPHYR_BASE}/include/zephyr/posix)
 endif()
 
+matter_add_flags(-DNL_ASSERT_USE_FLAGS_DEFAULT=1)
+
 zephyr_include_directories(${CHIP_ROOT}/src/platform/telink/)
 
 zephyr_get_compile_flags(ZEPHYR_CFLAGS_C C)
@@ -61,6 +63,8 @@ matter_add_cxxflags("${ZEPHYR_CFLAGS_CC}")
 zephyr_get_gnu_cpp_standard(ZEPHYR_GNU_CPP_STD)
 matter_add_cxxflags(${ZEPHYR_GNU_CPP_STD})
 
+matter_add_flags(-DMBEDTLS_USER_CONFIG_FILE=<telink-mbedtls-config.h>)
+
 # Set up custom OpenThread configuration
 
 if (CONFIG_CHIP_OPENTHREAD_CONFIG)

+ 14 - 10
config/telink/chip-module/Kconfig

@@ -16,9 +16,11 @@
 
 rsource "../../zephyr/Kconfig"
 
+if CHIP
+
 # See config/zephyr/Kconfig for full definition
 config CHIP_DEVICE_VENDOR_NAME
-	default "Telink semiconductor"
+	default "Telink Semiconductor"
 
 config CHIP_APP_LOG_LEVEL
 	int "Logging level in application"
@@ -33,17 +35,18 @@ config CHIP_APP_LOG_LEVEL
 # See config/zephyr/Kconfig for full definition
 config CHIP_OTA_REQUESTOR
 	bool
-	default y
-	imply BOOTLOADER_MCUBOOT
-	imply IMG_MANAGER
+	select BOOTLOADER_MCUBOOT
+	select IMG_MANAGER
+	select STREAM_FLASH
+	select STREAM_FLASH_ERASE
 
 config CHIP_OTA_REQUESTOR_BUFFER_SIZE
 	int "OTA Requestor image buffer size"
 	default 256
 	depends on CHIP_OTA_REQUESTOR
 	help
-	  Configures size of the buffer used by OTA Requestor when downloading and
-	  writing a new firmware image to flash.
+	  Configures the size of the buffer used by OTA Requestor when downloading
+	  and writing a new firmware image to flash.
 
 config CHIP_OTA_REQUESTOR_REBOOT_ON_APPLY
 	bool "Auto-reboot when firmware update is applied"
@@ -51,9 +54,9 @@ config CHIP_OTA_REQUESTOR_REBOOT_ON_APPLY
 	depends on CHIP_OTA_REQUESTOR
 	imply REBOOT
 	help
-	  When a user consents to apply a firmware update, and the update package is
-	  downloaded, reboot the device automatically to swap the old and the new
-	  firmware images.
+	  Reboots the device automatically after downloading a new firmware update
+	  to swap the old and the new firmware images. The reboot happens only when
+	  a user consents to apply the firmware update.
 
 # See config/zephyr/Kconfig for full definition
 config CHIP_OTA_IMAGE_BUILD
@@ -149,9 +152,10 @@ config CHIP_FACTORY_RESET_ERASE_NVS
 	bool
 	default n
 
+endif
+
 config CHIP_LOG_SIZE_OPTIMIZATION
 	bool "Disable some detailed logs to decrease flash usage"
-	default y
 	help
 	  Disables some log levels for specific Matter log modules that provide
 	  information that is too detailed to be used in most cases. You can find

+ 264 - 0
config/telink/chip-module/Kconfig.defaults

@@ -0,0 +1,264 @@
+#
+#   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.
+#
+
+# The purpose of this file is to define new default values of settings used when building Matter samples.
+# This file only changes defaults and thus all symbols here must be promptless
+# and safeguarded so that they only are applied when building Matter.
+
+if CHIP
+
+config LOG
+    default y
+
+if LOG
+
+choice LOG_MODE
+    default LOG_MODE_MINIMAL
+endchoice
+
+choice MATTER_LOG_LEVEL_CHOICE
+    default MATTER_LOG_LEVEL_INF
+endchoice
+
+config CHIP_APP_LOG_LEVEL
+    default 3 # info
+
+config LOG_DEFAULT_LEVEL
+    default 1 # error
+
+config CHIP_LOG_SIZE_OPTIMIZATION
+    default y
+
+endif
+
+config SHELL
+    default y if CHIP_LIB_SHELL
+
+config PTHREAD_IPC
+    bool
+    default n
+
+config POSIX_MAX_FDS
+    int
+    default 16
+
+# Application stack size
+config MAIN_STACK_SIZE
+    default 3240 if PM
+    default 4096
+
+config INIT_STACKS
+    default y
+
+config IDLE_STACK_SIZE
+    default 387 if PM
+
+config ISR_STACK_SIZE
+    default 502 if PM
+
+config SYSTEM_WORKQUEUE_STACK_SIZE
+    default 616 if PM
+
+config HEAP_MEM_POOL_SIZE
+    default 128 if PM
+
+config NET_IPV6_MLD
+    default n
+
+# Network buffers
+config NET_PKT_RX_COUNT
+    default 4 if PM
+    default 8
+
+config NET_PKT_TX_COUNT
+    default 4 if PM
+    default 8
+
+config NET_BUF_RX_COUNT
+    default 16 if PM
+    default 32
+
+config NET_BUF_TX_COUNT
+    default 16 if PM
+    default 32
+
+# Bluetooth Low Energy configs
+
+config BT
+    default y
+
+config BT_PERIPHERAL
+    default y
+
+config BT_GATT_DYNAMIC_DB
+    default y
+
+config BT_DEVICE_NAME_DYNAMIC
+    default y
+
+config BT_DEVICE_NAME_MAX
+    default 15
+
+config BT_MAX_CONN
+    default 1
+
+config BT_L2CAP_TX_MTU
+    default 247
+
+config BT_BUF_ACL_RX_SIZE
+    default 251
+
+config BT_BUF_ACL_TX_SIZE
+    default 251
+
+config BT_RX_STACK_SIZE
+    default 810
+
+config BT_HCI_TX_STACK_SIZE
+    default 640
+
+config BT_DEVICE_NAME_GATT_WRITABLE
+    bool
+    default n
+
+config B9X_BLE_CTRL_THREAD_STACK_SIZE
+    default 576
+
+config B9X_BLE_CTRL_MASTER_MAX_NUM
+    default 0
+
+config B9X_BLE_CTRL_SLAVE_MAX_NUM
+    default 1
+
+choice B9X_BLE_CTRL_MAC_TYPE
+    default B9X_BLE_CTRL_MAC_TYPE_RANDOM_STATIC
+endchoice
+
+# Config dynamic interrupts to have posibility to switch between BLE/Thread radio drivers
+config DYNAMIC_INTERRUPTS
+    default y
+
+config CHIP_OTA_REQUESTOR
+    default y
+
+# In current config/zephyr/Kconfig
+# next deprecated values are selected
+# warning: Deprecated symbol CPLUSPLUS is enabled.
+# warning: Deprecated symbol LIB_CPLUSPLUS is enabled.
+# new one are:
+# CONFIG_CPP
+# CONFIG_LIBCPP_IMPLEMENTATION
+# See https://docs.zephyrproject.org/latest/releases/release-notes-3.3.html
+# Since not only Telink is using Zephyr just suppress warnings
+config WARN_DEPRECATED
+    default n
+
+# Reboot system when fault happened
+config TELINK_B9X_REBOOT_ON_FAULT
+    default y
+
+config NVS_LOOKUP_CACHE
+    default y
+
+config NVS_LOOKUP_CACHE_SIZE
+    default 2048 if !PM
+
+# Set multiplicator of Name Value Storage (NVS) as 1 to reach NVS sector size 4KB
+# nvs_sector_size = flash_page_size * mult = 4KB * 1 = 4KB
+config SETTINGS_NVS_SECTOR_SIZE_MULT
+    default 1
+
+# Enable OpenThread
+
+config NET_L2_OPENTHREAD
+    default y
+
+choice CHIP_THREAD_DEVICE_ROLE
+    prompt "Thread network device role"
+    default CHIP_THREAD_DEVICE_ROLE_ROUTER
+config CHIP_THREAD_DEVICE_ROLE_ROUTER
+	depends on !PM
+	bool "thread device router"
+config CHIP_THREAD_DEVICE_ROLE_END_DEVICE
+	depends on !PM
+	bool "thread end device"
+config CHIP_THREAD_DEVICE_ROLE_SLEEPY_END_DEVICE
+	bool "thread sleepy end device"
+endchoice
+
+choice OPENTHREAD_DEVICE_TYPE
+	default OPENTHREAD_FTD if CHIP_THREAD_DEVICE_ROLE_ROUTER
+	default OPENTHREAD_MTD if CHIP_THREAD_DEVICE_ROLE_END_DEVICE || CHIP_THREAD_DEVICE_ROLE_SLEEPY_END_DEVICE
+endchoice
+
+config CHIP_ENABLE_ICD_SUPPORT
+	default y if CHIP_THREAD_DEVICE_ROLE_SLEEPY_END_DEVICE
+
+config OPENTHREAD_THREAD_STACK_SIZE
+    default 2178 if PM
+
+config OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE
+    default 361 if PM
+    default 608
+
+config OPENTHREAD_SLAAC
+    default y
+
+config OPENTHREAD_MANUAL_START
+    default y
+
+config NET_TX_STACK_SIZE
+    default 554 if PM
+
+config NET_RX_STACK_SIZE
+    default 554 if PM
+
+# Disable certain parts of Zephyr IPv6 stack
+config NET_IPV6_NBR_CACHE
+    bool
+    default n
+
+config NET_MAX_CONN
+    default 1
+
+config NET_MAX_CONTEXTS
+    default 1
+
+config NET_CONFIG_INIT_TIMEOUT
+    default 0
+
+# mbedTLS tweaks
+config MBEDTLS_USER_CONFIG_ENABLE
+    default y
+
+config MBEDTLS_USER_CONFIG_FILE
+    default "telink-mbedtls-config.h"
+
+config MBEDTLS_ENABLE_HEAP
+    default y
+
+# TBD: Something wrong with this heap. Need to be investigated. Cirrently just set minimal size
+config MBEDTLS_HEAP_SIZE
+    default 0
+
+config OPENTHREAD_EXTERNAL_HEAP
+    default y
+
+# getopt version
+config GETOPT_LONG
+    default y
+
+endif

+ 1 - 1
examples/all-clusters-app/telink/CMakeLists.txt

@@ -41,7 +41,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/all-clusters-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink All Clusters Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/all-clusters-app/telink/Readme.md

@@ -8,35 +8,32 @@ creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 1 - 0
examples/all-clusters-app/telink/include/AppConfig.h

@@ -20,6 +20,7 @@
 
 // ---- All Clusters Application example config ----
 #define APP_USE_EXAMPLE_START_BUTTON 0
+#define APP_USE_BLE_START_BUTTON 0
 #define APP_USE_THREAD_START_BUTTON 1
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1

+ 0 - 7
examples/all-clusters-app/telink/include/CHIPProjectConfig.h

@@ -31,13 +31,6 @@
 #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
-
 // All clusters app has 3 group endpoints. This needs to defined here so that
 // CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured.
 #define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3

+ 15 - 19
examples/all-clusters-app/telink/prj.conf

@@ -18,48 +18,44 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
-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
 # CHIP PID: 32769 == 0x8001 (all-clusters-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32769
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkApp"
+
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n
 
 # Enable Power Management
 CONFIG_PM=n
+
+# Custom RF power values
+CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
+CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9

+ 0 - 7
examples/all-clusters-app/telink/src/AppTask.cpp

@@ -35,12 +35,5 @@ CHIP_ERROR AppTask::Init(void)
         return err;
     }
 
-    err = ConnectivityMgr().SetBLEDeviceName("TelinkApp");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }

+ 1 - 1
examples/all-clusters-minimal-app/telink/CMakeLists.txt

@@ -41,7 +41,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/all-clusters-minimal-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink All Clusters Minimal Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/all-clusters-minimal-app/telink/Readme.md

@@ -8,35 +8,32 @@ for creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 1 - 0
examples/all-clusters-minimal-app/telink/include/AppConfig.h

@@ -21,6 +21,7 @@
 // ---- All Clusters Minimal Application example config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 0
+#define APP_USE_BLE_START_BUTTON 0
 #define APP_USE_THREAD_START_BUTTON 0
 #define APP_SET_DEVICE_INFO_PROVIDER 0
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1

+ 0 - 7
examples/all-clusters-minimal-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 18 - 19
examples/all-clusters-minimal-app/telink/prj.conf

@@ -18,43 +18,42 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
-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
 # CHIP PID: 32769 == 0x8001 (all-clusters-minimal-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32769
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkMinApp"
+
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support.
+# 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_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
+CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9

+ 0 - 7
examples/all-clusters-minimal-app/telink/src/AppTask.cpp

@@ -35,12 +35,5 @@ CHIP_ERROR AppTask::Init()
         return err;
     }
 
-    err = ConnectivityMgr().SetBLEDeviceName("TelinkMinApp");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }

+ 1 - 1
examples/bridge-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/bridge-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Bridge Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/bridge-app/telink/README.md

@@ -85,35 +85,32 @@ defined:
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 1 - 0
examples/bridge-app/telink/include/AppConfig.h

@@ -21,6 +21,7 @@
 // ---- Bridge App Example Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 1
+#define APP_USE_BLE_START_BUTTON 0
 #define APP_USE_THREAD_START_BUTTON 1
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0

+ 0 - 7
examples/bridge-app/telink/include/CHIPProjectConfig.h

@@ -35,10 +35,3 @@
 //  Until this is improved in OpenThread we need to increase the retransmission
 //  interval to survive the stall.
 #define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (1000_ms32)
-
-/**
- * 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

+ 13 - 21
examples/bridge-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=n
-CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
-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
-# 32769 == 0x8001 (example all-clusters-app), otherwise GoogleHome fails commissioning
-CONFIG_CHIP_DEVICE_PRODUCT_ID=32769
-CONFIG_CHIP_DEVICE_TYPE=65535
+# 32770 == 0x8002 (example bridge-app)
+CONFIG_CHIP_DEVICE_PRODUCT_ID=32770
+
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkBridge"
 
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/bridge-app/telink/src/AppTask.cpp

@@ -413,13 +413,6 @@ CHIP_ERROR AppTask::Init(void)
 #endif
     InitCommonParts();
 
-    err = ConnectivityMgr().SetBLEDeviceName("TelinkLight");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     memset(gDevices, 0, sizeof(gDevices));
 
     gLight1.SetReachable(true);

+ 0 - 82
examples/bridge-app/telink/src/main.cpp

@@ -1,82 +0,0 @@
-/*
- *
- *    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.
- */
-
-#include "AppTask.h"
-
-#include <lib/support/CHIPMem.h>
-#include <platform/CHIPDeviceLayer.h>
-
-#include <zephyr/kernel.h>
-
-LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL);
-
-using namespace ::chip;
-using namespace ::chip::Inet;
-using namespace ::chip::DeviceLayer;
-
-int main(void)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    err = chip::Platform::MemoryInit();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("MemoryInit fail");
-        goto exit;
-    }
-
-    err = PlatformMgr().InitChipStack();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("InitChipStack fail");
-        goto exit;
-    }
-
-    err = PlatformMgr().StartEventLoopTask();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("StartEventLoopTask fail");
-        goto exit;
-    }
-
-    err = ThreadStackMgr().InitThreadStack();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("InitThreadStack fail");
-        goto exit;
-    }
-
-#ifdef CONFIG_OPENTHREAD_MTD_SED
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
-#elif CONFIG_OPENTHREAD_MTD
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
-#else
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
-#endif
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetThreadDeviceType fail");
-        goto exit;
-    }
-
-    err = GetAppTask().StartApp();
-
-exit:
-    LOG_ERR("Exit err %" CHIP_ERROR_FORMAT, err.Format());
-    return (err == CHIP_NO_ERROR) ? EXIT_SUCCESS : EXIT_FAILURE;
-}

+ 0 - 7
examples/chef/telink/CHIPProjectConfig.h

@@ -31,13 +31,6 @@
 #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
 

+ 1 - 1
examples/chef/telink/CMakeLists.txt

@@ -47,7 +47,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/chef/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Chef Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 6 - 2
examples/chef/telink/main.cpp

@@ -76,10 +76,14 @@ int main()
         return 1;
     }
 
-#ifdef CONFIG_OPENTHREAD_MTD
+#if defined(CONFIG_CHIP_THREAD_DEVICE_ROLE_ROUTER)
+    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
+#elif defined(CONFIG_CHIP_THREAD_DEVICE_ROLE_END_DEVICE)
     err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
+#elif defined(CONFIG_CHIP_THREAD_DEVICE_ROLE_SLEEPY_END_DEVICE)
+    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
 #else
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
+#error THREAD_DEVICE_ROLE not selected
 #endif
     if (err != CHIP_NO_ERROR)
     {

+ 8 - 19
examples/chef/telink/prj.conf

@@ -18,47 +18,36 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_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="CHIPProjectConfig.h"
 CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h"
 
-CONFIG_CHIP_DEVICE_VENDOR_ID=65521
 # 32774 == 0x8006 (example contact-sensor-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32769
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 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
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 CONFIG_OPENTHREAD_SHELL=n
 CONFIG_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 1 - 1
examples/contact-sensor-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/contact-sensor-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Contact Sensor Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/contact-sensor-app/telink/README.md

@@ -6,35 +6,32 @@ You can use this example as a reference for creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 1 - 0
examples/contact-sensor-app/telink/include/AppConfig.h

@@ -20,6 +20,7 @@
 
 // ---- All Clusters Application example config ----
 #define APP_USE_EXAMPLE_START_BUTTON 1
+#define APP_USE_BLE_START_BUTTON 0
 #define APP_USE_THREAD_START_BUTTON 0
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0

+ 0 - 7
examples/contact-sensor-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 12 - 20
examples/contact-sensor-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_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
 # 32774 == 0x8006 (example contact-sensor-app)
-CONFIG_CHIP_DEVICE_PRODUCT_ID=32769
-CONFIG_CHIP_DEVICE_TYPE=65535
+CONFIG_CHIP_DEVICE_PRODUCT_ID=32774
+
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkSensor"
 
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/contact-sensor-app/telink/src/AppTask.cpp

@@ -49,13 +49,6 @@ CHIP_ERROR AppTask::Init(void)
 
     ContactSensorMgr().SetCallback(OnStateChanged);
 
-    CHIP_ERROR err = ConnectivityMgr().SetBLEDeviceName("TelinkSensor");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }
 

+ 1 - 1
examples/light-switch-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/light-switch-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Light Switch Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/light-switch-app/telink/README.md

@@ -11,35 +11,32 @@ creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 2 - 1
examples/light-switch-app/telink/include/AppConfig.h

@@ -21,7 +21,8 @@
 // ---- Light Switch Example App Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 1
-#define APP_USE_THREAD_START_BUTTON 1
+#define APP_USE_BLE_START_BUTTON 0
+#define APP_USE_THREAD_START_BUTTON 0
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
 #define APP_USE_IDENTIFY_PWM 1

+ 0 - 7
examples/light-switch-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 11 - 19
examples/light-switch-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_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
 # 32772 == 0x8004 (example light-switch-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32772
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkSwitch"
+
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/light-switch-app/telink/src/AppTask.cpp

@@ -38,13 +38,6 @@ CHIP_ERROR AppTask::Init(void)
         return err;
     }
 
-    err = ConnectivityMgr().SetBLEDeviceName("TelinkSwitch");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }
 

+ 1 - 1
examples/lighting-app/telink/CMakeLists.txt

@@ -57,7 +57,7 @@ else()
   set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE}  ${LOCAL_DTC_OVERLAY_FILE})
 endif()
 
-set(CONF_FILE ${CHIP_ROOT}/config/telink/app/zephyr.conf ${USB_CONF_OVERLAY_FILE} prj.conf)
+set(CONF_FILE ${USB_CONF_OVERLAY_FILE} prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/lighting-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Lighting Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/lighting-app/telink/README.md

@@ -9,35 +9,32 @@ a reference for creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 1 - 0
examples/lighting-app/telink/include/AppConfig.h

@@ -21,6 +21,7 @@
 // ---- Lighting Example App Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 1
+#define APP_USE_BLE_START_BUTTON 1
 #define APP_USE_THREAD_START_BUTTON 1
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0

+ 0 - 7
examples/lighting-app/telink/include/CHIPProjectConfig.h

@@ -35,10 +35,3 @@
 //  Until this is improved in OpenThread we need to increase the retransmission
 //  interval to survive the stall.
 #define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (1000_ms32)
-
-/**
- * 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

+ 11 - 19
examples/lighting-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=n
-CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
-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
 # 32773 == 0x8005 (example lighting-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32773
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkLight"
+
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/lighting-app/telink/src/AppTask.cpp

@@ -90,13 +90,6 @@ CHIP_ERROR AppTask::Init(void)
 #endif
     InitCommonParts();
 
-    err = ConnectivityMgr().SetBLEDeviceName("TelinkLight");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }
 

+ 1 - 1
examples/lock-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/lock-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Lock Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/lock-app/telink/README.md

@@ -9,35 +9,32 @@ a reference for creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 2 - 1
examples/lock-app/telink/include/AppConfig.h

@@ -21,7 +21,8 @@
 // ---- Lock Example App Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 1
-#define APP_USE_THREAD_START_BUTTON 1
+#define APP_USE_BLE_START_BUTTON 0
+#define APP_USE_THREAD_START_BUTTON 0
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
 #define APP_USE_IDENTIFY_PWM 1

+ 0 - 7
examples/lock-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 11 - 19
examples/lock-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_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
 # 32774 == 0x8006 (example lock-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32774
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkLock"
+
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/lock-app/telink/src/AppTask.cpp

@@ -50,13 +50,6 @@ CHIP_ERROR AppTask::Init(void)
     // Disable auto-relock time feature.
     DoorLockServer::Instance().SetAutoRelockTime(kExampleEndpointId, 0);
 
-    CHIP_ERROR err = ConnectivityMgr().SetBLEDeviceName("Telink Lock");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }
 

+ 0 - 82
examples/lock-app/telink/src/main.cpp

@@ -1,82 +0,0 @@
-/*
- *
- *    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.
- */
-
-#include "AppTask.h"
-
-#include <lib/support/CHIPMem.h>
-#include <platform/CHIPDeviceLayer.h>
-
-#include <zephyr/kernel.h>
-
-LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL);
-
-using namespace ::chip;
-using namespace ::chip::Inet;
-using namespace ::chip::DeviceLayer;
-
-int main(void)
-{
-    CHIP_ERROR err = CHIP_NO_ERROR;
-
-    err = chip::Platform::MemoryInit();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("MemoryInit fail");
-        goto exit;
-    }
-
-    err = PlatformMgr().InitChipStack();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("InitChipStack fail");
-        goto exit;
-    }
-
-    err = PlatformMgr().StartEventLoopTask();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("StartEventLoopTask fail");
-        goto exit;
-    }
-
-    err = ThreadStackMgr().InitThreadStack();
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("InitThreadStack fail");
-        goto exit;
-    }
-
-#ifdef CONFIG_OPENTHREAD_MTD_SED
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
-#elif CONFIG_OPENTHREAD_MTD
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
-#else
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
-#endif
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetThreadDeviceType fail");
-        goto exit;
-    }
-
-    err = GetAppTask().StartApp();
-
-exit:
-    LOG_ERR("Exit err %" CHIP_ERROR_FORMAT, err.Format());
-    return (err == CHIP_NO_ERROR) ? EXIT_SUCCESS : EXIT_FAILURE;
-}

+ 1 - 1
examples/ota-requestor-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/ota-requestor-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink OTA Requestor Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/ota-requestor-app/telink/Readme.md

@@ -2,35 +2,32 @@
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 1 - 0
examples/ota-requestor-app/telink/include/AppConfig.h

@@ -21,6 +21,7 @@
 // ---- OTA Requestor Example App Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 0
+#define APP_USE_BLE_START_BUTTON 0
 #define APP_USE_THREAD_START_BUTTON 1
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 1

+ 0 - 7
examples/ota-requestor-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 17 - 20
examples/ota-requestor-app/telink/prj.conf

@@ -18,48 +18,45 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
-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=y
-
 # 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
-# CONFIG_CHIP_DEVICE_PRODUCT_ID=32773
-CONFIG_CHIP_DEVICE_TYPE=65535
+# 32776 == 0x8008 (example ota-requestor-app)
+CONFIG_CHIP_DEVICE_PRODUCT_ID=32776
+
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkOTAReq"
 
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=y
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# Disable factory data support. 
+# 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
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
 # Enable Power Management
 CONFIG_PM=n
+
+# Custom RF power values
+CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
+CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9

+ 0 - 7
examples/ota-requestor-app/telink/src/AppTask.cpp

@@ -26,12 +26,5 @@ CHIP_ERROR AppTask::Init(void)
 {
     InitCommonParts();
 
-    CHIP_ERROR err = ConnectivityMgr().SetBLEDeviceName("TelinkOTAReq");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }

+ 2 - 0
examples/platform/telink/common/include/AppTaskCommon.h

@@ -94,8 +94,10 @@ protected:
     static void FactoryResetButtonEventHandler(void);
     static void FactoryResetHandler(AppEvent * aEvent);
 
+#if APP_USE_BLE_START_BUTTON
     static void StartBleAdvButtonEventHandler(void);
     static void StartBleAdvHandler(AppEvent * aEvent);
+#endif
 
 #if APP_USE_THREAD_START_BUTTON
     static void StartThreadButtonEventHandler(void);

+ 13 - 1
examples/platform/telink/common/src/AppTaskCommon.cpp

@@ -48,7 +48,9 @@ constexpr int kAppEventQueueSize       = 10;
 
 #if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE
 const struct gpio_dt_spec sFactoryResetButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_1), gpios);
-const struct gpio_dt_spec sBleStartButtonDt     = GPIO_DT_SPEC_GET(DT_NODELABEL(key_2), gpios);
+#if APP_USE_BLE_START_BUTTON
+const struct gpio_dt_spec sBleStartButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_2), gpios);
+#endif
 #if APP_USE_THREAD_START_BUTTON
 const struct gpio_dt_spec sThreadStartButtonDt = GPIO_DT_SPEC_GET(DT_NODELABEL(key_3), gpios);
 #endif
@@ -85,7 +87,9 @@ LEDWidget sStatusLED;
 #endif
 
 Button sFactoryResetButton;
+#if APP_USE_BLE_START_BUTTON
 Button sBleAdvStartButton;
+#endif
 #if APP_USE_EXAMPLE_START_BUTTON
 Button sExampleActionButton;
 #endif
@@ -371,7 +375,9 @@ void AppTaskCommon::InitButtons(void)
 {
 #if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE
     sFactoryResetButton.Configure(&sFactoryResetButtonDt, FactoryResetButtonEventHandler);
+#if APP_USE_BLE_START_BUTTON
     sBleAdvStartButton.Configure(&sBleStartButtonDt, StartBleAdvButtonEventHandler);
+#endif
 #if APP_USE_EXAMPLE_START_BUTTON
     if (ExampleActionEventHandler)
     {
@@ -383,7 +389,9 @@ void AppTaskCommon::InitButtons(void)
 #endif
 #else
     sFactoryResetButton.Configure(&sButtonRow1Dt, &sButtonCol1Dt, FactoryResetButtonEventHandler);
+#if APP_USE_BLE_START_BUTTON
     sBleAdvStartButton.Configure(&sButtonRow2Dt, &sButtonCol2Dt, StartBleAdvButtonEventHandler);
+#endif
 #if APP_USE_EXAMPLE_START_BUTTON
     if (ExampleActionEventHandler)
     {
@@ -396,7 +404,9 @@ void AppTaskCommon::InitButtons(void)
 #endif
 
     ButtonManagerInst().AddButton(sFactoryResetButton);
+#if APP_USE_BLE_START_BUTTON
     ButtonManagerInst().AddButton(sBleAdvStartButton);
+#endif
 #if APP_USE_THREAD_START_BUTTON
     ButtonManagerInst().AddButton(sThreadStartButton);
 #endif
@@ -511,6 +521,7 @@ void AppTaskCommon::IdentifyEffectHandler(Clusters::Identify::EffectIdentifierEn
 }
 #endif
 
+#if APP_USE_BLE_START_BUTTON
 void AppTaskCommon::StartBleAdvButtonEventHandler(void)
 {
     AppEvent event;
@@ -543,6 +554,7 @@ void AppTaskCommon::StartBleAdvHandler(AppEvent * aEvent)
         LOG_ERR("OpenBasicCommissioningWindow fail");
     }
 }
+#endif
 
 void AppTaskCommon::FactoryResetButtonEventHandler(void)
 {

+ 6 - 4
examples/platform/telink/common/src/mainCommon.cpp

@@ -142,12 +142,14 @@ int main(void)
         goto exit;
     }
 
-#ifdef CONFIG_CHIP_ENABLE_ICD_SUPPORT
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
-#elif CONFIG_OPENTHREAD_MTD
+#if defined(CONFIG_CHIP_THREAD_DEVICE_ROLE_ROUTER)
+    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
+#elif defined(CONFIG_CHIP_THREAD_DEVICE_ROLE_END_DEVICE)
     err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
+#elif defined(CONFIG_CHIP_THREAD_DEVICE_ROLE_SLEEPY_END_DEVICE)
+    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
 #else
-    err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
+#error THREAD_DEVICE_ROLE not selected
 #endif
     if (err != CHIP_NO_ERROR)
     {

+ 7 - 2
examples/platform/telink/project_include/OpenThreadConfig.h

@@ -1,6 +1,6 @@
 /*
  *
- *    Copyright (c) 2021 Project CHIP Authors
+ *    Copyright (c) 2021-2023 Project CHIP Authors
  *    All rights reserved.
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,8 +25,13 @@
 // Project-specific settings
 #include "openthread/platform/logging.h"
 
+/* Number of message buffers reduced to save RAM */
 #undef OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
-#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 64
+#if CONFIG_PM
+#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
+#else
+#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 44
+#endif
 
 #define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART
 

+ 1 - 1
examples/pump-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/pump-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Pump Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/pump-app/telink/README.md

@@ -10,35 +10,32 @@ reference for creating your own pump application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 2 - 1
examples/pump-app/telink/include/AppConfig.h

@@ -21,7 +21,8 @@
 // ---- Pump Example App Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 1
-#define APP_USE_THREAD_START_BUTTON 1
+#define APP_USE_BLE_START_BUTTON 0
+#define APP_USE_THREAD_START_BUTTON 0
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
 #define APP_USE_IDENTIFY_PWM 1

+ 0 - 7
examples/pump-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 13 - 21
examples/pump-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_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
-# 32784 == 0x8010 (example pump-app)
-CONFIG_CHIP_DEVICE_PRODUCT_ID=32784
-CONFIG_CHIP_DEVICE_TYPE=65535
+# 32778 == 0x800A (example pump-app)
+CONFIG_CHIP_DEVICE_PRODUCT_ID=32778
+
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkPump"
 
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/pump-app/telink/src/AppTask.cpp

@@ -49,13 +49,6 @@ CHIP_ERROR AppTask::Init(void)
     PumpMgr().Init();
     PumpMgr().SetCallbacks(ActionInitiated, ActionCompleted);
 
-    CHIP_ERROR err = ConnectivityMgr().SetBLEDeviceName("Telink Pump");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }
 

+ 1 - 1
examples/pump-controller-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/pump-controller-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Pump Controller Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/pump-controller-app/telink/README.md

@@ -11,35 +11,32 @@ your own pump application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 2 - 1
examples/pump-controller-app/telink/include/AppConfig.h

@@ -21,7 +21,8 @@
 // ---- Pump Controller Example App Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 1
-#define APP_USE_THREAD_START_BUTTON 1
+#define APP_USE_BLE_START_BUTTON 0
+#define APP_USE_THREAD_START_BUTTON 0
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0
 #define APP_USE_IDENTIFY_PWM 1

+ 0 - 7
examples/pump-controller-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 11 - 19
examples/pump-controller-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_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
 # 32785 == 0x8011 (example pump-controller-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32785
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkPumpCntr"
+
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/pump-controller-app/telink/src/AppTask.cpp

@@ -47,13 +47,6 @@ CHIP_ERROR AppTask::Init(void)
     PumpMgr().Init();
     PumpMgr().SetCallbacks(ActionInitiated, ActionCompleted);
 
-    CHIP_ERROR err = ConnectivityMgr().SetBLEDeviceName("Telink Pump Controller");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }
 

+ 1 - 1
examples/resource-monitoring-app/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/resource-monitoring-app/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Resource Monitoring Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/resource-monitoring-app/telink/README.md

@@ -6,35 +6,32 @@ You can use this example as a reference for creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 1 - 0
examples/resource-monitoring-app/telink/include/AppConfig.h

@@ -21,6 +21,7 @@
 // ---- Air Quality Example App Config ----
 
 #define APP_USE_EXAMPLE_START_BUTTON 0
+#define APP_USE_BLE_START_BUTTON 0
 #define APP_USE_THREAD_START_BUTTON 0
 #define APP_SET_DEVICE_INFO_PROVIDER 1
 #define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0

+ 0 - 7
examples/resource-monitoring-app/telink/include/CHIPProjectConfig.h

@@ -30,10 +30,3 @@
 // 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

+ 11 - 19
examples/resource-monitoring-app/telink/prj.conf

@@ -18,45 +18,37 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-CONFIG_OPENTHREAD_MTD=y
-CONFIG_CHIP_ENABLE_ICD_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
 # CHIP PID: 32769 == 0x8001 (all-clusters-app)
 CONFIG_CHIP_DEVICE_PRODUCT_ID=32769
-CONFIG_CHIP_DEVICE_TYPE=65535
 
+# Bluetooth Low Energy configuration
+CONFIG_BT_DEVICE_NAME="TelinkResMon"
+
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1
-CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022"
 
 # Enable CHIP pairing automatically on application start.
 CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
 
-# CHIP shell
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=n
 
-# Disable factory data support. 
+# Disable factory data support.
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

+ 0 - 7
examples/resource-monitoring-app/telink/src/AppTask.cpp

@@ -61,12 +61,5 @@ CHIP_ERROR AppTask::Init(void)
     gHepaFilterInstance.Init();
     gActivatedCarbonFilterInstance.Init();
 
-    CHIP_ERROR err = ConnectivityMgr().SetBLEDeviceName("TelinkResMonDevice");
-    if (err != CHIP_NO_ERROR)
-    {
-        LOG_ERR("SetBLEDeviceName fail");
-        return err;
-    }
-
     return CHIP_NO_ERROR;
 }

+ 1 - 1
examples/shell/telink/CMakeLists.txt

@@ -40,7 +40,7 @@ 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)
+set(CONF_FILE  prj.conf)
 
 # Load NCS/Zephyr build system
 list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module)

+ 19 - 0
examples/shell/telink/Kconfig

@@ -0,0 +1,19 @@
+#
+#    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.
+#
+mainmenu "Matter Telink Shell Example Application"
+
+rsource "../../../config/telink/chip-module/Kconfig.defaults"
+source "Kconfig.zephyr"

+ 7 - 10
examples/shell/telink/README.md

@@ -6,35 +6,32 @@ You can use this example as a reference for creating your own application.
 
 ## Build and flash
 
-1. Pull docker image from repository:
+1. Run the Docker container:
 
     ```bash
-    $ docker pull ghcr.io/project-chip/chip-build-telink:10
+    $ docker run -it --rm -v $PWD:/host -w /host ghcr.io/project-chip/chip-build-telink:$(wget -q -O - https://raw.githubusercontent.com/project-chip/connectedhomeip/master/.github/workflows/examples-telink.yaml 2> /dev/null | grep chip-build-telink | awk -F: '{print $NF}')
     ```
 
-2. Run docker container:
+    Compatible docker image version can be found in next file:
 
     ```bash
-    $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10
+    $ .github/workflows/examples-telink.yaml
     ```
 
-    here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay
-    attention that OUTPUT_DIR should contains ABSOLUTE path to output dir**
-
-3. Activate the build environment:
+2. Activate the build environment:
 
     ```bash
     $ source ./scripts/activate.sh
     ```
 
-4. In the example dir run (replace _<build_target>_ with your board name, for
+3. In the example dir run (replace _<build_target>_ with your board name, for
    example, `tlsr9518adk80d` or `tlsr9528a`):
 
     ```bash
     $ west build -b <build_target>
     ```
 
-5. Flash binary:
+4. Flash binary:
 
     ```
     $ west flash --erase

+ 0 - 7
examples/shell/telink/include/CHIPProjectConfig.h

@@ -31,13 +31,6 @@
 #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
 

+ 8 - 20
examples/shell/telink/prj.conf

@@ -18,48 +18,36 @@
 # samples. This file should contain only options specific for this sample
 # or overrides of default values.
 
+# Enable CHIP
+CONFIG_CHIP=y
+CONFIG_STD_CPP17=y
+
 # enable GPIO
 CONFIG_GPIO=y
 
 # enable PWM
 CONFIG_PWM=y
 
-# OpenThread configs
-#CONFIG_OPENTHREAD_MTD=n
-CONFIG_OPENTHREAD_FTD=y
-# CONFIG_CHIP_ENABLE_ICD_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
 
+# Disable Matter OTA DFU
+CONFIG_CHIP_OTA_REQUESTOR=n
 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
+# Disable CHIP shell support
 CONFIG_CHIP_LIB_SHELL=y
 CONFIG_OPENTHREAD_SHELL=y
 CONFIG_SHELL=y
 
-# Disable factory data support. 
+# Disable factory data support
 CONFIG_CHIP_FACTORY_DATA=n
 CONFIG_CHIP_FACTORY_DATA_BUILD=n
 CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików