Skip to content

Commit

Permalink
[Telink] Add B92 (tlsr9528a) SoC support & Update Telink image to 10 (#…
Browse files Browse the repository at this point in the history
…28841)

* [Telink] Add tlsr9528a (B92) to CI

* [Telink] Remove set board by default (Readme files needs to be updated)

* [Telink] use B9X instead of B91

* [Telink] Add tlsr9528a (B92) DTS overlay

* [Telink] temporarry disable BLE for Jenkins

* [Telink] Use Zephyr sys_reboot instead of HAL version

* Revert "[Telink] temporarry disable BLE for Jenkins"

This reverts commit 066b0a2.

* [Telink] use B9X instead of B91

* [Telink] Set correct BOOT_MAX_IMG_SECTORS for B92

* [Telink] Adopt to latest master chnages

* [Telink] Add info how to build B9X

* [Telink] Update partitions

* [Telink] Reset default CONFIG_SETTINGS_NVS_SECTOR_SIZE_MULT

* [Telink] Support USB dongle

* [Telink] Update Telink image to 10

* Restyled

* [Telink] Change bootloader log level

* [Telink] Add Chef example to CI

* [Telink] Use B9X

* [Telink] Add chef bundle function

* Restyled by autopep8

* [Telink] Divide CI apps between two SoCs

---------

Co-authored-by: Andrii Bilynskyi <andrii.bilynskyi@telink-semi.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
3 people authored and pull[bot] committed Jan 16, 2024
1 parent 61ddbe4 commit 2543225
Show file tree
Hide file tree
Showing 59 changed files with 590 additions and 259 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,24 @@ jobs:
shell: bash
run: |
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t nrfconnect"
chef_telink:
name: Chef - Telink CI Examples
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-telink:10
options: --user root

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: telink
- name: CI Examples Telink
shell: bash
run: |
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t telink"
117 changes: 45 additions & 72 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Project CHIP Authors
# Copyright (c) 2022-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.
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-telink:1
image: ghcr.io/project-chip/chip-build-telink:10
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"

Expand All @@ -54,7 +54,7 @@ jobs:
with:
gh-context: ${{ toJson(github) }}

- name: Build example Telink All Clusters App
- name: Build example Telink (B91) All Clusters App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-all-clusters' build"
Expand All @@ -66,19 +66,19 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink All Clusters Minimal App
- name: Build example Telink (B92) All Clusters Minimal App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-all-clusters-minimal' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-all-clusters-minimal' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d all-clusters-minimal-app \
out/telink-tlsr9518adk80d-all-clusters-minimal/zephyr/zephyr.elf \
telink tlsr9528a all-clusters-minimal-app \
out/telink-tlsr9528a-all-clusters-minimal/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Bridge App
- name: Build example Telink (B91) Bridge App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-bridge' build"
Expand All @@ -90,70 +90,43 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Contact Sensor App
- name: Build example Telink (B92) Contact Sensor App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-contact-sensor' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-contact-sensor' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d contact-sensor-app \
out/telink-tlsr9518adk80d-contact-sensor/zephyr/zephyr.elf \
telink tlsr9528a contact-sensor-app \
out/telink-tlsr9528a-contact-sensor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lighting App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app \
out/telink-tlsr9518adk80d-light/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lighting App with RPC
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-rpc' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app-rpc \
out/telink-tlsr9518adk80d-light-rpc/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lighting App with Shell
- name: Build example Telink (B91) Lighting App with RPC, Shell and Factory Data
run: |
./scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux
./scripts/build/gn_gen.sh
./scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE chip-cert chip-tool spake2p"
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-shell' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-rpc-shell-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app-shell \
out/telink-tlsr9518adk80d-light-shell/zephyr/zephyr.elf \
telink tlsr9518adk80d lighting-app-rpc-shell-factory-data \
out/telink-tlsr9518adk80d-light-rpc-shell-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lighting App with Factory Data
- name: Build example Telink (B92) Lighting App with RPC, Shell and Factory Data
run: |
./scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux
./scripts/build/gn_gen.sh
./scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE chip-cert chip-tool spake2p"
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-factory-data' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-rpc-shell-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app-factory-data \
out/telink-tlsr9518adk80d-light-factory-data/zephyr/zephyr.elf \
telink tlsr9528a lighting-app-rpc-shell-factory-data \
out/telink-tlsr9528a-light-rpc-shell-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Light Switch App
- name: Build example Telink (B91) Light Switch App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-switch' build"
Expand All @@ -165,19 +138,19 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lock App
- name: Build example Telink (B92) Lock App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-lock' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-lock' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lock-app \
out/telink-tlsr9518adk80d-lock/zephyr/zephyr.elf \
telink tlsr9528a lock-app \
out/telink-tlsr9528a-lock/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink OTA Requestor App
- name: Build example Telink (B91) OTA Requestor App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-ota-requestor' build"
Expand All @@ -189,19 +162,19 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Pump App
- name: Build example Telink (B92) Pump App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-pump' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d pump-app \
out/telink-tlsr9518adk80d-pump/zephyr/zephyr.elf \
telink tlsr9528a pump-app \
out/telink-tlsr9528a-pump/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Pump Controller App
- name: Build example Telink (B91) Pump Controller App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-controller' build"
Expand All @@ -213,7 +186,7 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Shell App
- name: Build example Telink (B91) Shell App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-shell' build"
Expand All @@ -225,31 +198,31 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Smoke CO Alarm App
- name: Build example Telink (B92) Smoke CO Alarm App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-smoke-co-alarm' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-smoke-co-alarm' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d smoke_co_alarm-app \
out/telink-tlsr9518adk80d-smoke-co-alarm/zephyr/zephyr.elf \
telink tlsr9528a smoke_co_alarm-app \
out/telink-tlsr9528a-smoke-co-alarm/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Temperature Measurement App
- name: Build example Telink (B92) Temperature Measurement App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-temperature-measurement' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-temperature-measurement' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d temperature-measurement-app \
out/telink-tlsr9518adk80d-temperature-measurement/zephyr/zephyr.elf \
telink tlsr9528a temperature-measurement-app \
out/telink-tlsr9528a-temperature-measurement/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Thermostat App
- name: Build example Telink (B91) Thermostat App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-thermostat' build"
Expand All @@ -261,7 +234,7 @@ jobs:
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Window Covering App
- name: Build example Telink (B91) Window Covering App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-window-covering' build"
Expand Down
20 changes: 19 additions & 1 deletion config/telink/app/bootloader.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Enable this option in case if restoring the slot0 partition is expected from slot1
# partition in case if slot0 is not bootable or damaged
CONFIG_BOOT_BOOTSTRAP=n
CONFIG_BOOT_BOOTSTRAP=y

# Enable this option in case if SWAP_MOVE logic need to be used
CONFIG_BOOT_SWAP_USING_MOVE=y
Expand All @@ -28,3 +28,21 @@ CONFIG_BOOT_SWAP_USING_SCRATCH=n
# Enable this option in case if the whole slot0 image need to be validated
# With disabled option the only image magic is validated
CONFIG_BOOT_VALIDATE_SLOT0=y

# Maximum number of image sectors supported by the bootloader.
CONFIG_BOOT_MAX_IMG_SECTORS=4096

# Sets log level for modules which don't specify it explicitly.
# When set to 0 it means log will not be activated for those modules.
# Levels are:
# - 0 OFF, do not write by default
# - 1 ERROR, default to only write LOG_LEVEL_ERR
# - 2 WARNING, default to write LOG_LEVEL_WRN
# - 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
12 changes: 6 additions & 6 deletions config/telink/app/zephyr.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021 Project CHIP Authors
# 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.
Expand Down Expand Up @@ -111,22 +111,22 @@ 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 16 to reach NVS sector size 4096
# nvs_sector_size = flash_page_size * mult = 256 * 16 = 4096
CONFIG_SETTINGS_NVS_SECTOR_SIZE_MULT=16
# 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_B91_REBOOT_ON_FAULT=y
CONFIG_TELINK_B9X_REBOOT_ON_FAULT=y

# Shell settings
CONFIG_SHELL=n

# BLE MAC address
CONFIG_B91_BLE_CTRL_MAC_FLASH_ADDR=0x1FE000
CONFIG_B9X_BLE_CTRL_MAC_FLASH_ADDR=0x1FE000

# getopt version
CONFIG_GETOPT_LONG=y
Expand Down
17 changes: 14 additions & 3 deletions config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ set_property(GLOBAL APPEND PROPERTY ZEPHYR_INTERFACE_LIBS chip)
# Define 'chip-ota-image' target for building CHIP OTA image
# ==============================================================================


if(${TLNK_USB_DONGLE} MATCHES y)
if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb_boot.overlay")
set(USB_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_usb_boot.overlay")
else()
unset(USB_BOOT_DTC_OVERLAY_FILE)
endif()
else()
unset(USB_BOOT_DTC_OVERLAY_FILE)
endif()

if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay")
set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay")
else()
Expand All @@ -153,14 +164,14 @@ if (CONFIG_CHIP_OTA_IMAGE_BUILD)
add_custom_target(build_mcuboot ALL
COMMAND
west build -b ${BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr
-- -DOVERLAY_CONFIG=${GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE=${GLOBAL_DTC_OVERLAY_FILE}
-- -DOVERLAY_CONFIG=${GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE="${GLOBAL_DTC_OVERLAY_FILE};${USB_BOOT_DTC_OVERLAY_FILE}"
)

add_custom_target(merge_mcuboot ALL
COMMAND
dd if=${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/zephyr.bin of=${PROJECT_BINARY_DIR}/zephyr.bin
COMMAND
dd if=${PROJECT_BINARY_DIR}/zephyr.signed.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=1024 seek=76
dd if=${PROJECT_BINARY_DIR}/zephyr.signed.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=1024 seek=100
)

chip_ota_image(chip-ota-image
Expand All @@ -175,7 +186,7 @@ endif()
if (CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE)
add_custom_target(merge_factory_data ALL
COMMAND
dd if=${PROJECT_BINARY_DIR}/factory/factory_data.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=1024 seek=1040
dd if=${PROJECT_BINARY_DIR}/factory/factory_data.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=1024 seek=1052
)
if (CONFIG_CHIP_OTA_IMAGE_BUILD)
add_dependencies(merge_factory_data merge_mcuboot)
Expand Down
2 changes: 0 additions & 2 deletions examples/all-clusters-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#
cmake_minimum_required(VERSION 3.13.1)

set(BOARD tlsr9518adk80d)

get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH)
get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH)
get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH)
Expand Down
Loading

0 comments on commit 2543225

Please sign in to comment.