Skip to content

Commit 8c9ef98

Browse files
s07641069UR6LAL
andauthored
[Telink] Add W91 (TLSR9118BDK40D) base support (#33423)
* [Telink] Add W91 (TLSR9118BDK40D) * [Telink] Fix w91 OTA * [Telink] w91 add pwm pool (#336) * add pwm pool to w91 platform * add pwm pool for w91 platform Signed-off-by: Dmytro Kashkarov <ur6lal@gmail.com> --------- Signed-off-by: Dmytro Kashkarov <ur6lal@gmail.com> * [Telink] disable debug part * [Telink] restyled --------- Signed-off-by: Dmytro Kashkarov <ur6lal@gmail.com> Co-authored-by: Dmytro Kashkarov <114229220+UR6LAL@users.noreply.github.com>
1 parent 0588165 commit 8c9ef98

File tree

46 files changed

+1831
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1831
-88
lines changed

.github/workflows/chef.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
platform: telink
111111
# - name: Update Zephyr to specific revision (for developers purpose)
112112
# shell: bash
113-
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 65dc1812431bf946dfc110682298acf83d63e27a"
113+
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 68deadeb5c20b82d68700e720d4580e8003bf1d8"
114114
- name: CI Examples Telink
115115
shell: bash
116116
run: |

.github/workflows/examples-telink.yaml

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022-2023 Project CHIP Authors
1+
# Copyright (c) 2022-2024 Project CHIP Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ jobs:
5757
gh-context: ${{ toJson(github) }}
5858

5959
# - name: Update Zephyr to specific revision (for developers purpose)
60-
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 65dc1812431bf946dfc110682298acf83d63e27a"
60+
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 68deadeb5c20b82d68700e720d4580e8003bf1d8"
6161

6262
- name: Build example Telink (B92 retention) Air Quality Sensor App
6363
run: |
@@ -71,13 +71,13 @@ jobs:
7171
- name: clean out build output
7272
run: rm -rf ./out
7373

74-
- name: Build example Telink (B91) All Clusters App
74+
- name: Build example Telink (W91) All Clusters App
7575
run: |
7676
./scripts/run_in_build_env.sh \
77-
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-all-clusters' build"
77+
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-all-clusters' build"
7878
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
79-
telink tlsr9518adk80d all-clusters-app \
80-
out/telink-tlsr9518adk80d-all-clusters/zephyr/zephyr.elf \
79+
telink tlsr9118bdk40d all-clusters-app \
80+
out/telink-tlsr9118bdk40d-all-clusters/zephyr/zephyr.elf \
8181
/tmp/bloat_reports/
8282
8383
- name: clean out build output
@@ -129,6 +129,18 @@ jobs:
129129
- name: clean out build output (keep tools)
130130
run: rm -rf ./out/telink*
131131

132+
- name: Build example Telink (W91) Lighting App with OTA, Factory Data
133+
run: |
134+
./scripts/run_in_build_env.sh \
135+
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-light-ota-factory-data' build"
136+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
137+
telink tlsr9118bdk40d lighting-app-ota-factory-data \
138+
out/telink-tlsr9118bdk40d-light-ota-factory-data/zephyr/zephyr.elf \
139+
/tmp/bloat_reports/
140+
141+
- name: clean out build output (keep tools)
142+
run: rm -rf ./out/telink*
143+
132144
- name: Build example Telink (B91) Lighting App with OTA, RPC, Factory Data and 4Mb flash
133145
run: |
134146
./scripts/run_in_build_env.sh \
@@ -189,13 +201,13 @@ jobs:
189201
- name: clean out build output
190202
run: rm -rf ./out
191203

192-
- name: Build example Telink (B91) Pump Controller App
204+
- name: Build example Telink (W91) Pump Controller App
193205
run: |
194206
./scripts/run_in_build_env.sh \
195-
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-controller' build"
207+
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-pump-controller' build"
196208
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
197-
telink tlsr9518adk80d pump-controller-app \
198-
out/telink-tlsr9518adk80d-pump-controller/zephyr/zephyr.elf \
209+
telink tlsr9118bdk40d pump-controller-app \
210+
out/telink-tlsr9118bdk40d-pump-controller/zephyr/zephyr.elf \
199211
/tmp/bloat_reports/
200212
201213
- name: clean out build output

config/telink/app/bootloader.conf

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2023 Project CHIP Authors
2+
# Copyright (c) 2023-2024 Project CHIP Authors
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -41,8 +41,3 @@ CONFIG_BOOT_MAX_IMG_SECTORS=4096
4141
# - 3 INFO, default to write LOG_LEVEL_INFO
4242
# - 4 DEBUG, default to write LOG_LEVEL_DBG
4343
CONFIG_LOG_DEFAULT_LEVEL=1
44-
45-
# USB DFU configuration
46-
CONFIG_USB_DFU_WILL_DETACH=n
47-
CONFIG_BOOT_USB_DFU_GPIO=y
48-
CONFIG_MCUBOOT_INDICATION_LED=y

config/telink/app/bootloader_usb.conf

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
# USB DFU configuration
18+
CONFIG_USB_DFU_WILL_DETACH=n
19+
CONFIG_BOOT_USB_DFU_GPIO=y
20+
CONFIG_MCUBOOT_INDICATION_LED=y

config/telink/chip-module/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn_args.cmake)
4646
include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn.cmake)
4747

4848
# Prepare compiler flags
49+
matter_add_flags(-isystem${ZEPHYR_BASE}/../modules/crypto/mbedtls/include/)
4950

5051
if (CONFIG_POSIX_API)
5152
matter_add_flags(-D_DEFAULT_SOURCE)
@@ -102,6 +103,7 @@ matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_
102103
matter_add_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3)
103104
matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4)
104105
matter_add_gn_arg_bool ("chip_automation_logging" FALSE)
106+
matter_add_gn_arg_bool ("chip_enable_wifi" CONFIG_WIFI_W91)
105107
matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT)
106108

107109
if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
@@ -122,8 +124,12 @@ if (CONFIG_CHIP_ROTATING_DEVICE_ID)
122124
matter_add_gn_arg_bool("chip_enable_additional_data_advertising" "true")
123125
endif()
124126

125-
if (CONFIG_CHIP_ENABLE_DNSSD_SRP)
127+
if (CONFIG_NET_L2_OPENTHREAD)
126128
matter_add_gn_arg_string("chip_mdns" "platform")
129+
elseif(CONFIG_WIFI_W91)
130+
matter_add_gn_arg_string("chip_mdns" "minimal")
131+
else()
132+
matter_add_gn_arg_string("chip_mdns" "none")
127133
endif()
128134

129135
if (CONFIG_CHIP_PW_RPC)

config/telink/chip-module/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ config CHIP_LOG_SIZE_OPTIMIZATION
180180

181181
config CHIP_BUTTON_MANAGER_IRQ_MODE
182182
bool "Use GPIO in an IRQ mode instead of polling the GPIO"
183-
default PM
183+
default PM || BOARD_TLSR9118BDK40D
184184
help
185185
Use GPIO in an IRQ mode to avoid button polling loop and extend the battery lifetime by waking up by GPIO event.
186186
GPIO events are working only with GPIO IRQ. This option changes button matrix configuration.

config/telink/chip-module/Kconfig.defaults

+53-3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ config GPIO
108108
# Bluetooth Low Energy configs
109109

110110
config BT
111+
default n if BOARD_TLSR9118BDK40D
111112
default y
112113

113114
if BT
@@ -178,7 +179,7 @@ config PWM
178179
endif
179180

180181
# Board non-retention config
181-
if BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D
182+
if BOARD_TLSR9118BDK40D || BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D
182183
config PWM
183184
default y
184185
endif
@@ -224,7 +225,7 @@ config SETTINGS_NVS_SECTOR_COUNT
224225
# Enable OpenThread
225226

226227
config NET_L2_OPENTHREAD
227-
default y
228+
default y if !WIFI
228229

229230
if NET_L2_OPENTHREAD
230231

@@ -292,9 +293,58 @@ config NET_MAX_CONTEXTS
292293
config NET_CONFIG_INIT_TIMEOUT
293294
default 0
294295

296+
297+
config CHIP_WIFI
298+
bool "Enable Telink Wi-Fi support"
299+
default y if BOARD_TLSR9118BDK40D
300+
select WIFI_W91
301+
select WIFI
302+
select NET_STATISTICS
303+
select NET_L2_ETHERNET
304+
select NET_IPV6_ND # enable Neighbor Discovery to handle Router Advertisements
305+
select NET_IPV6_NBR_CACHE
306+
select NET_STATISTICS_USER_API
307+
308+
if CHIP_WIFI
309+
310+
config CHIP_WIFI_CONNECTION_RECOVERY_MINIMUM_INTERVAL
311+
int "Define the minimum connection recovery time interval in milliseconds"
312+
depends on CHIP_WIFI
313+
default 500
314+
help
315+
Specifies the minimum connection recovery interval (in milliseconds).
316+
317+
config CHIP_WIFI_CONNECTION_RECOVERY_MAXIMUM_INTERVAL
318+
int "Define the maximum connection recovery time interval in milliseconds"
319+
depends on CHIP_WIFI
320+
default 3600000 # 1 hour
321+
help
322+
Specifies the maximum connection recovery interval (in milliseconds).
323+
324+
config CHIP_WIFI_CONNECTION_RECOVERY_MAX_RETRIES_NUMBER
325+
int "Define the maximum amount of connection recovery occurrences"
326+
depends on CHIP_WIFI
327+
default 0
328+
help
329+
Specifies the maximum number of connection recovery attempts.
330+
If set to 0, no limitation is applied and attempts
331+
to recover the connection are performed indefinitely.
332+
333+
config CHIP_WIFI_CONNECTION_RECOVERY_JITTER
334+
int "Define the connection recovery jitter in milliseconds"
335+
depends on CHIP_WIFI
336+
default 2000
337+
help
338+
Specifies the maximum connection recovery jitter interval (in milliseconds).
339+
Once the wait time reaches the current maximum value (defined by CHIP_WIFI_CONNECTION_RECOVERY_MAXIMUM_INTERVAL),
340+
a random jitter interval is added to it to avoid periodicity. The random jitter is selected
341+
within range [-JITTER; +JITTER].
342+
343+
endif # CHIP_WIFI
344+
295345
config CHIP_ENABLE_PAIRING_AUTOSTART
296346
bool "Open commissioning window on boot"
297-
default y
347+
default y
298348
help
299349
Opens the commissioning window automatically at application boot time if
300350
the node is not yet commissioned.

examples/air-quality-sensor-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ You can use this example as a reference for creating your own application.
2525
```
2626

2727
3. In the example dir run (replace _<build_target>_ with your board name, for
28-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
28+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
2929

3030
```bash
3131
$ west build -b <build_target>

examples/all-clusters-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ creating your own application.
2727
```
2828

2929
3. In the example dir run (replace _<build_target>_ with your board name, for
30-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
30+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
3131

3232
```bash
3333
$ west build -b <build_target>

examples/all-clusters-minimal-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for creating your own application.
2727
```
2828

2929
3. In the example dir run (replace _<build_target>_ with your board name, for
30-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
30+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
3131

3232
```bash
3333
$ west build -b <build_target>

examples/bridge-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ defined:
104104
```
105105

106106
3. In the example dir run (replace _<build_target>_ with your board name, for
107-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
107+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
108108

109109
```bash
110110
$ west build -b <build_target>

examples/contact-sensor-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ You can use this example as a reference for creating your own application.
2525
```
2626

2727
3. In the example dir run (replace _<build_target>_ with your board name, for
28-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
28+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
2929

3030
```bash
3131
$ west build -b <build_target>

examples/light-switch-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ creating your own application.
3030
```
3131

3232
3. In the example dir run (replace _<build_target>_ with your board name, for
33-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
33+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
3434

3535
```bash
3636
$ west build -b <build_target>

examples/lighting-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ a reference for creating your own application.
2828
```
2929

3030
3. In the example dir run (replace _<build_target>_ with your board name, for
31-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
31+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
3232

3333
```bash
3434
$ west build -b <build_target>

examples/lock-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ a reference for creating your own application.
2828
```
2929

3030
3. In the example dir run (replace _<build_target>_ with your board name, for
31-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
31+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
3232

3333
```bash
3434
$ west build -b <build_target>

examples/ota-requestor-app/telink/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
```
2222

2323
3. In the example dir run (replace _<build_target>_ with your board name, for
24-
example, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
24+
example, `tlsr9118bdk40d`, `tlsr9518adk80d`, `tlsr9528a` or `tlsr9258a`):
2525

2626
```bash
2727
$ west build -b <build_target>

examples/platform/telink/common.cmake

+21-8
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515

1616
string(REPLACE "_retention" "" BASE_BOARD ${BOARD})
1717

18-
if(FLASH_SIZE)
19-
message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b")
20-
else()
21-
set(FLASH_SIZE "2m")
22-
message(STATUS "Flash memory size is set to: 2mb (default)")
18+
if(NOT FLASH_SIZE)
19+
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d")
20+
set(FLASH_SIZE "3m")
21+
else()
22+
set(FLASH_SIZE "2m")
23+
endif()
2324
endif()
25+
message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b")
2426

2527
if(${TLNK_MARS_BOARD} MATCHES y)
2628
set(MARS_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BASE_BOARD}_mars_boot.overlay")
@@ -60,11 +62,22 @@ else()
6062
unset(USB_CONF_OVERLAY_FILE)
6163
endif()
6264

63-
set(GLOBAL_BOOT_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf")
64-
if(NOT EXISTS "${GLOBAL_BOOT_CONF_OVERLAY_FILE}")
65-
message(FATAL_ERROR "${GLOBAL_BOOT_CONF_OVERLAY_FILE} doesn't exist")
65+
set(BOOT_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf")
66+
if(NOT EXISTS "${BOOT_CONF_OVERLAY_FILE}")
67+
message(FATAL_ERROR "${BOOT_CONF_OVERLAY_FILE} doesn't exist")
6668
endif()
6769

70+
if(${CONFIG_USB_TELINK_B9X} MATCHES y)
71+
set(BOOT_USB_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader_usb.conf")
72+
if(NOT EXISTS "${BOOT_USB_CONF_OVERLAY_FILE}")
73+
message(FATAL_ERROR "${BOOT_USB_CONF_OVERLAY_FILE} doesn't exist")
74+
endif()
75+
else()
76+
unset(BOOT_USB_CONF_OVERLAY_FILE)
77+
endif()
78+
79+
set(GLOBAL_BOOT_CONF_OVERLAY_FILE "${BOOT_CONF_OVERLAY_FILE} ${BOOT_USB_CONF_OVERLAY_FILE}")
80+
6881
set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BASE_BOARD}.overlay")
6982
if(NOT EXISTS "${LOCAL_DTC_OVERLAY_FILE}")
7083
message(STATUS "${LOCAL_DTC_OVERLAY_FILE} doesn't exist")

0 commit comments

Comments
 (0)