diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index b0a6eb9925e9..8a59eaae2c40 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -1719,3 +1719,13 @@ Zigbee zigbeealliance zigbeethread zsdk +bdk +Changelog +changelog +devicetree +DLM +downloaders +ILM +tlk +TLX +udev diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml.disabled similarity index 100% rename from .github/workflows/build.yaml rename to .github/workflows/build.yaml.disabled diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index f0f84a450cae..178b8211a0c2 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -31,6 +31,7 @@ env: jobs: chef_linux_all_devices: + if:false name: Chef - Linux CI Examples (All chef devices) timeout-minutes: 120 runs-on: ubuntu-latest @@ -55,6 +56,7 @@ jobs: ./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci_linux" chef_device_functional_test: + if:false name: Chef - Device functional tests (Linux) if: github.actor != 'restyled-io[bot]' timeout-minutes: 90 @@ -93,6 +95,7 @@ jobs: scripts/run_in_python_env.sh out/python_env './scripts/tests/run_python_test.py --app examples/chef/linux/out/rootnode_dimmablelight_bCwGYSDpoe --factory-reset --script ./examples/chef/tests/dimmablelight_test.py --script-args "--commissioning-method on-network --discriminator 3840 --passcode 20202021" --app-stdin-pipe /tmp/chef_stdin.txt' chef_esp32: + if:false name: Chef - ESP32 CI Examples runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' @@ -145,7 +148,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:181 + image: ghcr.io/project-chip/chip-build-telink:185 volumes: - "/:/runner-root-volume" options: --user root diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml.disabled similarity index 100% rename from .github/workflows/cirque.yaml rename to .github/workflows/cirque.yaml.disabled diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml.disabled similarity index 100% rename from .github/workflows/darwin-tests.yaml rename to .github/workflows/darwin-tests.yaml.disabled diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml.disabled similarity index 100% rename from .github/workflows/doxygen.yaml rename to .github/workflows/doxygen.yaml.disabled diff --git a/.github/workflows/example-tv-casting-darwin.yaml b/.github/workflows/example-tv-casting-darwin.yaml.disabled similarity index 100% rename from .github/workflows/example-tv-casting-darwin.yaml rename to .github/workflows/example-tv-casting-darwin.yaml.disabled diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml.disabled similarity index 100% rename from .github/workflows/examples-ameba.yaml rename to .github/workflows/examples-ameba.yaml.disabled diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml.disabled similarity index 100% rename from .github/workflows/examples-asr.yaml rename to .github/workflows/examples-asr.yaml.disabled diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml.disabled similarity index 100% rename from .github/workflows/examples-bouffalolab.yaml rename to .github/workflows/examples-bouffalolab.yaml.disabled diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml.disabled similarity index 100% rename from .github/workflows/examples-cc13xx_26xx.yaml rename to .github/workflows/examples-cc13xx_26xx.yaml.disabled diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml.disabled similarity index 100% rename from .github/workflows/examples-cc32xx.yaml rename to .github/workflows/examples-cc32xx.yaml.disabled diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml.disabled similarity index 100% rename from .github/workflows/examples-efr32.yaml rename to .github/workflows/examples-efr32.yaml.disabled diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml.disabled similarity index 99% rename from .github/workflows/examples-esp32.yaml rename to .github/workflows/examples-esp32.yaml.disabled index 51d186dc7014..762e911d1321 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml.disabled @@ -181,6 +181,7 @@ jobs: platform-name: ESP32 esp32_1: + if:false name: ESP32_1 runs-on: ubuntu-latest diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml.disabled similarity index 100% rename from .github/workflows/examples-infineon.yaml rename to .github/workflows/examples-infineon.yaml.disabled diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml.disalbed similarity index 100% rename from .github/workflows/examples-linux-arm.yaml rename to .github/workflows/examples-linux-arm.yaml.disalbed diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml.disabled similarity index 100% rename from .github/workflows/examples-linux-imx.yaml rename to .github/workflows/examples-linux-imx.yaml.disabled diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml.disabled similarity index 100% rename from .github/workflows/examples-linux-standalone.yaml rename to .github/workflows/examples-linux-standalone.yaml.disabled diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml.disabled similarity index 100% rename from .github/workflows/examples-linux-tv-casting-app.yaml rename to .github/workflows/examples-linux-tv-casting-app.yaml.disabled diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml.dsiabled similarity index 100% rename from .github/workflows/examples-nrfconnect.yaml rename to .github/workflows/examples-nrfconnect.yaml.dsiabled diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml.disabled similarity index 100% rename from .github/workflows/examples-nuttx.yaml rename to .github/workflows/examples-nuttx.yaml.disabled diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml.disabled similarity index 100% rename from .github/workflows/examples-nxp.yaml rename to .github/workflows/examples-nxp.yaml.disabled diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml.disabled similarity index 100% rename from .github/workflows/examples-qpg.yaml rename to .github/workflows/examples-qpg.yaml.disabled diff --git a/.github/workflows/examples-realtek.yaml b/.github/workflows/examples-realtek.yaml.disabled similarity index 100% rename from .github/workflows/examples-realtek.yaml rename to .github/workflows/examples-realtek.yaml.disabled diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml.disabled similarity index 100% rename from .github/workflows/examples-stm32.yaml rename to .github/workflows/examples-stm32.yaml.disabled diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index d99f06446cf0..8f6bc8a2c95a 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:181 + image: ghcr.io/project-chip/chip-build-telink:185 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -57,8 +57,9 @@ jobs: with: gh-context: ${{ toJson(github) }} - # - name: Update Zephyr version 4.1.0 (develop) to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 1f4804a19fe7ba792bfc315948043d5515e74cd2" + - name: Update Zephyr version 4.1.0 (develop) to specific revision (for developers purpose) + run: + scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py https://github.com/telink-semi/tl_zephyr.git d6a8aa968e5fb97c0b63e2b436aced9084614c65 --sdk-repo https://github.com/telink-semi/tl_ble_sdk_zephyr.git --sdk-hash 3bddf885c0a1e4342393b7c6b668ece104c12102" - name: Build tools required for Factory Data # Run test for master and all PRs @@ -99,15 +100,15 @@ jobs: - name: clean out build output (keep tools) run: rm -rf ./out/telink* - - name: Build example Telink (B92) All Clusters Minimal App with NFC onboarding payload + - name: Build example Telink (B92) All Clusters Minimal App with NFC onboarding payload, 4Mb flash # 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-nfc-payload' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9528a-all-clusters-minimal-nfc-payload-4mb' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ telink tlsr9528a all-clusters-minimal-app \ - out/telink-tlsr9528a-all-clusters-minimal-nfc-payload/zephyr/zephyr.elf \ + out/telink-tlsr9528a-all-clusters-minimal-nfc-payload-4mb/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output (keep tools) @@ -142,12 +143,19 @@ jobs: - name: Build example Telink (W91) Lighting App with OTA, Factory Data # Run test for master and all PRs + # + # TODO: full logging is not enabled here; logging is reduced to progress/error + # (via the *-log-progress target) because with full logging this runs + # out of flash. This is generally NOT expected/intentional. + # At the time this was checked: + # - a 4K flash increase occurred due to the group cast cluster + # - flash runs out by about 1.2K run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-light-ota-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-light-ota-factory-data-log-progress' 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 \ + out/telink-tlsr9118bdk40d-light-ota-factory-data-log-progress/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output (keep tools) @@ -166,54 +174,67 @@ jobs: - 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 + - name: Build example Telink (tl323x) Lighting App with Factory Data, 4Mb flash # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl3218x-light-ota-compress-lzma-shell-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tl3238x-light-ota-factory-data-4mb' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tl3218x light-app-ota-compress-lzma-shell-factory-data \ - out/telink-tl3218x-light-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \ + telink tl3238x light-app-ota-factory-data-4mb \ + out/telink-tl3238x-light-ota-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_retention) Light Switch App with OTA, Factory Data + - name: Build example Telink (tl323x_retention) Light Switch App with OTA, Factory Data # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl3218x_retention-light-switch-ota-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tl3238x_retention-light-switch-ota-compress-lzma-factory-data' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tl3218x_retention light-switch-app-ota-factory-data \ - out/telink-tl3218x_retention-light-switch-ota-factory-data/zephyr/zephyr.elf \ + telink tl3238x_retention light-switch-app-ota-compress-lzma-factory-data \ + out/telink-tl3238x_retention-light-switch-ota-compress-lzma-factory-data/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output (keep tools) run: rm -rf ./out/telink* - - name: Build example Telink (tl721x) Lighting App with OTA, Shell, Factory Data + - name: Build example Telink (tl521x) Lighting App with Factory Data, 4Mb flash # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl7218x-light-ota-shell-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tl5218x-light-ota-factory-data-4mb' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tl7218x light-app-ota-shell-factory-data \ - out/telink-tl7218x-light-ota-shell-factory-data/zephyr/zephyr.elf \ + telink tl5218x light-app-ota-factory-data-4mb \ + out/telink-tl5218x-light-ota-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 (tl721x) Lighting App with TFLM - # Run test for master and s07641069 PRs - if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' + # TODO: tl521x_retention light switch app can build but may not run normally, need further porting. + - name: Build example Telink (tl521x_retention) Light Switch App with OTA, Factory Data + # Run test for master and all PRs + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --target 'telink-tl5218x_retention-light-switch-ota-compress-lzma-factory-data' build" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + telink tl5218x_retention light-switch-app-ota-compress-lzma-factory-data \ + out/telink-tl5218x_retention-light-switch-ota-compress-lzma-factory-data/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + + - name: clean out build output (keep tools) + run: rm -rf ./out/telink* + + - name: Build example Telink (tl721x) Lighting App with OTA (LZMA), Shell, Factory Data + # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl7218x-light-tflm' build" + "./scripts/build/build_examples.py --target 'telink-tl7218x-light-ota-compress-lzma-shell-factory-data' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tl7218x light-app-tflm \ - out/telink-tl7218x-light-tflm/zephyr/zephyr.elf \ + telink tl7218x light-app-ota-compress-lzma-shell-factory-data \ + out/telink-tl7218x-light-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output (keep tools) @@ -259,7 +280,7 @@ jobs: - name: clean out build output (keep tools) run: rm -rf ./out/telink* - - name: Build example Telink (tl321x) OTA Requestor App + - name: Build example Telink (tl323x) 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: | @@ -376,256 +397,3 @@ jobs: if: ${{ !env.ACT }} with: platform-name: Telink - - zephyr_3_3: - name: Telink (Zephyr 3.3) - env: - BUILD_TYPE: telink - - runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' - - container: - image: ghcr.io/project-chip/chip-build-telink-zephyr_3_3:181 - volumes: - - "/tmp/bloat_reports:/tmp/bloat_reports" - - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Checkout submodules & Bootstrap - uses: ./.github/actions/checkout-submodules-and-bootstrap - with: - platform: telink - - - name: Set up environment for size reports - uses: ./.github/actions/setup-size-reports - if: ${{ !env.ACT }} - with: - gh-context: ${{ toJson(github) }} - - # - name: Update Zephyr version 3.3.0 (develop_3.3) to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py a5be7391771c64062e0cbd7fd6f7ef6e05d27a8b" - - - name: Build tools required for Factory Data - # Run test for master and all PRs - 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" - mv ./out/$BUILD_TYPE/chip-cert ./out/$BUILD_TYPE/chip-tool ./out/$BUILD_TYPE/spake2p ./out - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - 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" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - 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' - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-all-clusters' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - 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" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (tl721x) Bridge App - # Run test for master and s07641069 PRs - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl7218x-bridge' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (B92 retention) Contact 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-contact-sensor' build" - - - 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 - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-light-ota-factory-data' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (B91) Lighting App with OTA, RPC, Factory Data, 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" - - - 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: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl3218x-light-ota-compress-lzma-shell-factory-data' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (tl321x_retention) Light Switch App with OTA, Factory Data - # Run test for master and all PRs - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl3218x_retention-light-switch-ota-factory-data' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (tl721x) 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-tl7218x-light-ota-shell-factory-data' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (tl721x) Lighting App with TFLM - # 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-tl7218x-light-tflm' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (tl721x retention) Light Switch App with OTA (LZMA), Factory Data - # Run test for master and all PRs - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl7218x_retention-light-switch-ota-compress-lzma-factory-data' build" - - - 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 - # 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" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (B92) Lock App with DFU over BLE SMP - # 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-smp' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (tl321x) 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-tl3218x-ota-requestor' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - 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" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - 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" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - 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" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - 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" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (B92) lighting with precompiled OpenThread library - # Run test for s07641069 PRs - if: 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-light-precompiled-ot' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (w91) 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-tlsr9118bdk40d-thermostat' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* - - - name: Build example Telink (tl721x) 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' - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tl7218x-window-covering' build" - - - name: clean out build output (keep tools) - run: rm -rf ./out/telink* diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml.disabled similarity index 100% rename from .github/workflows/examples-tizen.yaml rename to .github/workflows/examples-tizen.yaml.disabled diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml.disabled similarity index 100% rename from .github/workflows/full-android.yaml rename to .github/workflows/full-android.yaml.disabled diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml.disabled similarity index 100% rename from .github/workflows/java-tests.yaml rename to .github/workflows/java-tests.yaml.disabled diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml.disabled similarity index 100% rename from .github/workflows/qemu.yaml rename to .github/workflows/qemu.yaml.disabled diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml.disabled similarity index 100% rename from .github/workflows/tests.yaml rename to .github/workflows/tests.yaml.disabled diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml.disabled similarity index 100% rename from .github/workflows/unit_integration_test.yaml rename to .github/workflows/unit_integration_test.yaml.disabled diff --git a/.gitignore b/.gitignore index 1940bfe121eb..046255494e5e 100644 --- a/.gitignore +++ b/.gitignore @@ -96,3 +96,9 @@ imgui.ini # Joint Fabric test harness output file admin_storage.json + +# ignore build output directories +build-* +build_* +factory_data* +*.patch \ No newline at end of file diff --git a/.mergify.yml b/.mergify.yml index db2f4f3cc492..10809f6f496c 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -1,42 +1,232 @@ pull_request_rules: - - name: Label conflicting pull requests - description: Add a label to a pull request with conflict to spot it easily - conditions: - - conflict - - '-closed' - actions: - label: - toggle: + - name: Label conflicting pull requests + description: Add a label to a pull request with conflict to spot it easily + conditions: - conflict - # WARNING: If the rule name below is changed, you must also update the - # condition `check-failure~=Automatic merge on PullApprove` to match the new name. - - name: Automatic merge on PullApprove - conditions: - - or: - - check-success=pullapprove - - label="fast track" - - '#approved-reviews-by>=1' - - '#review-threads-unresolved=0' - - '-draft' - - label!=docker - # Workaround for Mergify deadlock due to using "#check-failure=0": - # Mergify’s own action check can appear as failed/cancelled if conditions stop matching; - # and GitHub keeps those historic failures forever. Since `#check-failure=0` counts ALL - # failures (including historic ones), this would cause a deadlock and block merges indefinitely. - # We whitelist only this self-check so merges aren’t deadlocked, while all other failures still block. - - or: - - '#check-failure=0' - - and: - - '#check-failure=1' - # WARNING: This must match the rule name defined above. - # If the rule name changes, update this condition accordingly. - - check-failure~=Automatic merge on PullApprove - - '#check-pending=0' - - check-success~=Build - - or: - - check-success=pullapprove - - check-skipped=pullapprove - - check-neutral=pullapprove - actions: - merge: - method: squash + - "-closed" + actions: + label: + toggle: + - conflict + # WARNING: If the rule name below is changed, you must also update the + # condition `check-failure~=Automatic merge on PullApprove` to match the new name. + - name: Automatic merge on PullApprove + conditions: + - or: + - check-success=pullapprove + - label="fast track" + - "#approved-reviews-by>=1" + - "#review-threads-unresolved=0" + - "-draft" + - label!=docker + # Workaround for Mergify deadlock due to using "#check-failure=0": + # Mergify's own action check can appear as failed/cancelled if conditions stop matching; + # and GitHub keeps those historic failures forever. Since `#check-failure=0` counts ALL + # failures (including historic ones), this would cause a deadlock and block merges indefinitely. + # We whitelist only this self-check so merges aren't deadlocked, while all other failures still block. + - or: + - "#check-failure=0" + - and: + - "#check-failure=1" + # WARNING: This must match the rule name defined above. + # If the rule name changes, update this condition accordingly. + - check-failure~=Automatic merge on PullApprove + - "#check-pending=0" + - check-success~=Build + - or: + - check-success=pullapprove + - check-skipped=pullapprove + - check-neutral=pullapprove + actions: + merge: + method: squash + + # Backport rules - cherry-pick the squashed master commit after merge. + # Apply a request-backport-* label (such as request-backport-latest or + # request-backport-supported) on the master PR (before or after merge) + # to trigger the corresponding backport. + - name: Backport to v1.7-branch + conditions: + - merged + - base=master + - or: + - label="request-backport-latest-mve-sve" + - label="request-backport-latest" + - label="request-backport-supported" + actions: + backport: + branches: + - v1.7-branch + labels: + - backport-v1.7-branch + + - name: Backport to v1.6.1-branch + conditions: + - merged + - base=master + - or: + - label="request-backport-latest-mve-sve" + - label="request-backport-supported" + actions: + backport: + branches: + - v1.6.1-branch + labels: + - backport-v1.6.1-branch + + - name: Backport to v1.6.1-mve-branch + conditions: + - merged + - base=master + - label="request-backport-latest-mve-sve" + actions: + backport: + branches: + - v1.6.1-mve-branch + labels: + - backport-v1.6.1-mve-branch + + - name: Backport to v1.6-branch + conditions: + - merged + - base=master + - label="request-backport-supported" + actions: + backport: + branches: + - v1.6-branch + labels: + - backport-v1.6-branch + + - name: Backport to v1.4.2-branch + conditions: + - merged + - base=master + - label="request-backport-supported" + actions: + backport: + branches: + - v1.4.2-branch + labels: + - backport-v1.4.2-branch + + # Telink fork backport rules - cherry-pick the squashed dev/master commit. + # Apply a request-backport- label on a dev-tlk_v* / master PR. + - name: Backport to release-v1.0-v1.5-branch + conditions: + - merged + - or: + - base=master + - base~=^dev-tlk_ + - label="request-backport-release-v1.0-v1.5-branch" + actions: + backport: + branches: + - release-v1.0-v1.5-branch + labels: + - backport-release-v1.0-v1.5-branch + + - name: Backport to pre_release-v1.1-v1.5-branch + conditions: + - merged + - or: + - base=master + - base~=^dev-tlk_ + - label="request-backport-pre_release-v1.1-v1.5-branch" + actions: + backport: + branches: + - pre_release-v1.1-v1.5-branch + labels: + - backport-pre_release-v1.1-v1.5-branch + + - name: Backport to pre_release-v1.2-v1.5-branch + conditions: + - merged + - or: + - base=master + - base~=^dev-tlk_ + - label="request-backport-pre_release-v1.2-v1.5-branch" + actions: + backport: + branches: + - pre_release-v1.2-v1.5-branch + labels: + - backport-pre_release-v1.2-v1.5-branch + + - name: Backport to pre_release-v1.1-v1.6.1-branch + conditions: + - merged + - or: + - base=master + - base~=^dev-tlk_ + - label="request-backport-pre_release-v1.1-v1.6.1-branch" + actions: + backport: + branches: + - pre_release-v1.1-v1.6.1-branch + labels: + - backport-pre_release-v1.1-v1.6.1-branch + + - name: Backport to v1.5-branch + conditions: + - merged + - or: + - base=master + - base~=^dev-tlk_ + - label="request-backport-v1.5-branch" + actions: + backport: + branches: + - v1.5-branch + labels: + - backport-v1.5-branch + + - name: Request review for MVE/SVE backports + conditions: + - author=mergify[bot] + - or: + - label~=mve-branch + - label~=sve-branch + actions: + request_reviews: + users: + - cecille + + # Auto-merge backport PRs when CI is green and there are no conflicts. + # If a cherry-pick has conflicts or CI fails, the PR is left open for manual resolution. + # WARNING: If the rule name below is changed, you must also update the + # condition `check-failure~=Auto-merge clean backport PRs` to match the new name. + - name: Auto-merge clean backport PRs + conditions: + - or: + - label="backport-v1.7-branch" + - label="backport-v1.6.1-branch" + - label="backport-v1.6-branch" + - label="backport-v1.5-branch" + - label="backport-v1.4.2-branch" + - label="backport-release-v1.0-v1.5-branch" + - label="backport-pre_release-v1.1-v1.5-branch" + - label="backport-pre_release-v1.2-v1.5-branch" + - label="backport-pre_release-v1.1-v1.6.1-branch" + - author=mergify[bot] + - "-conflict" + - "-draft" + # Same deadlock workaround as above: allow exactly 1 failure if it is + # this rule's own self-check (which Mergify marks failed when conditions + # stop matching, and GitHub retains that historic failure forever). + - or: + - "#check-failure=0" + - and: + - "#check-failure=1" + # WARNING: This must match the rule name defined above. + # If the rule name changes, update this condition accordingly. + - check-failure~=Auto-merge clean backport PRs + - "#check-pending=0" + - check-success~=Build + actions: + merge: + method: squash + +merge_protections_settings: + reporting_method: check-runs diff --git a/MATTER_README.md b/MATTER_README.md new file mode 100644 index 000000000000..07b959115615 --- /dev/null +++ b/MATTER_README.md @@ -0,0 +1,229 @@ +# Documentation links + +- [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/project-chip/connectedhomeip) +- [Matter SDK documentation page](https://project-chip.github.io/connectedhomeip-doc/index.html) +- [Matter SDK Coverage Report](https://matter-build-automation.ue.r.appspot.com/) + +# Matter + +[![Builds](https://github.com/project-chip/connectedhomeip/workflows/Builds/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/build.yaml) + +**Builds** + +[![Android](https://github.com/project-chip/connectedhomeip/workflows/Android/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/android.yaml) +[![Ameba](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Ameba/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-ameba.yaml) +[![ASR](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ASR/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-asr.yaml) +[![BouffaloLab](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20BouffaloLab/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-bouffalolab.yaml) +[![Darwin](https://github.com/project-chip/connectedhomeip/workflows/Darwin/badge.svg)](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/darwin.yaml) +[![TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC13XX_26XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13xx_26xx.yaml) +[![TI CC32XX](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC32XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc32xx.yaml) +[![EFR32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20EFR32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-efr32.yaml) +[![ESP32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ESP32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-esp32.yaml) +[![Infineon](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml) +[![i.MX Linux](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20i.MX%20Linux/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-imx.yaml) +[![NXP FreeRTOS/Zephyr](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nxp.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nxp.yaml) +[![Linux ARM](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20ARM/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-arm.yaml) +[![Linux Standalone](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20Standalone/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-standalone.yaml) +[![nRF Connect SDK](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20nRF%20Connect%20SDK/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nrfconnect.yaml) +[![QPG](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20QPG/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-qpg.yaml) +[![STM32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20stm32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-stm32.yaml) +[![Telink](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Telink/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-telink.yaml) +[![Tizen](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Tizen/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-tizen.yaml) + +**Tests** + +[![Tests](https://github.com/project-chip/connectedhomeip/actions/workflows/tests.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/tests.yaml) +[![Unit / Integration Tests](https://github.com/project-chip/connectedhomeip/workflows/Unit%20/%20Integration%20Tests/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/unit_integration_test.yaml) +[![Cirque](https://github.com/project-chip/connectedhomeip/workflows/Cirque/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/cirque.yaml) +[![QEMU](https://github.com/project-chip/connectedhomeip/workflows/QEMU/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/qemu.yaml) + +**Tools** + +[![ZAP Templates](https://github.com/project-chip/connectedhomeip/workflows/ZAP/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/zap_templates.yaml) + +**Documentation** + +[![Documentation Build](https://github.com/project-chip/connectedhomeip/actions/workflows/docbuild.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/docbuild.yaml) + +# About + +Matter (formerly Project CHIP) creates more connections between more objects, +simplifying development for manufacturers and increasing compatibility for +consumers, guided by the Connectivity Standards Alliance. + +# What is Matter? + +Matter is a unified, open-source application-layer connectivity standard built +to enable developers and device manufacturers to connect and build reliable, and +secure ecosystems and increase compatibility among connected home devices. It is +built with market-proven technologies using Internet Protocol (IP) and is +compatible with Thread and Wi-Fi network transports. Matter was developed by a +Working Group within the Connectivity Standards Alliance (Alliance). This +Working Group develops and promotes the adoption of the Matter standard, a +royalty-free connectivity standard to increase compatibility among smart home +products, with security as a fundamental design tenet. The vision that led major +industry players to come together to build Matter is that smart connectivity +should be simple, reliable, and interoperable. + +Matter simplifies development for manufacturers and increases compatibility for +consumers. + +The standard was built around a shared belief that smart home devices should be +secure, reliable, and seamless to use. By building upon Internet Protocol (IP), +Matter enables communication across smart home devices, mobile apps, and cloud +services and defines a specific set of IP-based networking technologies for +device certification. + +The Matter specification details everything necessary to implement a Matter +application and transport layer stack. It is intended to be used by implementers +as a complete specification. + +The Alliance officially opened the Matter Working Group on January 17, 2020, and +the specification is +[available](https://csa-iot.org/developer-resource/specifications-download-request/) +for adoption now. + +Visit [buildwithmatter.com](https://buildwithmatter.com) to learn more and read +the latest news and updates about the project. + +# Project Overview + +## Development Goals + +Matter is developed with the following goals and principles in mind: + +**Unifying:** Matter is built with and on top of market-tested, existing +technologies. + +**Interoperable:** The specification permits communication between any +Matter-certified device, subject to users’ permission. + +**Secure:** The specification leverages modern security practices and protocols. + +**User Control:** The end user controls authorization for interaction with +devices. + +**Federated:** No single entity serves as a throttle or a single point of +failure for root of trust. + +**Robust:** The set of protocols specifies a complete lifecycle of a device — +starting with the seamless out-of-box experience, through operational protocols, +to device and system management specifications required for proper function in +the presence of change. + +**Low Overhead:** The protocols are practically implementable on low +compute-resource devices, such as MCUs. + +**Pervasive:** The protocols are broadly deployable and accessible, by +leveraging IP and being implementable on low-capability devices. + +**Ecosystem-Flexible:** The protocol is flexible enough to accommodate +deployment in ecosystems with differing policies. + +**Easy to Use:** The protocol provides smooth, cohesive, integrated provisioning +and out-of-box experience. + +**Open:** The Project’s design and technical processes are open and transparent +to the general public, including non-members wherever possible. + +## Architecture Overview + +Matter aims to build a universal IPv6-based communication protocol for smart +home devices. The protocol defines the application layer that will be deployed +on devices and the different link layers to help maintain interoperability. The +following diagram illustrates the normal operational mode of the stack: +![Matter Architecture Overview](docs/images/Matter_Arch_Overview.png) + +The architecture is divided into layers to help separate the different +responsibilities and introduce a good level of encapsulation among the various +pieces of the protocol stack. The vast majority of interactions flow through the +stack captured in the following Figure: + +![Matter Stack Architecture](docs/images/Matter_Layered_Arch.png) + +1. **Application:** High-order business logic of a device. For example, an + application that is focused on lighting might contain logic to handle turning + on/off the bulb as well as its color characteristics. + +2) **Data Model:** The data layer corresponds to the data and verb elements that + help support the functionality of the application. The Application operates + on these data structures when there is an intent to interact with the device. + +3. **Interaction Model:** The Interaction Model layer defines a set of + interactions that can be performed between a client and server device. For + example, reading or writing attributes on a server device would correspond to + application behavior on the device. These interactions operate on the + elements defined at the data model layer. + +4) **Action Framing:** Once an action is constructed using the Interaction + Model, it is serialized into a prescribed packed binary format to encode for + network transmission. + +5. **Security:** An encoded action frame is then sent down to the Security Layer + to encrypt and sign the payload to ensure that data is secured and + authenticated by both sender and receiver of a packet. + +6. **Message Framing & Routing:** With an interaction encrypted and signed, the + Message Layer constructs the payload format with required and optional header + fields; which specify the message's properties and some routing information. + +7) **IP Framing & Transport Management:** After the final payload has been + constructed, it is sent to the underlying transport protocol for IP + management of the data. + +# Current Status of Matter + +Matter’s design and technical processes are intended to be open and transparent +to the general public, including to Working Group non-members wherever possible. +The availability of this GitHub repository and its source code under an Apache +v2 license is an important and demonstrable step to achieving this commitment. +Matter endeavors to bring together the best aspects of market-tested +technologies and redeploy them as a unified and cohesive whole-system solution. +The overall goal of this approach is to bring the benefits of Matter to +consumers and manufacturers as quickly as possible. As a result, what you +observe in this repository is an implementation-first approach to the technical +specification, vetting integrations in practice. The Matter repository is +growing and evolving to implement the overall architecture. The repository +currently contains the security foundations, message framing and dispatch, and +an implementation of the interaction model and data model. The code examples +show simple interactions, and are supported on multiple transports -- Wi-Fi and +Thread -- starting with resource-constrained (i.e., memory, processing) silicon +platforms to help ensure Matter’s scalability. + +# How to Contribute + +We welcome your contributions to Matter. Read our contribution guidelines +[here](./CONTRIBUTING.md). + +# Building and Developing in Matter + +Instructions about how to build Matter can be found [here](./docs/README.md) . + +# Directory Structure + +The Matter repository is structured as follows: + +| File/Folder | Content | +| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| build | Build system support content and built output directories | +| build_overrides | Build system parameter customization for different platforms | +| config | Project configurations | +| credentials | Development and test credentials | +| docs | Documentation, including guides. Visit the [Matter SDK documentation page](https://project-chip.github.io/connectedhomeip-doc/index.html) to read it. | +| examples | Example firmware applications that demonstrate use of Matter | +| integrations | 3rd party integrations | +| scripts | Scripts needed to work with the Matter repository | +| src | Implementation of Matter | +| third_party | 3rd party code used by Matter | +| zzz_generated | ZAP generated template code - Revolving around cluster information | +| BUILD.gn | Build file for the GN build system | +| CODE_OF_CONDUCT.md | Code of conduct for Matter and contribution to it | +| CONTRIBUTING.md | Guidelines for contributing to Matter | +| LICENSE | Matter license file | +| REVIEWERS.md | PR reviewers | +| gn_build.sh | Build script for specific projects such as Android, EFR32, etc. | +| README.md | This file | + +# License + +Matter is released under the [Apache 2.0 license](./LICENSE). diff --git a/README.md b/README.md index 07b959115615..c68d9d311588 100644 --- a/README.md +++ b/README.md @@ -1,229 +1,222 @@ -# Documentation links +# Telink Matter SDK -- [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/project-chip/connectedhomeip) -- [Matter SDK documentation page](https://project-chip.github.io/connectedhomeip-doc/index.html) -- [Matter SDK Coverage Report](https://matter-build-automation.ue.r.appspot.com/) +[![Telink Website](https://img.shields.io/badge/Website-Telink-blue?style=flat-square)](https://www.telink-semi.com/) +[![Forum](https://img.shields.io/badge/Forum-Telink-green?style=flat-square)](https://forum.telink-semi.cn/) +[![License](https://img.shields.io/badge/License-Apache%202.0-red?style=flat-square)](LICENSE) +[![Matter](https://img.shields.io/badge/Matter-v1.5-green?style=flat-square)](https://github.com/project-chip/connectedhomeip) -# Matter +--- -[![Builds](https://github.com/project-chip/connectedhomeip/workflows/Builds/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/build.yaml) +> 📖 This is the README for the **Telink Matter SDK** (fork). For the upstream +> Matter (Project CHIP) README, see [MATTER_README.md](MATTER_README.md). -**Builds** +**A Matter protocol implementation for Telink RISC-V SoC platforms based on the +Connected Home over IP (CHIP) project** -[![Android](https://github.com/project-chip/connectedhomeip/workflows/Android/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/android.yaml) -[![Ameba](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Ameba/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-ameba.yaml) -[![ASR](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ASR/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-asr.yaml) -[![BouffaloLab](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20BouffaloLab/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-bouffalolab.yaml) -[![Darwin](https://github.com/project-chip/connectedhomeip/workflows/Darwin/badge.svg)](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/darwin.yaml) -[![TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC13XX_26XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13xx_26xx.yaml) -[![TI CC32XX](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC32XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc32xx.yaml) -[![EFR32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20EFR32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-efr32.yaml) -[![ESP32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ESP32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-esp32.yaml) -[![Infineon](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml) -[![i.MX Linux](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20i.MX%20Linux/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-imx.yaml) -[![NXP FreeRTOS/Zephyr](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nxp.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nxp.yaml) -[![Linux ARM](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20ARM/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-arm.yaml) -[![Linux Standalone](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20Standalone/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-standalone.yaml) -[![nRF Connect SDK](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20nRF%20Connect%20SDK/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nrfconnect.yaml) -[![QPG](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20QPG/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-qpg.yaml) -[![STM32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20stm32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-stm32.yaml) -[![Telink](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Telink/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-telink.yaml) -[![Tizen](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Tizen/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-tizen.yaml) +- For development environment setup, SDK acquisition, and quick-start + instructions, refer to the + [Telink Matter Getting Started Guide](docs/platforms/telink/telink_getting_started.md). +- For a deeper walkthrough, see the online + [Telink Matter Developer Guide](https://doc.telink-semi.cn/doc/en/software/res/sdk/matter/telink_matter_developer_guide_en/) + (Chapter **Obtaining Matter Source Code** covers the initial setup). +- For a detailed list of supported devices and resource usage, refer to the + [Release Note](docs/platforms/telink/releases/telink_release_notes.md) -**Tests** +--- -[![Tests](https://github.com/project-chip/connectedhomeip/actions/workflows/tests.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/tests.yaml) -[![Unit / Integration Tests](https://github.com/project-chip/connectedhomeip/workflows/Unit%20/%20Integration%20Tests/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/unit_integration_test.yaml) -[![Cirque](https://github.com/project-chip/connectedhomeip/workflows/Cirque/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/cirque.yaml) -[![QEMU](https://github.com/project-chip/connectedhomeip/workflows/QEMU/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/qemu.yaml) +## 📖 SDK Introduction -**Tools** +Telink Matter SDK is a software development platform that implements the Matter +protocol on Telink RISC-V SoC platforms. It is built on top of the Connected +Home over IP (CHIP) project and integrates with the Telink Zephyr SDK to provide +complete Matter-over-Thread support for Telink chips. -[![ZAP Templates](https://github.com/project-chip/connectedhomeip/workflows/ZAP/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/zap_templates.yaml) +### What's Included -**Documentation** +- ✅ Matter 1.5.1 protocol stack +- ✅ Telink Zephyr RTOS integration +- ✅ Thread networking via OpenThread +- ✅ BLE commissioning support +- ✅ OTA firmware update support +- ✅ Factory data provisioning +- ✅ Power management with retention RAM +- ✅ MCUboot bootloader integration +- ✅ Multiple sample applications -[![Documentation Build](https://github.com/project-chip/connectedhomeip/actions/workflows/docbuild.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/docbuild.yaml) +### Supported Examples -# About +| Example Type | Description | +| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| **Matter over Thread** | Lights, switches, locks, sensors, thermostats, bridges, Smoke/CO alarms, pumps, air quality sensors, window coverings, etc. | +| **Development Tools** | Shell, OTA requestor, all-clusters test apps | -Matter (formerly Project CHIP) creates more connections between more objects, -simplifying development for manufacturers and increasing compatibility for -consumers, guided by the Connectivity Standards Alliance. +--- -# What is Matter? +## 🚀 Quick Reference -Matter is a unified, open-source application-layer connectivity standard built -to enable developers and device manufacturers to connect and build reliable, and -secure ecosystems and increase compatibility among connected home devices. It is -built with market-proven technologies using Internet Protocol (IP) and is -compatible with Thread and Wi-Fi network transports. Matter was developed by a -Working Group within the Connectivity Standards Alliance (Alliance). This -Working Group develops and promotes the adoption of the Matter standard, a -royalty-free connectivity standard to increase compatibility among smart home -products, with security as a fundamental design tenet. The vision that led major -industry players to come together to build Matter is that smart connectivity -should be simple, reliable, and interoperable. +| Resource | Description | Link | +| --------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | +| **Release Note** | Telink Matter SDK Changelog & New Features | [Telink Matter SDK Release Note](docs/platforms/telink/releases/telink_release_notes.md) | +| **Get Started Guide** | SDK Quick Start Guide | [Telink Matter Getting Started](docs/platforms/telink/telink_getting_started.md) | +| **Developer Guide** | Telink Matter Developer Guide (online) | [Telink Matter Developer Guide](https://doc.telink-semi.cn/doc/en/software/res/sdk/matter/telink_matter_developer_guide_en/) | +| **Examples** | Matter Sample Applications | See [examples](examples/) (filter by `telink`) | +| **Dependency** | Telink Zephyr SDK | [Telink Zephyr SDK](https://github.com/telink-semi/tl_zephyr/blob/dev-tlk_v4.1/README.md) | -Matter simplifies development for manufacturers and increases compatibility for -consumers. +--- -The standard was built around a shared belief that smart home devices should be -secure, reliable, and seamless to use. By building upon Internet Protocol (IP), -Matter enables communication across smart home devices, mobile apps, and cloud -services and defines a specific set of IP-based networking technologies for -device certification. +## 📚 Additional Resources -The Matter specification details everything necessary to implement a Matter -application and transport layer stack. It is intended to be used by implementers -as a complete specification. +| Type | Resource | +| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| 🌐 **Telink Official Website** | [Telink - Chips for a Smarter IoT](https://www.telink-semi.com/) | +| 💬 **Telink Forum** | [Telink Technical Support](https://forum.telink-semi.cn/) | +| 📖 **Documentation** | [Telink Matter Developer Guide](https://doc.telink-semi.cn/doc/en/software/res/sdk/matter/telink_matter_developer_guide_en/) | +| 📦 **Matter Community Project** | [Connected Home over IP](https://github.com/project-chip/connectedhomeip) | -The Alliance officially opened the Matter Working Group on January 17, 2020, and -the specification is -[available](https://csa-iot.org/developer-resource/specifications-download-request/) -for adoption now. +--- -Visit [buildwithmatter.com](https://buildwithmatter.com) to learn more and read -the latest news and updates about the project. +## 🔧 Environment Setup -# Project Overview +### Prerequisites -## Development Goals +The Telink Matter SDK is built **on top of** the Telink Zephyr SDK. They are +tightly coupled and must be installed as a matched pair. Set up the Telink +Zephyr SDK **before** the Matter SDK. -Matter is developed with the following goals and principles in mind: +#### Dependency Overview -**Unifying:** Matter is built with and on top of market-tested, existing -technologies. +| Component | Role | Required | +| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | :------: | +| **Telink Zephyr SDK** (`dev-tlk_v4.1` branch) | Provides the Zephyr RTOS core, Telink HAL, BLE stack, MCUBoot, OpenThread, the WEST tool and build toolchain | ✅ | +| **Telink Matter SDK** (`dev-tlk_v1.5` branch, this repo) | Provides Matter protocol stack and Telink Matter examples; consumes the Telink Zephyr SDK via `TELINK_ZEPHYR_BASE` | ✅ | -**Interoperable:** The specification permits communication between any -Matter-certified device, subject to users’ permission. +#### Setup Steps -**Secure:** The specification leverages modern security practices and protocols. +The setup follows the standard Zephyr "Environment Setup (Manual)" flow, +tailored for Telink. A full walkthrough (with host package versions and +screenshots) is in Chapter **Environment Setup (Manual)** of the +[Telink Matter Developer Guide](https://doc.telink-semi.cn/doc/en/software/res/sdk/matter/telink_matter_developer_guide_en/); +the high-level steps are: -**User Control:** The end user controls authorization for interaction with -devices. +1. **Set up the host (Ubuntu 24.04 LTS)** — install the OS packages required by + Zephyr and the Matter build: `git`, `python3` + `pip` + `venv`, `make`, + `gcc`, `g++`, `cmake`, `dfu-util`, `device-tree-compiler`, `libssl-dev`, + `libffi-dev`, `libudev-dev`, `usbutils` and the `curl`/`wget` downloaders. + Add the user to the `dialout`/`plugdev` groups and install the Telink USB + udev rules so the programmer is reachable without `sudo`. -**Federated:** No single entity serves as a throttle or a single point of -failure for root of trust. +2. **Install `west`** — Zephyr's multi-repository meta-tool. It is pulled in as + a Python package and must be available on `PATH` before any `west` command is + used. -**Robust:** The set of protocols specifies a complete lifecycle of a device — -starting with the seamless out-of-box experience, through operational protocols, -to device and system management specifications required for proper function in -the presence of change. - -**Low Overhead:** The protocols are practically implementable on low -compute-resource devices, such as MCUs. - -**Pervasive:** The protocols are broadly deployable and accessible, by -leveraging IP and being implementable on low-capability devices. - -**Ecosystem-Flexible:** The protocol is flexible enough to accommodate -deployment in ecosystems with differing policies. - -**Easy to Use:** The protocol provides smooth, cohesive, integrated provisioning -and out-of-box experience. - -**Open:** The Project’s design and technical processes are open and transparent -to the general public, including non-members wherever possible. +3. **Get the Telink Zephyr SDK** — `west init` the Zephyr manifest repository + and then check out Telink SDK (branch `dev-tlk_v4.1`) . Run `west update` to + fetch Zephyr itself, the Telink HAL, OpenThread, MCUBoot. Download and + install Zephyr SDK toolchain (which provides the `riscv64-zephyr-elf` GCC + cross-compiler). See Chapter **Install Zephyr Project Environment** in the + [Matter Developer Guide](https://doc.telink-semi.cn/doc/en/software/res/sdk/matter/telink_matter_developer_guide_en/) + for the exact `west` commands. -## Architecture Overview +4. **Get the Telink Matter SDK (this repo)** — clone the `dev-tlk_v1.5` branch + of this repository next to the Zephyr SDK. -Matter aims to build a universal IPv6-based communication protocol for smart -home devices. The protocol defines the application layer that will be deployed -on devices and the different link layers to help maintain interoperability. The -following diagram illustrates the normal operational mode of the stack: -![Matter Architecture Overview](docs/images/Matter_Arch_Overview.png) +5. **Point the Matter SDK at the Zephyr SDK** — export `TELINK_ZEPHYR_BASE` so + the Matter build system can find Zephyr, the Telink HAL and the toolchain. + This variable must be set in every shell used for Matter builds. -The architecture is divided into layers to help separate the different -responsibilities and introduce a good level of encapsulation among the various -pieces of the protocol stack. The vast majority of interactions flow through the -stack captured in the following Figure: +6. **Bootstrap & activate the Matter build environment** — run the Matter + `scripts/activate.sh` bootstrap once to install `gn`, `ninja`, `pigweed` and + the Python dependencies, then source it in every new shell before building. -![Matter Stack Architecture](docs/images/Matter_Layered_Arch.png) +> 💡 The exact shell commands for each step (apt/pip/west/git/export) are listed +> in the **Environment Setup (Manual)** chapter of the +> [Telink Matter Developer Guide](https://doc.telink-semi.cn/doc/en/software/res/sdk/matter/telink_matter_developer_guide_en/). +> Follow that guide to avoid version mismatches. -1. **Application:** High-order business logic of a device. For example, an - application that is focused on lighting might contain logic to handle turning - on/off the bulb as well as its color characteristics. +### Building Examples -2) **Data Model:** The data layer corresponds to the data and verb elements that - help support the functionality of the application. The Application operates - on these data structures when there is an intent to interact with the device. - -3. **Interaction Model:** The Interaction Model layer defines a set of - interactions that can be performed between a client and server device. For - example, reading or writing attributes on a server device would correspond to - application behavior on the device. These interactions operate on the - elements defined at the data model layer. - -4) **Action Framing:** Once an action is constructed using the Interaction - Model, it is serialized into a prescribed packed binary format to encode for - network transmission. - -5. **Security:** An encoded action frame is then sent down to the Security Layer - to encrypt and sign the payload to ensure that data is secured and - authenticated by both sender and receiver of a packet. +Matter builds use `west build` directly from each example's `telink` directory. +Each supported board ships a dedicated `*_README.md` under +`examples//telink/boards/` that lists the exact build commands for every +configuration of that board (default, OTA + LZMA, dual-mode Matter + Zigbee, 4 +MB flash, Software Version 2 for DFU/OTA images, etc.). -6. **Message Framing & Routing:** With an interaction encrypted and signed, the - Message Layer constructs the payload format with required and optional header - fields; which specify the message's properties and some routing information. +Refer to the board README for the app + board combination you want to build: -7) **IP Framing & Transport Management:** After the final payload has been - constructed, it is sent to the underlying transport protocol for IP - management of the data. +#### Lighting App (TL3238X / TL521X / TL7218X) -# Current Status of Matter +- TL3238X: + [`examples/lighting-app/telink/boards/tl3238x_README.md`](examples/lighting-app/telink/boards/tl3238x_README.md) +- TL5218X: + [`examples/lighting-app/telink/boards/tl5218x_README.md`](examples/lighting-app/telink/boards/tl5218x_README.md) +- TL7218X: + [`examples/lighting-app/telink/boards/tl7218x_README.md`](examples/lighting-app/telink/boards/tl7218x_README.md) -Matter’s design and technical processes are intended to be open and transparent -to the general public, including to Working Group non-members wherever possible. -The availability of this GitHub repository and its source code under an Apache -v2 license is an important and demonstrable step to achieving this commitment. -Matter endeavors to bring together the best aspects of market-tested -technologies and redeploy them as a unified and cohesive whole-system solution. -The overall goal of this approach is to bring the benefits of Matter to -consumers and manufacturers as quickly as possible. As a result, what you -observe in this repository is an implementation-first approach to the technical -specification, vetting integrations in practice. The Matter repository is -growing and evolving to implement the overall architecture. The repository -currently contains the security foundations, message framing and dispatch, and -an implementation of the interaction model and data model. The code examples -show simple interactions, and are supported on multiple transports -- Wi-Fi and -Thread -- starting with resource-constrained (i.e., memory, processing) silicon -platforms to help ensure Matter’s scalability. +#### Light Switch App (TL3238X Retention / TL7218X Retention) -# How to Contribute - -We welcome your contributions to Matter. Read our contribution guidelines -[here](./CONTRIBUTING.md). - -# Building and Developing in Matter - -Instructions about how to build Matter can be found [here](./docs/README.md) . - -# Directory Structure - -The Matter repository is structured as follows: - -| File/Folder | Content | -| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| build | Build system support content and built output directories | -| build_overrides | Build system parameter customization for different platforms | -| config | Project configurations | -| credentials | Development and test credentials | -| docs | Documentation, including guides. Visit the [Matter SDK documentation page](https://project-chip.github.io/connectedhomeip-doc/index.html) to read it. | -| examples | Example firmware applications that demonstrate use of Matter | -| integrations | 3rd party integrations | -| scripts | Scripts needed to work with the Matter repository | -| src | Implementation of Matter | -| third_party | 3rd party code used by Matter | -| zzz_generated | ZAP generated template code - Revolving around cluster information | -| BUILD.gn | Build file for the GN build system | -| CODE_OF_CONDUCT.md | Code of conduct for Matter and contribution to it | -| CONTRIBUTING.md | Guidelines for contributing to Matter | -| LICENSE | Matter license file | -| REVIEWERS.md | PR reviewers | -| gn_build.sh | Build script for specific projects such as Android, EFR32, etc. | -| README.md | This file | - -# License - -Matter is released under the [Apache 2.0 license](./LICENSE). +- TL3238X Retention: + [`examples/light-switch-app/telink/boards/tl3238x_retention_README.md`](examples/light-switch-app/telink/boards/tl3238x_retention_README.md) +- TL7218X Retention: + [`examples/light-switch-app/telink/boards/tl7218x_retention_README.md`](examples/light-switch-app/telink/boards/tl7218x_retention_README.md) + +#### Concurrent Mode (TL3238X / TL7218X) + +- TL3238X BLE + Thread Concurrent: + [`examples/lighting-app/telink/boards/tl3238x_concurrent_README.md`](examples/lighting-app/telink/boards/tl3238x_concurrent_README.md) +- TL7218X BLE + Thread Concurrent: + [`examples/lighting-app/telink/boards/tl7218x_concurrent_README.md`](examples/lighting-app/telink/boards/tl7218x_concurrent_README.md) +- TL7218X BLE + Thread Concurrent + Channel Sounding: + [`examples/lighting-app/telink/boards/tl7218x_concurrent_cs_README.md`](examples/lighting-app/telink/boards/tl7218x_concurrent_cs_README.md) + +> **Note:** LZMA compression is **required** for 2 MB flash with OTA. Build +> Software Version 2 (via the flag documented in each `*_README.md`) to generate +> the DFU/OTA upgrade images (`merged_dfu.lzma.bin`, `matter.ota`). The same +> `*_README.md` files also cover dual-mode (Matter + Zigbee), BLE + Thread +> concurrent mode, Channel Sounding (CS), and 4 MB flash configurations. + +### Flashing Firmware + +For developing and testing purposes, refer to Chapter **Firmware Burning** in +our +[Matter Develop Guide](https://doc.telink-semi.cn/doc/en/software/res/sdk/matter/telink_matter_developer_guide_en/?h=bdt#experience-the-implementation-and-function-of-matter). + +--- + +## 📱 Supported Boards + +| Board | Chip Family | Series | Status | +| ------- | ----------- | ------ | -------------------- | +| tl3238x | TL323X | - | Telink Zephyr HAL_V2 | +| tl5218x | TL521X | - | Telink Zephyr HAL_V2 | +| tl7218x | TL721X | - | Telink Zephyr HAL_V2 | + +--- + +## 📝 Release Information + +For version history and detailed changelog, refer to the +[Release Note](docs/platforms/telink/releases/telink_release_notes.md). + +--- + +## 📄 License + +``` +Apache License, Version 2.0 + +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. +``` + +--- + +Made by Telink Semiconductor diff --git a/TELINK_VERSION b/TELINK_VERSION new file mode 100644 index 000000000000..9aaceb605a92 --- /dev/null +++ b/TELINK_VERSION @@ -0,0 +1,5 @@ +VERSION_MAJOR = 1 +VERSION_MINOR = 0 +PATCHLEVEL = 1 +VERSION_TWEAK = 0 +EXTRAVERSION = diff --git a/config/telink/app/bootloader.conf b/config/telink/app/bootloader.conf index cdc60a11c7a8..e1d945741abc 100644 --- a/config/telink/app/bootloader.conf +++ b/config/telink/app/bootloader.conf @@ -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=y +CONFIG_BOOT_BOOTSTRAP=n # Enable this option in case if SWAP_MOVE logic need to be used CONFIG_BOOT_SWAP_USING_MOVE=y @@ -27,7 +27,8 @@ 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 +CONFIG_BOOT_VALIDATE_SLOT0_ONCE=y # Required for Zephyr 3.3 and replased with CONFIG_BOOT_MAX_IMG_SECTORS_AUTO in new versions # Maximum number of image sectors supported by the bootloader. @@ -42,4 +43,16 @@ CONFIG_BOOT_MAX_IMG_SECTORS=512 # - DEBUG, LOG_LEVEL_DBG CONFIG_MCUBOOT_LOG_LEVEL_INF=y +# Enable support LZMA compression +CONFIG_COMPRESS_LZMA=n + CONFIG_PICOLIBC=y + +# Disabling the banner is to allow cmd tool to better parse the chip ID, avoid interface. +CONFIG_BOOT_BANNER=n + +CONFIG_BOOT_IMG_HASH_DIRECTLY_ON_STORAGE=y + +# CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y +# CONFIG_BOOT_SIGNATURE_KEY_FILE="ecdsa_private_key.pem" +# CONFIG_BOOT_SIGNATURE_KEY_FILE="" diff --git a/config/telink/app/bootloader_compress_lzma.conf b/config/telink/app/bootloader_compress_lzma.conf index 6cab83229bae..e2fb166e9ef2 100644 --- a/config/telink/app/bootloader_compress_lzma.conf +++ b/config/telink/app/bootloader_compress_lzma.conf @@ -20,7 +20,8 @@ CONFIG_BOOT_UPGRADE_ONLY=y # 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 +CONFIG_BOOT_VALIDATE_SLOT0_ONCE=y # Required for Zephyr 3.3 and replased with CONFIG_BOOT_MAX_IMG_SECTORS_AUTO in new versions # Maximum number of image sectors supported by the bootloader. @@ -45,3 +46,12 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_COMPRESS_LZMA=y CONFIG_PICOLIBC=y + +# Disabling the banner is to allow cmd tool to better parse the chip ID, avoid interface. +CONFIG_BOOT_BANNER=n + +CONFIG_BOOT_IMG_HASH_DIRECTLY_ON_STORAGE=y + +# CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y +# CONFIG_BOOT_SIGNATURE_KEY_FILE="ecdsa_private_key.pem" +# CONFIG_BOOT_SIGNATURE_KEY_FILE="" diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index fb2d0606e3b2..3b8f7a8dbb72 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -72,6 +72,9 @@ matter_add_flags(-DMBEDTLS_USER_CONFIG_FILE=<${CONFIG_MBEDTLS_CFG_FILE}>) if (CONFIG_OPENTHREAD_TELINK_LIBRARY) set(ZEPHYR_OPENTHREAD_MODULE_DIR ${ZEPHYR_BASE}/../modules/lib/openthread_telink_lib CACHE STRING INTERNAL) message(STATUS "OpenThread used as precompiled Telink library, path: ${ZEPHYR_OPENTHREAD_MODULE_DIR}") +else() + set(ZEPHYR_OPENTHREAD_MODULE_DIR ${ZEPHYR_BASE}/../modules/lib/openthread CACHE STRING INTERNAL) + message(STATUS "OpenThread used from source, path: ${ZEPHYR_OPENTHREAD_MODULE_DIR}") endif() if (CONFIG_CHIP_OPENTHREAD_CONFIG) @@ -132,6 +135,29 @@ if (CONFIG_CHIP_ROTATING_DEVICE_ID) matter_add_gn_arg_bool("chip_enable_additional_data_advertising" TRUE) endif() +if(${TLNK_LOG_LEVEL} MATCHES all) + matter_add_gn_arg_bool("chip_logging" TRUE) + matter_add_gn_arg_bool("chip_error_logging" TRUE) + matter_add_gn_arg_bool("chip_progress_logging" TRUE) + matter_add_gn_arg_bool("chip_detail_logging" TRUE) + matter_add_gn_arg_bool("chip_automation_logging" TRUE) +elseif(${TLNK_LOG_LEVEL} MATCHES progress) + matter_add_gn_arg_bool("chip_logging" TRUE) + matter_add_gn_arg_bool("chip_error_logging" TRUE) + matter_add_gn_arg_bool("chip_progress_logging" TRUE) + matter_add_gn_arg_bool("chip_detail_logging" FALSE) + matter_add_gn_arg_bool("chip_automation_logging" FALSE) +elseif(${TLNK_LOG_LEVEL} MATCHES error) + matter_add_gn_arg_bool("chip_logging" TRUE) + matter_add_gn_arg_bool("chip_error_logging" TRUE) + matter_add_gn_arg_bool("chip_progress_logging" FALSE) + matter_add_gn_arg_bool("chip_detail_logging" FALSE) + matter_add_gn_arg_bool("chip_automation_logging" FALSE) +elseif(${TLNK_LOG_LEVEL} MATCHES none) + matter_add_gn_arg_bool("chip_logging" FALSE) +endif() + + if (CONFIG_WIFI_W91) matter_add_gn_arg_string("chip_mdns" "minimal") elseif (CONFIG_NET_L2_OPENTHREAD) @@ -170,25 +196,140 @@ endif() # Define 'process_binaries' target for collecting final binary to flash # ============================================================================== +set(BLOCK_SIZE "1024") +set(CONFIG_DUAL_MODE_ARG 0) + +if(CONFIG_SOC_RISCV_TELINK_TL321X) + set(SOC "TL321X") +elseif(CONFIG_SOC_RISCV_TELINK_TL322X) + set(SOC "TL322X") +elseif(CONFIG_SOC_RISCV_TELINK_TL323X) + set(SOC "TL323X") + set(CONFIG_DUAL_MODE_ARG ${CONFIG_DUAL_MODE}) +elseif(CONFIG_SOC_RISCV_TELINK_TL521X) + set(SOC "TL521X") + set(CONFIG_DUAL_MODE_ARG ${CONFIG_DUAL_MODE}) +elseif(CONFIG_SOC_RISCV_TELINK_TL721X) + set(SOC "TL721X") +elseif(CONFIG_SOC_RISCV_TELINK_B91) + set(SOC "TLSR9518") +elseif(CONFIG_SOC_RISCV_TELINK_B92) + set(SOC "TLSR9528") +elseif(CONFIG_SOC_RISCV_TELINK_W91) + set(SOC "TLSR9118") +endif() + +set(SBOOT_FILE_PATH "${ZEPHYR_BASE}/${SOC}_FW/SBOOT/Secure_Bootloader.bin") +math(EXPR SKIP_BYTES_DECIMAL "${CONFIG_MCUBOOT_START_OFFSET} / ${BLOCK_SIZE}" OUTPUT_FORMAT DECIMAL) +message(STATUS "SKIP_BYTES_DECIMAL: ${SKIP_BYTES_DECIMAL}") +if (EXISTS ${SBOOT_FILE_PATH}) + message(STATUS "Will merge sboot and mcuboot with offset ${CONFIG_MCUBOOT_START_OFFSET} bytes.") + set(MCUBOOT_START_OFFSET_ARG "${CONFIG_MCUBOOT_START_OFFSET}") + else() + message(WARNING "File ${SBOOT_FILE_PATH} does not exist. Set SKIP_BYTES_DECIMAL to 0, MCUBOOT will be built without offset.") + set(SKIP_BYTES_DECIMAL 0) + set(MCUBOOT_START_OFFSET_ARG "0") +endif() + +set(ZB_FILE_PATH "${ZEPHYR_BASE}/${SOC}_FW/ZB/Zigbee-SampleDemo.bin") +# Calculate the offset of zigbee partition relative to slot0 start +dt_nodelabel(slot0_partition_path NODELABEL "slot0_partition") +dt_reg_addr(slot0_start PATH ${slot0_partition_path}) +dt_reg_size(slot0_size PATH ${slot0_partition_path}) +message(STATUS "slot0_start: ${slot0_start}") +message(STATUS "slot0_size: ${slot0_size}") +if (CONFIG_DUAL_MODE AND EXISTS ${ZB_FILE_PATH}) + dt_nodelabel(zb_partition_path NODELABEL "slot0_zb_partition") + dt_reg_addr(zb_start PATH ${zb_partition_path}) + message(STATUS "zb_start: ${zb_start}") + math(EXPR zb_offset_bytes "${zb_start} - ${slot0_start}" OUTPUT_FORMAT DECIMAL) + math(EXPR ZB_FW_OFFSET_DECIMAL "${zb_offset_bytes} / ${BLOCK_SIZE}" OUTPUT_FORMAT DECIMAL) + message(STATUS "ZB_FW_OFFSET_DECIMAL: ${ZB_FW_OFFSET_DECIMAL}") +else() + if (NOT CONFIG_DUAL_MODE) + message(STATUS "CONFIG_DUAL_MODE is 0, skipping Zigbee merge setup") + else() + message(WARNING "File ${ZB_FILE_PATH} does not exist. ZB_FW_OFFSET_DECIMAL will be set to 0.") + endif() + set(ZB_FW_OFFSET_DECIMAL 0) +endif() + add_custom_target( process_binaries ALL COMMAND ${Python3_EXECUTABLE} ${CHIP_ROOT}/scripts/tools/telink/process_binaries.py WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) -add_dependencies(process_binaries ${ZEPHYR_FINAL_EXECUTABLE}) +if(CONFIG_DUAL_MODE AND EXISTS ${ZB_FILE_PATH} AND CONFIG_BOOTLOADER_MCUBOOT AND (CONFIG_SOC_RISCV_TELINK_B9X OR CONFIG_SOC_FAMILY_TELINK_TLX)) + add_dependencies(process_binaries west_sign) +else() + add_dependencies(process_binaries ${ZEPHYR_FINAL_EXECUTABLE}) +endif() # ============================================================================== # Define 'build_mcuboot' target for building the MCUBoot bootloader # ============================================================================== -if (CONFIG_BOOTLOADER_MCUBOOT AND (CONFIG_SOC_RISCV_TELINK_B9X OR CONFIG_SOC_RISCV_TELINK_TLX)) +if (CONFIG_BOOTLOADER_MCUBOOT AND (CONFIG_SOC_RISCV_TELINK_B9X OR CONFIG_SOC_FAMILY_TELINK_TLX)) add_custom_target(build_mcuboot ALL COMMAND west build -b ${BASE_BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr - -- -DOVERLAY_CONFIG=${GLOBAL_BOOT_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE="${GLOBAL_BOOT_DTC_OVERLAY_FILE};${FLASH_DTC_OVERLAY_FILE};${USB_BOOT_DTC_OVERLAY_FILE};${MARS_BOOT_DTC_OVERLAY_FILE}" + -- -DCONFIG_MCUBOOT_START_OFFSET=${MCUBOOT_START_OFFSET_ARG} -DCONFIG_DUAL_MODE=${CONFIG_DUAL_MODE_ARG} -DOVERLAY_CONFIG=${GLOBAL_BOOT_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE="${GLOBAL_BOOT_DTC_OVERLAY_FILE};${FLASH_DTC_OVERLAY_FILE};${USB_BOOT_DTC_OVERLAY_FILE};${MARS_BOOT_DTC_OVERLAY_FILE}" + COMMAND + dd if=${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/zephyr.bin of=${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/mcuboot_for_sign.bin bs=${BLOCK_SIZE} skip=${SKIP_BYTES_DECIMAL} conv=notrunc + COMMAND + cp ${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/mcuboot_for_sign.bin ${PROJECT_BINARY_DIR}/zephyr.mcuboot.bin + COMMAND + cp ${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/mcuboot_for_sign.bin ${PROJECT_BINARY_DIR}/mcuboot_for_sign.bin COMMAND - cp ${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/zephyr.bin ${PROJECT_BINARY_DIR}/mcuboot.bin + cp ${PROJECT_BINARY_DIR}/mcuboot_for_sign.bin ${PROJECT_BINARY_DIR}/mcuboot.bin ) + message(STATUS "mcuboot_for_sign.bin is for external signing.") + + if (EXISTS ${SBOOT_FILE_PATH}) + add_custom_target(merge_sboot ALL + COMMAND + dd if=/dev/zero bs=${BLOCK_SIZE} count=${SKIP_BYTES_DECIMAL} | tr '\\000' '\\377' > ${PROJECT_BINARY_DIR}/bootloader_merged.bin + COMMAND + dd if=${SBOOT_FILE_PATH} of=${PROJECT_BINARY_DIR}/bootloader_merged.bin conv=notrunc + COMMAND + dd if=${PROJECT_BINARY_DIR}/zephyr.mcuboot.bin of=${PROJECT_BINARY_DIR}/bootloader_merged.bin bs=${BLOCK_SIZE} seek=${SKIP_BYTES_DECIMAL} conv=notrunc + COMMAND + cp ${PROJECT_BINARY_DIR}/bootloader_merged.bin ${PROJECT_BINARY_DIR}/mcuboot.bin + ) + add_dependencies(merge_sboot build_mcuboot) + message(WARNING "merged secure boot to mcuboot..") + else() + message(WARNING "File ${SBOOT_FILE_PATH} does not exist. merge_sboot target will not be created.") + endif() + + if (CONFIG_DUAL_MODE AND EXISTS ${ZB_FILE_PATH}) + add_custom_target(merge_zigbee ALL + COMMAND + cp ${PROJECT_BINARY_DIR}/zephyr.bin ${PROJECT_BINARY_DIR}/zephyr.matter.bin # store matter firmware + COMMAND + dd if=/dev/zero bs=${BLOCK_SIZE} count=${ZB_FW_OFFSET_DECIMAL} | tr '\\000' '\\377' > ${PROJECT_BINARY_DIR}/dm_merged.bin + COMMAND + dd if=${PROJECT_BINARY_DIR}/zephyr.matter.bin of=${PROJECT_BINARY_DIR}/dm_merged.bin conv=notrunc + COMMAND + dd if=${ZB_FILE_PATH} of=${PROJECT_BINARY_DIR}/dm_merged.bin bs=${BLOCK_SIZE} seek=${ZB_FW_OFFSET_DECIMAL} conv=notrunc + COMMAND + cp ${PROJECT_BINARY_DIR}/dm_merged.bin ${PROJECT_BINARY_DIR}/zephyr.bin + COMMAND + cp ${PROJECT_BINARY_DIR}/dm_merged.bin ${PROJECT_BINARY_DIR}/unsign_merged.bin # store unsign merged firmware + ) + add_custom_target(west_sign ALL + COMMAND + west sign -t imgtool -p ${ZEPHYR_BASE}/../bootloader/mcuboot/scripts/imgtool.py -d ${PROJECT_BINARY_DIR}/.. -- --key ${ZEPHYR_BASE}/../${CONFIG_MCUBOOT_SIGNATURE_KEY_FILE} --slot-size ${slot0_size} + ) + add_dependencies(merge_zigbee ${ZEPHYR_FINAL_EXECUTABLE}) + add_dependencies(west_sign merge_zigbee) + else() + if (NOT CONFIG_DUAL_MODE) + message(STATUS "CONFIG_DUAL_MODE is 0, skipping merge_zigbee and west_sign targets") + else() + message(WARNING "File ${ZB_FILE_PATH} does not exist. merge_zigbee target will not be created.") + endif() + endif() endif() # ============================================================================== @@ -213,9 +354,20 @@ if (CONFIG_CHIP_OTA_IMAGE_BUILD) endif() # ============================================================================== -# Define 'dfu-smp-image' target for building DFU over BT SMP image +# DFU over BT SMP support: compile the DFUOverSMP source, common for all +# Telink applications, and define 'dfu-smp-image' target for building +# the DFU over BT SMP image # ============================================================================== +if (CONFIG_MCUMGR_TRANSPORT_BT) + zephyr_library() + zephyr_library_sources(${CHIP_ROOT}/examples/platform/telink/util/src/DFUOverSMP.cpp) + target_include_directories(${ZEPHYR_CURRENT_LIBRARY} PRIVATE + ${CHIP_ROOT}/examples/platform/telink/util/include + ) + zephyr_library_link_libraries(MCUBOOT_BOOTUTIL chip) +endif() + if (CONFIG_CHIP_DFU_OVER_BT_SMP_BUILD) file(WRITE "${PROJECT_BINARY_DIR}/empty.txt" "") chip_ota_image(dfu-smp-image diff --git a/config/telink/chip-module/Kconfig b/config/telink/chip-module/Kconfig index ff51f17b19ba..c966f2cedef6 100644 --- a/config/telink/chip-module/Kconfig +++ b/config/telink/chip-module/Kconfig @@ -84,6 +84,9 @@ config CHIP_DFU_OVER_BT_SMP select MCUMGR_MGMT_NOTIFICATION_HOOKS select MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK select MCUMGR_GRP_IMG_STATUS_HOOKS + default y if BOARD_TL3238X || BOARD_TL3238X_RETENTION + default y if BOARD_TLSR9528A || BOARD_TLSR9528A_RETENTION + default n help Enables Device Firmware Upgrade over Bluetooth LE with SMP and configures the set of options related to that feature. @@ -211,6 +214,29 @@ config CHIP_ENABLE_PM_DURING_BLE help Enable PM during BLE operation. +config CHIP_CONCURRENT_MODE + bool "Keep BLE active while Thread is running" + depends on IEEE802154_TLX_BLE_COEXIST + default n + help + Allow BLE and Thread to run simultaneously on TLX SoCs. Without this + option, BLE is disabled once Thread is commissioned. With it enabled, + BLE stays available for connection or Channel Sounding alongside + an active Thread network. + +config CHIP_CONCURRENT_BLE_IDLE + bool "Keep BLE idle after Thread commissioning in concurrent mode" + depends on CHIP_CONCURRENT_MODE + default n + help + When enabled, BLE advertising is not automatically re-enabled after + Thread commissioning completes or after a commissioned device reboots. + The BLE stack stays initialized but idle, and advertising must be + started manually (e.g. via a button press). This saves power while + still allowing on-demand BLE access alongside an active Thread network. + Use this together with a button handler that calls + SetBLEAdvertisingEnabled(true) when BLE is needed. + config SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE default 255 if SHELL_BACKEND_SERIAL @@ -233,8 +259,9 @@ config CHIP_USE_MARS_SENSOR default n config CHIP_PERSISTENT_SUBSCRIPTIONS - default n if BOARD_TL3218X_RETENTION - default y + default y if BOARD_TL3238X || BOARD_TL3238X_RETENTION + default y if BOARD_TLSR9528A || BOARD_TLSR9528A_RETENTION + default n # selecting experimental for this feature since there is an issue with multiple controllers. select EXPERIMENTAL @@ -279,3 +306,16 @@ endif config TFLM_FEATURE bool "Enable the TFLM micro speech feature" default n + +config SECURE_PROGRAMMING + bool "Enable reading DAC and keys from the DAC partition" + depends on CHIP_FACTORY_DATA + default n + +config EXPOSE_CHIP_ID_VIA_BLE + bool "Enable CHIP-ID via ble" + default n + +config DEFERRED_ATTR_STORAGE + bool "Defer the storage time of attributes" + default n diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index f3e410ade62e..043bb6593401 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -69,7 +69,11 @@ config POSIX_MAX_FDS # Application stack size config MAIN_STACK_SIZE default 4864 if SOC_RISCV_TELINK_W91 + default 3072 if PM && SOC_RISCV_TELINK_TL321X default 3240 if PM || SOC_RISCV_TELINK_TL321X + default 3240 if SOC_RISCV_TELINK_TL323X + default 3240 if SOC_RISCV_TELINK_TL521X + default 3240 if SOC_RISCV_TELINK_TL721X default 4096 config INIT_STACKS @@ -77,19 +81,29 @@ config INIT_STACKS config IDLE_STACK_SIZE default 560 if PM || SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_W91 + default 560 if SOC_RISCV_TELINK_TL323X + default 560 if SOC_RISCV_TELINK_TL521X + default 560 if SOC_RISCV_TELINK_TL721X config ISR_STACK_SIZE default 800 if PM || SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_W91 + default 1024 if SOC_RISCV_TELINK_TL323X + default 1024 if SOC_RISCV_TELINK_TL521X + default 1024 if SOC_RISCV_TELINK_TL721X config SYSTEM_WORKQUEUE_STACK_SIZE default 664 if PM && !SOC_RISCV_TELINK_W91 + default 2048 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X config HEAP_MEM_POOL_SIZE default 256 if ZEPHYR_VERSION_3_3 + default 1796 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 1280 config COMMON_LIBC_MALLOC_ARENA_SIZE + default 30720 if (SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X) && CHIP_CONCURRENT_MODE && !ZEPHYR_VERSION_3_3 default 19000 if SOC_RISCV_TELINK_TL321X && !ZEPHYR_VERSION_3_3 + default 26584 if (SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X) && !ZEPHYR_VERSION_3_3 default 29448 if SOC_RISCV_TELINK_W91 default 20716 @@ -101,6 +115,7 @@ config NET_IF_UNICAST_IPV6_ADDR_COUNT default 6 config NET_IF_MCAST_IPV6_ADDR_COUNT + default 47 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 8 if PM default 15 @@ -110,20 +125,20 @@ config NET_IF_IPV6_PREFIX_COUNT # Network buffers config NET_PKT_RX_COUNT default 16 if SOC_RISCV_TELINK_W91 - default 4 if PM || SOC_RISCV_TELINK_TL321X + default 4 if PM || SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 8 config NET_PKT_TX_COUNT default 16 if SOC_RISCV_TELINK_W91 - default 4 if PM || SOC_RISCV_TELINK_TL321X + default 4 if PM || SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 8 config NET_BUF_RX_COUNT - default 12 if (PM && !SOC_RISCV_TELINK_W91) || SOC_RISCV_TELINK_TL321X + default 12 if (PM && !SOC_RISCV_TELINK_W91) || SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 32 config NET_BUF_TX_COUNT - default 12 if (PM && !SOC_RISCV_TELINK_W91) || SOC_RISCV_TELINK_TL321X + default 12 if (PM && !SOC_RISCV_TELINK_W91) || SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 32 config GPIO @@ -152,15 +167,15 @@ config BT_MAX_CONN default 1 config BT_L2CAP_TX_MTU - default 103 if SOC_RISCV_TELINK_TL321X + default 103 if SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 247 config BT_BUF_ACL_RX_SIZE - default 107 if SOC_RISCV_TELINK_TL321X + default 107 if SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 251 config BT_BUF_ACL_TX_SIZE - default 107 if SOC_RISCV_TELINK_TL321X + default 107 if SOC_RISCV_TELINK_TL321X || SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 251 config BT_BUF_EVT_RX_COUNT @@ -184,11 +199,11 @@ config BT_HOST_CRYPTO default y if ZEPHYR_VERSION_3_3 default n -if SOC_RISCV_TELINK_B9X || SOC_RISCV_TELINK_TLX +if SOC_RISCV_TELINK_B9X || SOC_FAMILY_TELINK_TLX config TL_BLE_CTRL_THREAD_STACK_SIZE default 648 if ZEPHYR_VERSION_3_3 - default 768 if SOC_RISCV_TELINK_TL721X + default 1536 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 712 config TL_BLE_CTRL_MASTER_MAX_NUM @@ -206,7 +221,7 @@ choice TL_BLE_CTRL_MAC_TYPE default TL_BLE_CTRL_MAC_TYPE_RANDOM_STATIC endchoice -endif # SOC_RISCV_TELINK_B9X || SOC_RISCV_TELINK_TLX +endif # SOC_RISCV_TELINK_B9X || SOC_FAMILY_TELINK_TLX endif # BT @@ -222,12 +237,14 @@ config PWM endif -if BOARD_TL7218X_RETENTION || BOARD_TL3218X_RETENTION || BOARD_TL3218X +if BOARD_TL7218X_RETENTION || BOARD_TL3218X_RETENTION || BOARD_TL3218X || \ + BOARD_TL3238X_RETENTION || BOARD_TL3238X || \ + BOARD_TL5218X_RETENTION || BOARD_TL5218X config SOC_SERIES_RISCV_TELINK_TLX_NON_RETENTION_RAM_CODE default n if PM config TELINK_TLX_MATTER_RETENTION_LAYOUT - default y if PM || BOARD_TL3218X + default y if PM || BOARD_TL3218X || BOARD_TL3238X || BOARD_TL5218X config PWM default n if PM @@ -236,7 +253,8 @@ endif # Board non-retention config if BOARD_TLSR9118BDK40D || BOARD_TLSR9118BDK40D_V1 || \ - BOARD_TLSR9528A || BOARD_TLSR9518ADK80D || BOARD_TL3218X || BOARD_TL7218X + BOARD_TLSR9528A || BOARD_TLSR9518ADK80D || BOARD_TL3218X || \ + BOARD_TL3238X || BOARD_TL5218X || BOARD_TL7218X config PWM default y endif @@ -283,7 +301,8 @@ config NVS_LOOKUP_CACHE default y config NVS_LOOKUP_CACHE_SIZE - default 400 if SOC_RISCV_TELINK_TL321X + default 400 if SOC_RISCV_TELINK_TL321X + default 400 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 2048 if !PM || SOC_RISCV_TELINK_W91 # Set multiplicator of Name Value Storage (NVS) as 1 to reach NVS sector size 4KB @@ -333,8 +352,17 @@ config OPENTHREAD_CSMABACKOFF_OPTIMIZATION help Skip the first CSMA backoff period when sending data requests over IEEE 802.15.4. +config OPENTHREAD_SED_RAM_CODE + bool "Place OpenThread SED standby code in RAM" + depends on OPENTHREAD_MTD + default y if PM && SOC_RISCV_TELINK_TL721X + default n + help + Move SED standby critical path code to Retention RAM to reduce wakeup latency and power. + config IEEE802154_TLX_OPTIMIZATION bool "Optimize 802.15.4 RF performance for TLX SoCs" + default y if PM && (SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X) default n help Improve RF performance in IEEE 802.15.4 communication on TLX SoCs. @@ -345,9 +373,12 @@ config IEEE802154_TLX_ACTIVE_STAGE_OPTIMIZATION config OPENTHREAD_THREAD_STACK_SIZE default 2400 if PM || SOC_RISCV_TELINK_TL321X + default 4096 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X config OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE default 496 if PM && ZEPHYR_VERSION_3_3 + default 2048 if PM && (SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X) + default 608 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 640 config OPENTHREAD_SLAAC @@ -356,23 +387,35 @@ config OPENTHREAD_SLAAC config OPENTHREAD_MANUAL_START default y +# 6 is the max rf level by Vant config OPENTHREAD_DEFAULT_TX_POWER - default 3 if PM + default 6 if PM && (SOC_RISCV_TELINK_TL321X) + default 3 if PM && (SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X) + default 11 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X || SOC_RISCV_TELINK_TL521X default 9 config OPENTHREAD_IP6_MAX_EXT_MCAST_ADDRS + default 40 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X default 2 if PM default 8 +# Dcrease OT message buffer size to save RAM for tl321x +config OPENTHREAD_MESSAGE_BUFFER_SIZE + default 80 if SOC_RISCV_TELINK_TL321X + endif # NET_L2_OPENTHREAD config NET_TX_STACK_SIZE default 1200 if SOC_RISCV_TELINK_W91 default 600 if PM || SOC_RISCV_TELINK_TL321X + default 600 if SOC_RISCV_TELINK_TL323X + default 600 if SOC_RISCV_TELINK_TL521X + default 600 if SOC_RISCV_TELINK_TL721X config NET_RX_STACK_SIZE default 2048 if SOC_RISCV_TELINK_W91 default 664 if PM || SOC_RISCV_TELINK_TL321X + default 2048 if SOC_RISCV_TELINK_TL323X || SOC_RISCV_TELINK_TL721X # Disable certain parts of Zephyr IPv6 stack config NET_IPV6_NBR_CACHE @@ -499,6 +542,14 @@ config MBEDTLS_PSA_CRYPTO_C bool "MBEDTLS_PSA_CRYPTO_C" default n +config TELINK_B9X_MBEDTLS_HW_ACCELERATION + bool "Use Telink B9x platform mbedtls HW acceleration" + default y if SOC_RISCV_TELINK_B9X + +config TELINK_TLX_MBEDTLS_HW_ACCELERATION + bool "Use Telink TLx platform mbedtls HW acceleration" + default y if SOC_FAMILY_TELINK_TLX + endif # !ZEPHYR_VERSION_3_3 config GETOPT_LONG diff --git a/config/zephyr/ota-image.cmake b/config/zephyr/ota-image.cmake index 0d0108aa7579..bfb1f9dfc0f8 100644 --- a/config/zephyr/ota-image.cmake +++ b/config/zephyr/ota-image.cmake @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2021-2026 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. @@ -59,7 +59,7 @@ function(chip_ota_image TARGET_NAME) ) endif() - separate_arguments(OTA_EXTRA_ARGS NATIVE_COMMAND "${CHIP_OTA_IMAGE_EXTRA_ARGS}") + separate_arguments(OTA_EXTRA_ARGS NATIVE_COMMAND "${CONFIG_CHIP_OTA_IMAGE_EXTRA_ARGS}") list(APPEND OTA_ARGS ${OTA_EXTRA_ARGS}) list(APPEND OTA_ARGS ${ARG_INPUT_FILES}) diff --git a/config/zephyr/ota-image_sysbuild.cmake b/config/zephyr/ota-image_sysbuild.cmake index 88968ba15ecb..6a3703107e3d 100644 --- a/config/zephyr/ota-image_sysbuild.cmake +++ b/config/zephyr/ota-image_sysbuild.cmake @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2021-2026 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. @@ -82,7 +82,7 @@ function(chip_ota_image TARGET_NAME) ) endif() - separate_arguments(OTA_EXTRA_ARGS NATIVE_COMMAND "${CHIP_OTA_IMAGE_EXTRA_ARGS}") + separate_arguments(OTA_EXTRA_ARGS NATIVE_COMMAND "${CONFIG_CHIP_OTA_IMAGE_EXTRA_ARGS}") list(APPEND OTA_ARGS ${OTA_EXTRA_ARGS}) list(APPEND OTA_ARGS ${ARG_INPUT_FILES}) diff --git a/docs/platforms/index.md b/docs/platforms/index.md index bc345d2ff8d5..f98107797434 100644 --- a/docs/platforms/index.md +++ b/docs/platforms/index.md @@ -16,6 +16,7 @@ nxp/index openthread/index silabs/index stm32/index +telink/index ti/index ``` @@ -30,4 +31,5 @@ ti/index - [OpenThread](./openthread/) - [Silabs](./silabs/) - [STM32](./stm32/) +- [Telink](./telink/) - [TI](./ti/) diff --git a/docs/platforms/telink/index.md b/docs/platforms/telink/index.md new file mode 100644 index 000000000000..0fe9f84099d1 --- /dev/null +++ b/docs/platforms/telink/index.md @@ -0,0 +1,12 @@ +# Telink + +```{toctree} +:maxdepth: 1 +:hidden: + +telink_getting_started +releases/telink_release_notes +``` + +[Telink - Getting Started](./telink_getting_started.md) +[Telink - Release Notes](./releases/telink_release_notes.md) diff --git a/docs/platforms/telink/releases/README_BUILD_SCRIPT.md b/docs/platforms/telink/releases/README_BUILD_SCRIPT.md new file mode 100644 index 000000000000..cfeff8c8f3e6 --- /dev/null +++ b/docs/platforms/telink/releases/README_BUILD_SCRIPT.md @@ -0,0 +1,184 @@ +# Telink Matter Build and Release Notes Update Script + +## Overview + +The script `docs/platforms/telink/releases/generate_and_update_matter_notes.py` +can: + +1. Build all Telink board Matter sample applications (using `build_examples.py`) +2. Extract memory usage information (RAM/ROM) from build logs +3. Update the release note file + `docs/platforms/telink/releases/telink_release_notes.md` (the Resource Usage + section uses a table format) +4. Collect all sample firmware files for every board and create a separate zip + archive per board +5. Organize all output under the `build_for_release/` directory + +## Files + +- `docs/platforms/telink/releases/generate_and_update_matter_notes.py` - main + build and update script (alongside the release note working copy) +- `docs/platforms/telink/releases/telink_release_notes.md` - release note + working copy (in the same directory as the script; the script reads and + updates it in-place, only replacing the Resource Usage section while + preserving the remaining static content). At release time, + `scripts/tools/telink/package_telink_firmware.sh` snapshots it into a + versioned `telink_release_notes_.md`. +- `README.md` - Telink Matter SDK documentation +- `build_for_release/` - root directory for all output + - `build_logs/` - directory containing all build logs + - `firmware/` - directory containing all board firmware files and zip + archives + +## Usage + +### 0. Prerequisites + +Before running the script, set up the Telink Zephyr SDK path and activate the +build environment: + +```bash +cd /home/ubuntu/zephyrproject/connectedhomeip + +# Set the Telink Zephyr SDK path +export TELINK_ZEPHYR_BASE=/home/ubuntu/zephyrproject/zephyr + +# Activate the Matter build environment +source ./scripts/activate.sh -p all,telink +``` + +### 1. Full run (build + update + firmware packaging) + +```bash +cd /home/ubuntu/zephyrproject/connectedhomeip +python3 docs/platforms/telink/releases/generate_and_update_matter_notes.py +``` + +This will: + +- Build all Telink board Matter samples using `build_examples.py` +- Save logs to the `build_for_release/build_logs/` directory +- Extract memory usage information from the logs +- Update the `docs/platforms/telink/releases/telink_release_notes.md` file + (only the Resource Usage section is replaced; the remaining static content + is preserved) +- Collect all firmware files into the `build_for_release/firmware/` directory +- Create a separate firmware zip archive per board + +### 2. Update the release notes only (skip building) + +```bash +python3 docs/platforms/telink/releases/build_and_update_matter_notes.py --skip-build +``` + +Use this command when build logs already exist and you only need to update the +release notes and collect firmware. + +### 3. Skip firmware collection and packaging + +```bash +python3 docs/platforms/telink/releases/build_and_update_matter_notes.py --skip-firmware +``` + +Use this option when firmware collection and packaging are not needed. + +## Firmware zip archive contents + +Each board's zip archive contains: + +- `board_name/sample_name/zephyr.bin` - binary firmware file +- `board_name/sample_name/zephyr.elf` - ELF firmware file +- `board_name/sample_name/zephyr.hex` - Intel HEX firmware file (if present) +- `board_name/sample_name/zephyr.dts` - devicetree file +- `board_name/sample_name/.config` - configuration file +- `board_name/sample_name/zephyr.signed.bin` - signed OTA firmware (if OTA is + enabled) +- `board_name/sample_name/mcuboot.bin` - MCUboot firmware (if present) + +## Supported boards + +1. tl3238x (TL323X) +2. tl5218x (TL521X) +3. tl7218x (TL721X) + +## Supported sample applications + +| Application | Description | +| ---------------- | ------------------------------------------------------------------------- | +| lighting-app | Lighting application (supports OTA, Factory Data, LZMA, Shell, Dual-Mode) | +| light-switch-app | Light switch application (supports OTA, LZMA, Factory Data, Retention) | +| bridge-app | Bridge application | +| window-app | Window covering application | + +## Script features + +- Structured class design, easy to maintain and extend +- Built on top of `build_examples.py`, consistent with Matter CI +- Updates the release note file in-place, keeping all static content + consistent +- Resource Usage section uses a table format, clearly showing memory usage of + each sample on each board +- Only the Resource Usage section is updated; other sections are left + unchanged +- Supports adding new boards and sample applications +- Detailed log output +- Build step can be skipped to update directly from existing logs +- Automatically collects firmware files and creates a separate zip archive per + board +- Option to skip firmware collection and packaging + +## Adding a new board or sample + +In the `TelinkMatterBuildManager` class: + +1. Add a new build configuration (board, app_name, target_suffix) in the + `_get_build_targets()` method +2. Add the new board family mapping in the `board_family` dictionary +3. Add the new board display order in the `board_order` list + +For example, to add a new lighting-app build: + +```python +targets.append(("tl3238x", "lighting-app", "tl3238x-light-ota-factory-data")) +``` + +## Updating the release note file + +If you need to update the static content of the release note file (such as +Introduction, Version Information, Additional Notes, etc.), simply edit the +`docs/platforms/telink/releases/telink_release_notes.md` working copy directly. +The script only replaces the Resource Usage section; the remaining static +sections are preserved. At release time, `package_telink_firmware.sh` snapshots +it into a versioned archive file based on the git tag. + +## Build target format + +The build target format is `telink--[-]`, for example: + +- `telink-tl3238x-light-ota-factory-data-4mb` - TL3238X lighting application + with OTA, Factory Data, 4MB Flash +- `telink-tl3238x-light-ota-compress-lzma-factory-data-dual-mode` - TL3238X + lighting application with OTA, LZMA, Factory Data, BLE + Thread concurrent + mode +- `telink-tl7218x_retention-light-switch-ota-compress-lzma-factory-data` - + TL7218X Retention light switch application +- `telink-tl7218x-light-ota-compress-lzma-factory-data-dual-mode` - TL7218X + lighting application with OTA, LZMA, Factory Data, BLE + Thread concurrent + mode +- `telink-tl5218x-light-ota-factory-data-4mb` - TL521X lighting application + with OTA, Factory Data, 4MB Flash +- `telink-tl5218x-light-ota-factory-data-4mb` - TL521X lighting application + with OTA, Factory Data, 4MB Flash, Dual-Mode + +Available options: + +- `ota` - enable OTA support +- `factory-data` - enable Factory Data support +- `compress-lzma` - enable LZMA compression +- `shell` - enable Shell +- `rpc` - enable Pigweed RPC +- `dfu-smp` - enable DFU over SMP +- `4mb` - 4MB Flash +- `log-progress` - reduce log output (progress and errors only) +- `nfc-payload` - NFC Payload support +- `dual-mode` - enable BLE + Thread concurrent mode (TL323X, TL721X) diff --git a/docs/platforms/telink/releases/generate_and_update_matter_notes.py b/docs/platforms/telink/releases/generate_and_update_matter_notes.py new file mode 100755 index 000000000000..7b67f41f1a02 --- /dev/null +++ b/docs/platforms/telink/releases/generate_and_update_matter_notes.py @@ -0,0 +1,607 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2026 Telink Semiconductor Co., Ltd. +# +# 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. +# + +""" +Telink Matter SDK - Generate and Release Notes Update Script + +This script: + 1. Builds all Telink Matter examples for supported boards using build_examples.py + 2. Captures build logs and extracts memory usage information (RAM/ROM) + 3. Updates the Release Note working copy + (docs/platforms/telink/releases/telink_release_notes.md) in-place, + using table format for the Resource Usage section + 4. Collects firmware files (zephyr.bin/.elf/.hex, .config, zephyr.dts) and + creates per-board zip archives + +Usage (run from the connectedhomeip repo root): + python3 docs/platforms/telink/releases/generate_and_update_matter_notes.py # full run + python3 docs/platforms/telink/releases/generate_and_update_matter_notes.py --skip-build # skip building + python3 docs/platforms/telink/releases/generate_and_update_matter_notes.py --skip-firmware # skip firmware packaging +""" + +import re +import shutil +import subprocess +from pathlib import Path +from typing import Dict, List, Optional, Tuple + + +class TelinkMatterBuildManager: + """Manages building Telink Matter examples and generating release notes.""" + + def __init__(self, repo_root: Optional[Path] = None): + # This script lives in docs/platforms/telink/releases/. Detect the repo + # root by walking up from the script's location looking for the `.git` + # marker, so the script works regardless of where it is invoked from. + if repo_root is not None: + self.repo_root = repo_root + else: + candidate = Path(__file__).resolve().parent + while candidate != candidate.parent: + if (candidate / ".git").exists(): + break + candidate = candidate.parent + self.repo_root = candidate + + # Output directories + self.release_dir = self.repo_root / "build_for_release" + self.release_dir.mkdir(exist_ok=True) + + self.build_logs_dir = self.release_dir / "build_logs" + self.build_logs_dir.mkdir(exist_ok=True) + + self.firmware_output_dir = self.release_dir / "firmware" + self.firmware_output_dir.mkdir(exist_ok=True) + + # Release Note working copy (read and write in-place; only the + # Resource Usage section is regenerated, the rest is hand-maintained). + # The working copy lives next to this script in + # docs/platforms/telink/releases/. A versioned snapshot + # (telink_release_notes_.md) is produced by + # scripts/tools/telink/package_telink_firmware.sh at release time. + self.output_path = Path(__file__).resolve().parent / "telink_release_notes.md" + + # Board family mapping (board -> chip family) + self.board_family = { + "tlsr9518adk80d": "TLSR951X", + "tlsr9528a": "TLSR952X", + "tlsr9528a_retention": "TLSR952X", + "tlsr9118bdk40d": "TLSR911X", + "tl3218x": "TL321X", + "tl3218x_ml3m": "TL321X", + "tl3218x_retention": "TL321X", + "tl3238x": "TL323X", + "tl3238x_retention": "TL323X", + "tl7218x": "TL721X", + "tl7218x_retention": "TL721X", + } + + # Display order for boards in the release note + self.board_order = [ + ("tlsr9518adk80d", "TLSR951X/B91"), + ("tlsr9528a", "TLSR952X/B92"), + ("tl3218x", "TL321X"), + ("tl3238x", "TL323X"), + ("tl7218x", "TL721X"), + ("tlsr9118bdk40d", "TLSR911X/W91"), + ] + + # Define all build targets (board, app, target_string) + # target_string is the full build_examples.py target (without the 'telink-' prefix) + self.build_targets = self._get_build_targets() + + def _get_build_targets(self) -> List[Tuple[str, str, str]]: + """Define all Matter build targets for Telink platforms. + + Returns a list of (board, app_name, target_suffix) tuples where: + - board: the board identifier (without 'telink-' prefix) + - app_name: human-readable app name for display + - target_suffix: the full target string passed to build_examples.py + (e.g. 'tl3238x-light-ota-factory-data-4mb') + """ + targets = [] + + # -------------------------- TL323X -------------------------- + targets.extend([ + ("tl3238x", "lighting-app", "tl3238x-light-ota-factory-data-4mb"), + ("tl3238x_retention", "light-switch-app", "tl3238x_retention-light-switch-ota-compress-lzma-factory-data"), + ]) + + # -------------------------- TL721X -------------------------- + targets.extend([ + ("tl7218x", "lighting-app", "tl7218x-light-ota-compress-lzma-shell-factory-data"), + ("tl7218x", "bridge-app", "tl7218x-bridge"), + ("tl7218x", "window-app", "tl7218x-window-covering"), + ("tl7218x_retention", "light-switch-app", "tl7218x_retention-light-switch-ota-compress-lzma-factory-data"), + ]) + + # -------------------------- TLSR952X/B92 -------------------------- + targets.extend([ + ("tlsr9528a", "air-quality-sensor-app", "tlsr9528a_retention-air-quality-sensor"), + ("tlsr9528a", "all-clusters-minimal-app", "tlsr9528a-all-clusters-minimal-nfc-payload"), + ("tlsr9528a", "contact-sensor-app", "tlsr9528a_retention-contact-sensor"), + ("tlsr9528a", "light-switch-app", "tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data"), + ("tlsr9528a", "lock-app", "tlsr9528a-lock-dfu-smp"), + ("tlsr9528a", "smoke-co-alarm-app", "tlsr9528a_retention-smoke-co-alarm"), + ]) + + # -------------------------- TLSR911X/W91 -------------------------- + targets.extend([ + ("tlsr9118bdk40d", "lighting-app", "tlsr9118bdk40d-light-ota-factory-data-log-progress"), + ("tlsr9118bdk40d", "all-clusters-app", "tlsr9118bdk40d-all-clusters"), + ("tlsr9118bdk40d", "thermostat", "tlsr9118bdk40d-thermostat"), + ]) + + # -------------------------- TLSR951X/B91 -------------------------- + targets.extend([ + ("tlsr9518adk80d", "lighting-app", "tlsr9518adk80d-light-ota-rpc-factory-data-4mb"), + ("tlsr9518adk80d", "pump-controller-app", "tlsr9518adk80d-pump-controller"), + ("tlsr9518adk80d", "shell", "tlsr9518adk80d-shell"), + ]) + + # -------------------------- TL321X -------------------------- + targets.extend([ + ("tl3218x", "lighting-app", "tl3218x-light-ota-compress-lzma-shell-factory-data"), + ("tl3218x", "ota-requestor-app", "tl3218x-ota-requestor"), + ("tl3218x_retention", "light-switch-app", "tl3218x_retention-light-switch-ota-factory-data"), + ]) + + return targets + + def build_all(self): + """Build all Telink Matter examples using build_examples.py.""" + print("=" * 80) + print("Building all Telink Matter examples...") + print("=" * 80) + print() + + success_count = 0 + fail_count = 0 + + for board, app_name, target_suffix in self.build_targets: + full_target = f"telink-{target_suffix}" + # build_examples.py outputs to out/ + log_filename = f"build_{target_suffix}.log" + log_file = self.build_logs_dir / log_filename + + print(f" Building {full_target}...") + print(f" App: {app_name} Board: {board}") + + # The build is run via scripts/build/build_examples.py + cmd = [ + "./scripts/build/build_examples.py", + "--target", full_target, + "build", + ] + + print(f" Command: {' '.join(cmd)}") + + # Run inside the build environment wrapper if available + run_in_build_env = self.repo_root / "scripts" / "run_in_build_env.sh" + if run_in_build_env.exists(): + cmd = [str(run_in_build_env), " ".join(cmd)] + + result = subprocess.run( + cmd, + capture_output=True, + text=True, + cwd=str(self.repo_root), + check=False, + ) + + # Write log file + with open(log_file, "w", encoding="utf-8") as f: + f.write(f"Target: {full_target}\n") + f.write(f"Board: {board}\n") + f.write(f"App: {app_name}\n\n") + f.write(f"Command: {' '.join(cmd)}\n\n") + f.write(f"STDOUT:\n{result.stdout}\n\n") + f.write(f"STDERR:\n{result.stderr}\n\n") + f.write(f"Return code: {result.returncode}\n") + + if result.returncode == 0: + print(f" Success! Log written to {log_file}") + success_count += 1 + else: + print(f" Failed! Log written to {log_file}") + fail_count += 1 + + print() + + print("=" * 80) + print(f"Build complete! {success_count} succeeded, {fail_count} failed.") + print("=" * 80) + + def extract_memory_info(self) -> Dict[str, Dict[str, List[Dict]]]: + """Extract memory usage information from build logs. + + Returns a nested dict: {family: {board: [{name, memory: [{name,used,size,percent}]}}]} + """ + data: Dict[str, Dict[str, List[Dict]]] = {} + + print() + print("=" * 80) + print("Extracting memory usage information from logs...") + print("=" * 80) + print() + + for log_file in self.build_logs_dir.glob("build_*.log"): + filename = log_file.name + # filename: build_.log + target_suffix = filename[len("build_"):-len(".log")] + + # Identify the board from the target suffix + board = None + app_name = None + for b in sorted(self.board_family.keys(), key=lambda x: -len(x)): + if target_suffix.startswith(b): + board = b + rest = target_suffix[len(b):] + if rest.startswith("-"): + rest = rest[1:] + # The app name is the segment up to the next '-