Skip to content

Commit

Permalink
riscv: telink: add dual mode for b92 and buteo and CI.
Browse files Browse the repository at this point in the history
- clean the boot flag in init part .
- add the kDnsstimer to protect from init to dnss .
- add special proc for ikea.
- add the user-para proc in matter.
- add 2m flash for buteo ,and 4m for b92.
- update CI for b92 and tl3218x .
- fix the switch logic part .

Signed-off-by: Haiwen Xia <[email protected]>
  • Loading branch information
haiwentelink committed Dec 20, 2024
1 parent 007f4d7 commit 06f2be7
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 273 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ jobs:
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
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 8b29ee6b118ebe6eeec3224dbe343474e11403d8"
- 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 ba8bfa96528743c97f279cf76b4cdfb4ef623e87"
- name: CI Examples Telink
shell: bash
run: |
Expand Down
237 changes: 7 additions & 230 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,77 +57,8 @@ jobs:
with:
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 8b29ee6b118ebe6eeec3224dbe343474e11403d8"

- name: Build example Telink (B92 retention) Air Quality Sensor App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-air-quality-sensor' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a_retention air-quality-sensor-app \
out/telink-tlsr9528a_retention-air-quality-sensor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (W91) All Clusters App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-all-clusters' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9118bdk40d all-clusters-app \
out/telink-tlsr9118bdk40d-all-clusters/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92) All Clusters Minimal App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-all-clusters-minimal' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
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 (B95) Bridge App
# Run test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9258a-bridge' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9258a bridge-app \
out/telink-tlsr9258a-bridge/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92 retention) Contact Sensor App
# Run test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-contact-sensor' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a_retention contact-sensor-app \
out/telink-tlsr9528a_retention-contact-sensor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out
- name: Update Zephyr to specific revision (for developers purpose)
run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py ba8bfa96528743c97f279cf76b4cdfb4ef623e87"

- name: Build tools required for Factory Data
# Run test for master and all PRs
Expand All @@ -140,33 +71,6 @@ 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 test for master and all PRs
continue-on-error: true
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 test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app-ota-rpc-factory-data-4mb \
out/telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (tl321x) Lighting App with OTA (LZMA), Shell, Factory Data
# Run test for master and all PRs
run: |
Expand All @@ -180,144 +84,17 @@ jobs:
- name: clean out build output (keep tools)
run: rm -rf ./out/telink*

- name: Build example Telink (B92) Light Switch App with OTA (LZMA), Shell, Factory Data
- name: Build example Telink (B92) Lighting App with OTA, Shell, Factory Data
# Run test for master and all PRs
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-ota-4mb-shell-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a light-switch-app-ota-compress-lzma-shell-factory-data \
out/telink-tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \
telink tlsr9528a light-app-ota-4mb-shell-factory-data \
out/telink-tlsr9528a-light-ota-4mb-shell-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92) Lock App with DFU
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-lock-dfu' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a lock-app-dfu \
out/telink-tlsr9528a-lock-dfu/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B95) OTA Requestor App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9258a-ota-requestor' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9258a ota-requestor-app \
out/telink-tlsr9258a-ota-requestor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91 USB) Pump App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-usb' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d pump-app-usb \
out/telink-tlsr9518adk80d-pump-usb/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91) Pump Controller App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-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 \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91) Shell App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-shell' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d shell \
out/telink-tlsr9518adk80d-shell/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B92 retention) Smoke CO Alarm App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-smoke-co-alarm' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a_retention smoke_co_alarm-app \
out/telink-tlsr9528a_retention-smoke-co-alarm/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91 Mars) Temperature Measurement App with OTA
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-temperature-measurement-mars-ota' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d temperature-measurement-app-mars-ota \
out/telink-tlsr9518adk80d-temperature-measurement-mars-ota/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (B91) Thermostat App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-thermostat' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d thermostat \
out/telink-tlsr9518adk80d-thermostat/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink (W91) Window Covering App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-window-covering' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9118bdk40d window-covering \
out/telink-tlsr9118bdk40d-window-covering/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
- name: clean out build output (keep tools)
run: rm -rf ./out

- name: Uploading Size Reports
Expand Down
6 changes: 3 additions & 3 deletions config/telink/app/bootloader.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# limitations under the License.
#

# Enable this option in case if restoring the slot0 partition is expected from slot1
# 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=y
CONFIG_BOOT_BOOTSTRAP=n

# Enable this option in case if SWAP_MOVE logic need to be used
CONFIG_BOOT_SWAP_USING_MOVE=y
Expand All @@ -27,7 +27,7 @@ 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
CONFIG_BOOT_VALIDATE_SLOT0=n

# Maximum number of image sectors supported by the bootloader.
# Maximum signed image size: 512 * 4096 = 2M Bytes
Expand Down
17 changes: 16 additions & 1 deletion config/telink/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ choice LOG_MODE
endchoice

choice MATTER_LOG_LEVEL_CHOICE
default MATTER_LOG_LEVEL_WRN if SOC_RISCV_TELINK_TL321X
default MATTER_LOG_LEVEL_DBG if SOC_RISCV_TELINK_TL321X
default MATTER_LOG_LEVEL_DBG
endchoice

Expand Down Expand Up @@ -260,6 +260,21 @@ config NVS_LOOKUP_CACHE_SIZE
default 400 if SOC_RISCV_TELINK_TL321X
default 2048 if !PM

config COMPRESS_LZMA
depends on CHIP_OTA_REQUESTOR
default y if SOC_RISCV_TELINK_TL321X
default n

config DUAL_MODE_SWTICH
bool "Control the dual mode switch part"
default y if SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_B92
default n

config I2C_LED
bool "Control the i2 led slave use raw address"
default n if PM
default n

# 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
Expand Down
11 changes: 11 additions & 0 deletions examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ CHIP_ERROR AppTask::Init(void)
SetExampleButtonCallbacks(LightingActionEventHandler);
InitCommonParts();

#if CONFIG_DUAL_MODE_SWTICH
if (sBoot_zb)
{
/* Switch from the touch link, need to restore previous values */
sfixture_on = user_para.onoff;
sBrightness = user_para.lightness;
sAppTask.UpdateClusterState();
printk("Matter: Updated ZB On/Off state and brightness.\n");
}
#endif

Protocols::InteractionModel::Status status;

app::DataModel::Nullable<uint8_t> brightness;
Expand Down
29 changes: 29 additions & 0 deletions examples/platform/telink/common/include/AppTaskCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,34 @@

#include <credentials/examples/DeviceAttestationCredsExample.h>

#if CONFIG_DUAL_MODE_SWTICH
#include <zephyr/device.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/storage/flash_map.h>
#include <zephyr/sys/reboot.h>

#define USER_INIT_VAL 0xff
#define USER_ZB_SW_VAL 0xaa
#define USER_MATTER_PAIR_VAL 0x55
#define USER_PARA_MAC_OFFSET 0x100
#define USER_PARTITION user_para_partition
#define USER_PARTITION_DEVICE FIXED_PARTITION_DEVICE(USER_PARTITION)
#define USER_PARTITION_OFFSET FIXED_PARTITION_OFFSET(USER_PARTITION)
#define USER_PARTITION_SIZE FIXED_PARTITION_SIZE(USER_PARTITION)

typedef struct
{
uint8_t val;
uint8_t rfu;
uint8_t onoff;
uint8_t lightness;
} user_para_t;

extern user_para_t user_para;
extern uint8_t para_lightness;
extern uint8_t sBoot_zb;
#endif

#include <cstdint>

using namespace ::chip;
Expand Down Expand Up @@ -97,6 +125,7 @@ class AppTaskCommon
virtual void LinkButtons(ButtonManager & buttonManager);

static void FactoryResetTimerTimeoutCallback(k_timer * timer);
static void DnssTimerTimeoutCallback(k_timer * timer);
static void FactoryResetTimerEventHandler(AppEvent * aEvent);
static void FactoryResetButtonEventHandler(void);
static void FactoryResetHandler(AppEvent * aEvent);
Expand Down
Loading

0 comments on commit 06f2be7

Please sign in to comment.