Skip to content

Commit

Permalink
[Telink] Add W91 (TLSR9118BDK40D) base support (#33423)
Browse files Browse the repository at this point in the history
* [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 <[email protected]>

---------

Signed-off-by: Dmytro Kashkarov <[email protected]>

* [Telink] disable debug part

* [Telink] restyled

---------

Signed-off-by: Dmytro Kashkarov <[email protected]>
Co-authored-by: Dmytro Kashkarov <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Sep 23, 2024
1 parent 3fe5bf6 commit 1018755
Show file tree
Hide file tree
Showing 46 changed files with 1,831 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
platform: telink
# - name: Update Zephyr to specific revision (for developers purpose)
# shell: bash
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 65dc1812431bf946dfc110682298acf83d63e27a"
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 68deadeb5c20b82d68700e720d4580e8003bf1d8"
- name: CI Examples Telink
shell: bash
run: |
Expand Down
32 changes: 22 additions & 10 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2023 Project CHIP Authors
# Copyright (c) 2022-2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
gh-context: ${{ toJson(github) }}

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

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

- name: Build example Telink (B91) All Clusters App
- name: Build example Telink (W91) All Clusters App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-all-clusters' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-all-clusters' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d all-clusters-app \
out/telink-tlsr9518adk80d-all-clusters/zephyr/zephyr.elf \
telink tlsr9118bdk40d all-clusters-app \
out/telink-tlsr9118bdk40d-all-clusters/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
Expand Down Expand Up @@ -129,6 +129,18 @@ jobs:
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (W91) Lighting App with OTA, Factory Data
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-light-ota-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9118bdk40d lighting-app-ota-factory-data \
out/telink-tlsr9118bdk40d-light-ota-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (B91) Lighting App with OTA, RPC, Factory Data and 4Mb flash
run: |
./scripts/run_in_build_env.sh \
Expand Down Expand Up @@ -189,13 +201,13 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91) Pump Controller App
- name: Build example Telink (W91) Pump Controller App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-controller' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-pump-controller' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d pump-controller-app \
out/telink-tlsr9518adk80d-pump-controller/zephyr/zephyr.elf \
telink tlsr9118bdk40d pump-controller-app \
out/telink-tlsr9118bdk40d-pump-controller/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
Expand Down
7 changes: 1 addition & 6 deletions config/telink/app/bootloader.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2023-2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,8 +41,3 @@ CONFIG_BOOT_MAX_IMG_SECTORS=4096
# - 3 INFO, default to write LOG_LEVEL_INFO
# - 4 DEBUG, default to write LOG_LEVEL_DBG
CONFIG_LOG_DEFAULT_LEVEL=1

# USB DFU configuration
CONFIG_USB_DFU_WILL_DETACH=n
CONFIG_BOOT_USB_DFU_GPIO=y
CONFIG_MCUBOOT_INDICATION_LED=y
20 changes: 20 additions & 0 deletions config/telink/app/bootloader_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2024 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.
#

# USB DFU configuration
CONFIG_USB_DFU_WILL_DETACH=n
CONFIG_BOOT_USB_DFU_GPIO=y
CONFIG_MCUBOOT_INDICATION_LED=y
8 changes: 7 additions & 1 deletion config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn_args.cmake)
include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn.cmake)

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

if (CONFIG_POSIX_API)
matter_add_flags(-D_DEFAULT_SOURCE)
Expand Down Expand Up @@ -102,6 +103,7 @@ matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_
matter_add_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3)
matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4)
matter_add_gn_arg_bool ("chip_automation_logging" FALSE)
matter_add_gn_arg_bool ("chip_enable_wifi" CONFIG_WIFI_W91)
matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT)

if (CONFIG_CHIP_ENABLE_ICD_SUPPORT)
Expand All @@ -122,8 +124,12 @@ if (CONFIG_CHIP_ROTATING_DEVICE_ID)
matter_add_gn_arg_bool("chip_enable_additional_data_advertising" "true")
endif()

if (CONFIG_CHIP_ENABLE_DNSSD_SRP)
if (CONFIG_NET_L2_OPENTHREAD)
matter_add_gn_arg_string("chip_mdns" "platform")
elseif(CONFIG_WIFI_W91)
matter_add_gn_arg_string("chip_mdns" "minimal")
else()
matter_add_gn_arg_string("chip_mdns" "none")
endif()

if (CONFIG_CHIP_PW_RPC)
Expand Down
2 changes: 1 addition & 1 deletion config/telink/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ config CHIP_LOG_SIZE_OPTIMIZATION

config CHIP_BUTTON_MANAGER_IRQ_MODE
bool "Use GPIO in an IRQ mode instead of polling the GPIO"
default PM
default PM || BOARD_TLSR9118BDK40D
help
Use GPIO in an IRQ mode to avoid button polling loop and extend the battery lifetime by waking up by GPIO event.
GPIO events are working only with GPIO IRQ. This option changes button matrix configuration.
Expand Down
56 changes: 53 additions & 3 deletions config/telink/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ config GPIO
# Bluetooth Low Energy configs

config BT
default n if BOARD_TLSR9118BDK40D
default y

if BT
Expand Down Expand Up @@ -178,7 +179,7 @@ config PWM
endif

# Board non-retention config
if BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D
if BOARD_TLSR9118BDK40D || BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D
config PWM
default y
endif
Expand Down Expand Up @@ -224,7 +225,7 @@ config SETTINGS_NVS_SECTOR_COUNT
# Enable OpenThread

config NET_L2_OPENTHREAD
default y
default y if !WIFI

if NET_L2_OPENTHREAD

Expand Down Expand Up @@ -292,9 +293,58 @@ config NET_MAX_CONTEXTS
config NET_CONFIG_INIT_TIMEOUT
default 0


config CHIP_WIFI
bool "Enable Telink Wi-Fi support"
default y if BOARD_TLSR9118BDK40D
select WIFI_W91
select WIFI
select NET_STATISTICS
select NET_L2_ETHERNET
select NET_IPV6_ND # enable Neighbor Discovery to handle Router Advertisements
select NET_IPV6_NBR_CACHE
select NET_STATISTICS_USER_API

if CHIP_WIFI

config CHIP_WIFI_CONNECTION_RECOVERY_MINIMUM_INTERVAL
int "Define the minimum connection recovery time interval in milliseconds"
depends on CHIP_WIFI
default 500
help
Specifies the minimum connection recovery interval (in milliseconds).

config CHIP_WIFI_CONNECTION_RECOVERY_MAXIMUM_INTERVAL
int "Define the maximum connection recovery time interval in milliseconds"
depends on CHIP_WIFI
default 3600000 # 1 hour
help
Specifies the maximum connection recovery interval (in milliseconds).

config CHIP_WIFI_CONNECTION_RECOVERY_MAX_RETRIES_NUMBER
int "Define the maximum amount of connection recovery occurrences"
depends on CHIP_WIFI
default 0
help
Specifies the maximum number of connection recovery attempts.
If set to 0, no limitation is applied and attempts
to recover the connection are performed indefinitely.

config CHIP_WIFI_CONNECTION_RECOVERY_JITTER
int "Define the connection recovery jitter in milliseconds"
depends on CHIP_WIFI
default 2000
help
Specifies the maximum connection recovery jitter interval (in milliseconds).
Once the wait time reaches the current maximum value (defined by CHIP_WIFI_CONNECTION_RECOVERY_MAXIMUM_INTERVAL),
a random jitter interval is added to it to avoid periodicity. The random jitter is selected
within range [-JITTER; +JITTER].

endif # CHIP_WIFI

config CHIP_ENABLE_PAIRING_AUTOSTART
bool "Open commissioning window on boot"
default y
default y
help
Opens the commissioning window automatically at application boot time if
the node is not yet commissioned.
Expand Down
2 changes: 1 addition & 1 deletion examples/air-quality-sensor-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can use this example as a reference for creating your own application.
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ creating your own application.
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ for creating your own application.
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ defined:
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/contact-sensor-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can use this example as a reference for creating your own application.
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ creating your own application.
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ a reference for creating your own application.
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ a reference for creating your own application.
```

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

```bash
$ west build -b <build_target>
Expand Down
2 changes: 1 addition & 1 deletion examples/ota-requestor-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
```

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

```bash
$ west build -b <build_target>
Expand Down
29 changes: 21 additions & 8 deletions examples/platform/telink/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@

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

if(FLASH_SIZE)
message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b")
else()
set(FLASH_SIZE "2m")
message(STATUS "Flash memory size is set to: 2mb (default)")
if(NOT FLASH_SIZE)
if(${BASE_BOARD} MATCHES "tlsr9118bdk40d")
set(FLASH_SIZE "3m")
else()
set(FLASH_SIZE "2m")
endif()
endif()
message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b")

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

set(GLOBAL_BOOT_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf")
if(NOT EXISTS "${GLOBAL_BOOT_CONF_OVERLAY_FILE}")
message(FATAL_ERROR "${GLOBAL_BOOT_CONF_OVERLAY_FILE} doesn't exist")
set(BOOT_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf")
if(NOT EXISTS "${BOOT_CONF_OVERLAY_FILE}")
message(FATAL_ERROR "${BOOT_CONF_OVERLAY_FILE} doesn't exist")
endif()

if(${CONFIG_USB_TELINK_B9X} MATCHES y)
set(BOOT_USB_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader_usb.conf")
if(NOT EXISTS "${BOOT_USB_CONF_OVERLAY_FILE}")
message(FATAL_ERROR "${BOOT_USB_CONF_OVERLAY_FILE} doesn't exist")
endif()
else()
unset(BOOT_USB_CONF_OVERLAY_FILE)
endif()

set(GLOBAL_BOOT_CONF_OVERLAY_FILE "${BOOT_CONF_OVERLAY_FILE} ${BOOT_USB_CONF_OVERLAY_FILE}")

set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BASE_BOARD}.overlay")
if(NOT EXISTS "${LOCAL_DTC_OVERLAY_FILE}")
message(STATUS "${LOCAL_DTC_OVERLAY_FILE} doesn't exist")
Expand Down
Loading

0 comments on commit 1018755

Please sign in to comment.