diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 249636e9b5f3c2..a11e2786477b52 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -24,31 +24,8 @@ concurrency: jobs: - validate_zzz: - name: Chef - Validate cached ZAP output - runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' - container: - image: connectedhomeip/chip-build:0.5.79 - options: --user root - steps: - - uses: Wandalen/wretry.action@v1.0.15 - name: Checkout - with: - action: actions/checkout@v3 - with: | - token: ${{ github.token }} - attempt_limit: 3 - attempt_delay: 2000 - - name: Chef validate zzz - shell: bash - run: | - cd examples/chef - python3 chef.py --validate_zzz - chef_linux: name: Chef - Linux CI Examples - needs: validate_zzz runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' @@ -72,7 +49,6 @@ jobs: chef_esp32: name: Chef - ESP32 CI Examples - needs: validate_zzz runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' @@ -96,7 +72,6 @@ jobs: chef_nrfconnect: name: Chef - NRFConnect CI Examples - needs: validate_zzz runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 914b5d6a8a34be..cc8f6528d6520c 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -75,7 +75,7 @@ jobs: ${{ runner.os }}-cirque- - name: Bootstrap - timeout-minutes: 10 + timeout-minutes: 15 run: | integrations/docker/images/chip-build-cirque/run.sh \ --env GITHUB_ACTION_RUN=1 \ diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 0f0f57b57104a5..46485fd0ea51cf 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -29,7 +29,7 @@ concurrency: jobs: test_suites_chip_tool_darwin: name: Test Suites - Darwin - timeout-minutes: 135 + timeout-minutes: 150 strategy: matrix: @@ -82,7 +82,7 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Build Apps - timeout-minutes: 45 + timeout-minutes: 60 run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 8c2da30d946b36..13c8ba38c9bc81 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -15,102 +15,121 @@ name: Build example - EFR32 on: - push: - pull_request: + push: + pull_request: concurrency: - group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} - cancel-in-progress: true + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + cancel-in-progress: true jobs: - efr32: - name: EFR32 - timeout-minutes: 60 + efr32: + name: EFR32 + timeout-minutes: 60 - env: - EFR32_BOARD: BRD4161A - BUILD_TYPE: gn_efr32 + env: + EFR32_BOARD: BRD4161A + BUILD_TYPE: gn_efr32 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-efr32:0.5.79 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform efr32 - runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' + - name: Install git-lfs # Temporary measure untill docker container is updated + run: + "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash; \ + apt-get install git-lfs; \ + git lfs install;" - container: - image: connectedhomeip/chip-build-efr32:0.5.79 - volumes: - - "/tmp/bloat_reports:/tmp/bloat_reports" - steps: - - uses: Wandalen/wretry.action@v1.0.15 - name: Checkout - with: - action: actions/checkout@v3 - with: | - token: ${{ github.token }} - attempt_limit: 3 - attempt_delay: 2000 - - name: Checkout submodules - run: scripts/checkout_submodules.py --shallow --platform efr32 + - name: Create LFS file hash list + run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id - - name: Set up environment for size reports - if: ${{ !env.ACT }} - env: - GH_CONTEXT: ${{ toJson(github) }} - run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + - name: Restore gecko_sdk LFS cache + uses: actions/cache@v2 + id: lfs-cache + with: + path: .git/modules/third_party/silabs/gecko_sdk/lfs + key: lfs-${{ hashFiles('.lfs-assets-id') }} + + - name: Git LFS Pull + run: git -C third_party/silabs/gecko_sdk lfs pull + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap - timeout-minutes: 25 - run: scripts/build/gn_bootstrap.sh - - name: Uploading bootstrap logs - uses: actions/upload-artifact@v2 - if: ${{ always() }} && ${{ !env.ACT }} - with: - name: bootstrap-logs - path: | - .environment/gn_out/.ninja_log - .environment/pigweed-venv/*.log + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log - - name: Build some BRD4161A variants - timeout-minutes: 50 - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py \ - --enable-flashbundle \ - --target-glob '*-brd4161a-{lock,light,switch,window-covering,unit-test}' \ - build \ - --copy-artifacts-to out/artifacts \ - " - - name: Prepare some bloat report from the previous builds - run: | - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - efr32 BRD4161A lighting-app \ - out/efr32-brd4161a-light/chip-efr32-lighting-example.out \ - /tmp/bloat_reports/ - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - efr32 BRD4161A window-app \ - out/efr32-brd4161a-window-covering/chip-efr32-window-example.out \ - /tmp/bloat_reports/ - - name: Build example EFR32 Lighting App for BRD4161A with RPCs - timeout-minutes: 10 - run: | - scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_debug_rpc BRD4161A \ - 'import("//with_pw_rpc.gni")' - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rpc lighting-app \ - out/lighting_app_debug_rpc/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/ - - name: Build example EFR32+WF200 WiFi Lock app for BRD4161A - timeout-minutes: 10 - run: | - scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ out/lock_app_wifi_wf200 BRD4161A is_debug=false --wifi wf200 - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+wf200 lock-app \ - out/lock_app_wifi_wf200/BRD4161A/chip-efr32-lock-example.out /tmp/bloat_reports/ - - name: Build example EFR32+RS911x WiFi Lighting app for BRD4161A - timeout-minutes: 10 - run: | - scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_wifi_rs911x BRD4161A --wifi rs911x - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rs911x lighting-app \ - out/lighting_app_wifi_rs911x/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/ - - name: Uploading Size Reports - uses: actions/upload-artifact@v2 - if: ${{ !env.ACT }} - with: - name: Size,EFR32-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} - path: | - /tmp/bloat_reports/ + - name: Build some BRD4161A variants + timeout-minutes: 50 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --enable-flashbundle \ + --target-glob '*-brd4161a-{lock,light,switch,window-covering,unit-test}' \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Prepare some bloat report from the previous builds + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + efr32 BRD4161A lighting-app \ + out/efr32-brd4161a-light/chip-efr32-lighting-example.out \ + /tmp/bloat_reports/ + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + efr32 BRD4161A window-app \ + out/efr32-brd4161a-window-covering/chip-efr32-window-example.out \ + /tmp/bloat_reports/ + - name: Build example EFR32 Lighting App for BRD4161A with RPCs + timeout-minutes: 10 + run: | + scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_debug_rpc BRD4161A \ + 'import("//with_pw_rpc.gni")' + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rpc lighting-app \ + out/lighting_app_debug_rpc/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/ + - name: Build example EFR32+WF200 WiFi Lock app for BRD4161A + timeout-minutes: 10 + run: | + scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ out/lock_app_wifi_wf200 BRD4161A is_debug=false --wifi wf200 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+wf200 lock-app \ + out/lock_app_wifi_wf200/BRD4161A/chip-efr32-lock-example.out /tmp/bloat_reports/ + - name: Build example EFR32+RS911x WiFi Lighting app for BRD4161A + timeout-minutes: 10 + run: | + scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_wifi_rs911x BRD4161A --wifi rs911x + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rs911x lighting-app \ + out/lighting_app_wifi_rs911x/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,EFR32-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/rebase.yaml b/.github/workflows/rebase.yaml deleted file mode 100644 index 6e4e361310ba5b..00000000000000 --- a/.github/workflows/rebase.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Automatic Rebase -on: - issue_comment: - types: [created] -jobs: - rebase: - name: Rebase - if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') - runs-on: ubuntu-latest - steps: - - uses: Wandalen/wretry.action@v1.0.15 - name: Checkout - with: - action: actions/checkout@v3 - with: | - fetch-depth: 0 - token: ${{ secrets.APPLE_PERSONAL_ACCESS_TOKEN }} - attempt_limit: 3 - attempt_delay: 2000 - - name: Automatic Rebase - uses: cirrus-actions/rebase@1.4 - env: - GITHUB_TOKEN: ${{ secrets.APPLE_PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d6d60602a93142..48f556115ce318 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -33,7 +33,7 @@ jobs: strategy: matrix: build_variant: [no-ble-tsan-clang] - chip_tool: ["", -same-event-loop] + chip_tool: [""] env: BUILD_VARIANT: ${{matrix.build_variant}} CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} @@ -126,7 +126,7 @@ jobs: strategy: matrix: build_variant: [no-ble-tsan-clang, no-ble-asan-clang] - chip_tool: ["", -same-event-loop] + chip_tool: [""] env: BUILD_VARIANT: ${{matrix.build_variant}} CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} diff --git a/.gitmodules b/.gitmodules index 0682becb54cfce..51153d1ee5cd62 100644 --- a/.gitmodules +++ b/.gitmodules @@ -63,11 +63,6 @@ url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git branch = V10.3.1-kernel-only platforms = ameba,cc13x2_26x2,bl602,efr32,esp32,k32w0,p6,qpg -[submodule "efr32_sdk"] - path = third_party/efr32_sdk/repo - url = https://github.com/SiliconLabs/sdk_support.git - branch = master - platforms = efr32 [submodule "simw-top-mini"] path = third_party/simw-top-mini/repo url = https://github.com/NXP/plug-and-trust.git @@ -237,10 +232,6 @@ url = https://github.com/TexasInstruments/cc13xx_cc26xx_sdk.git branch = main platforms = cc13x2_26x2 -[submodule "third_party/efr32_sdk/wiseconnect-wifi-bt-sdk"] - path = third_party/efr32_sdk/wiseconnect-wifi-bt-sdk - url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk - platforms = efr32 [submodule "third_party/bouffalolab/bl602"] path = third_party/bouffalolab/bl602_sdk/repo url = https://github.com/bouffalolab/bl_iot_sdk_matter.git @@ -251,3 +242,18 @@ url = https://github.com/NXPmicro/mbedtls.git branch = tinycrypt-mbedtls-2.28 platforms = k32w0 +[submodule "third_party/silabs/matter_support"] + path = third_party/silabs/matter_support + url = https://github.com/SiliconLabs/sdk_support.git + branch = main + platforms = efr32 +[submodule "third_party/silabs/gecko_sdk"] + path = third_party/silabs/gecko_sdk + url = https://github.com/SiliconLabs/gecko_sdk.git + branch = gsdk_4.1 + platforms = efr32 +[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"] + path = third_party/silabs/wiseconnect-wifi-bt-sdk + url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git + branch = master + platforms = efr32 diff --git a/build_overrides/efr32_sdk.gni b/build_overrides/efr32_sdk.gni index dda4d4d2735d4b..4a7344b4c7ebed 100644 --- a/build_overrides/efr32_sdk.gni +++ b/build_overrides/efr32_sdk.gni @@ -14,5 +14,5 @@ declare_args() { # Root directory for efr32 SDK build files. - efr32_sdk_build_root = "//third_party/efr32_sdk" + efr32_sdk_build_root = "//third_party/silabs" } diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index d15dc800ae26ff..d32dbbe32ed30c 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -51,6 +51,17 @@ pw_proto_library(button_service pw_protobuf.common_proto ) +pw_proto_library(descriptor_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/descriptor_service.proto + PREFIX + descriptor_service + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + pw_proto_library(device_service SOURCES ${chip_dir}/examples/common/pigweed/protos/device_service.proto @@ -202,6 +213,7 @@ if (matter_enable_rpc) target_link_libraries(${chip_main} PUBLIC attributes_service.nanopb_rpc button_service.nanopb_rpc + descriptor_service.nanopb_rpc device_service.nanopb_rpc lighting_service.nanopb_rpc locking_service.nanopb_rpc @@ -240,6 +252,7 @@ list( -DPW_RPC_ATTRIBUTE_SERVICE=1 -DPW_RPC_BUTTON_SERVICE=1 + -DPW_RPC_DESCRIPTOR_SERVICE=1 -DPW_RPC_DEVICE_SERVICE=1 -DPW_RPC_LIGHTING_SERVICE=1 -DPW_RPC_LOCKING_SERVICE=1 diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index f10ca233683ec5..a70f92af2440c7 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -55,6 +55,7 @@ target_include_directories(app PRIVATE target_sources(app PRIVATE main/AppTask.cpp main/main.cpp + main/ZclDoorLockCallbacks.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-modes-manager.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp diff --git a/examples/all-clusters-app/nrfconnect/main/ZclDoorLockCallbacks.cpp b/examples/all-clusters-app/nrfconnect/main/ZclDoorLockCallbacks.cpp new file mode 100644 index 00000000000000..edaa86e44d5125 --- /dev/null +++ b/examples/all-clusters-app/nrfconnect/main/ZclDoorLockCallbacks.cpp @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::app::Clusters; +using namespace ::chip::app::Clusters::DoorLock; + +LOG_MODULE_DECLARE(app, CONFIG_MATTER_LOG_LEVEL); + +// Provided some empty callbacks and replaced feature map +// to simulate DoorLock endpoint for All-Clusters-App example +// without using kUsersManagement|kAccessSchedules|kRFIDCredentials|kPINCredentials + +bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional & pinCode, DlOperationError & err) +{ + return true; +} + +bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional & pinCode, + DlOperationError & err) +{ + return true; +} + +void emberAfDoorLockClusterInitCallback(EndpointId endpoint) +{ + DoorLockServer::Instance().InitServer(endpoint); + + // Set FeatureMap to 0, default is: + // (kUsersManagement|kAccessSchedules|kRFIDCredentials|kPINCredentials) 0x113 + EmberAfStatus status = DoorLock::Attributes::FeatureMap::Set(endpoint, 0); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + LOG_ERR("Updating feature map %x", status); + } +} diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index dbf2653109dcb8..c6937be2352ac3 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -1130,6 +1130,8 @@ server cluster EthernetNetworkDiagnostics = 55 { readonly attribute int64u timeSinceReset = 8; readonly attribute bitmap32 featureMap = 65532; readonly attribute int16u clusterRevision = 65533; + + command ResetCounts(): DefaultSuccess = 0; } server cluster Switch = 59 { diff --git a/examples/bridge-app/bridge-common/bridge-app.zap b/examples/bridge-app/bridge-common/bridge-app.zap index 1d50e048036115..5adbb5a860d1d0 100644 --- a/examples/bridge-app/bridge-common/bridge-app.zap +++ b/examples/bridge-app/bridge-common/bridge-app.zap @@ -3833,7 +3833,7 @@ "code": 0, "mfgCode": null, "source": "client", - "incoming": 0, + "incoming": 1, "outgoing": 1 } ], @@ -7379,4 +7379,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/examples/build_overrides/efr32_sdk.gni b/examples/build_overrides/efr32_sdk.gni index bd96dcbd8855b4..d5a35449d9ffd0 100644 --- a/examples/build_overrides/efr32_sdk.gni +++ b/examples/build_overrides/efr32_sdk.gni @@ -14,5 +14,5 @@ declare_args() { # Root directory for erf32 SDK. - efr32_sdk_build_root = "//third_party/connectedhomeip/third_party/efr32_sdk" + efr32_sdk_build_root = "//third_party/connectedhomeip/third_party/silabs" } diff --git a/examples/chef/README.md b/examples/chef/README.md index 91da0db5201682..cacd895b2c0342 100644 --- a/examples/chef/README.md +++ b/examples/chef/README.md @@ -61,61 +61,11 @@ Run `chef.py -h` to see the available commands ## CI -### zzz_generated - -To eliminate a dependency on ZAP in CI jobs, all chef examples found in -`examples/chef/devices` must have their output from the ZAP tool cached in -`examples/chef/zzz_generated`. - -To generate the cache, one may execute chef with the option `--generate_zzz`. -This will run ZAP for all devices in `examples/chef/devices` and place the -output into the appropriate directory structure. - -Other than the output from the ZAP tool, the cache directory contains two -additional files for each device: - -- `INPUTMD5.txt` contains the md5 hex digest of the ZAP file used to generate - the directory. -- `ZAPSHA.txt` contains the commit of ZAP in the user's tree when the - directory was generated. - -``` -zzz_generated/ -└── lighting-app - ├── INPUTMD5.txt - ├── zap-generated - │   ├── access.h - │   ├── af-gen-event.h - │   └── ... - └── ZAPSHA.txt -``` - -These additional files will be used by the CI jobs to validate whether the cache -must be regenerated i.e. regeneration is needed when ZAP or the input ZAP files -change. - -### Workflow - All CI jobs for chef can be found in `.github/workflows/chef.yaml`. -#### Validate - -The workflow begins by calling chef with `--validate_zzz`. - -`--validate_zzz` will recalculate the current ZAP commit and the md5 of all -example ZAP files and compare with what is committed to `zzz_generated`. - -If the validation job fails, it will provide instructions to repair -`zzz_generated` and no builds will run. - -#### Build - -Once the validation job is complete, there is a separate job for each platform, -which run in parallel. - These jobs use a platform-specific image with base `chip-build`. -The build jobs call chef with the options `--ci -t `. The `--ci` -option will execute builds for all devices specified in `_CI_ALLOW_LIST` defined -in `chef.py` (so long as these devices are also in `/devices`) on the specified -platform. +CI jobs call chef with the options `--ci -t `. The `--ci` option will +execute builds for all devices specified in `cicd_config["ci_allow_list"]` +defined in `chef.py` (so long as these devices are also in `/devices`) on the +specified platform. diff --git a/examples/chef/chef.py b/examples/chef/chef.py index fafad0178952b7..3f6b093a9a66bb 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -25,9 +25,11 @@ from typing import Any, Dict, Sequence import yaml +import re import constants import stateful_shell +from sample_app_util import zap_file_parser TermColors = constants.TermColors @@ -37,11 +39,8 @@ _REPO_BASE_PATH = os.path.join(_CHEF_SCRIPT_PATH, "../../") _DEVICE_FOLDER = os.path.join(_CHEF_SCRIPT_PATH, "devices") _DEVICE_LIST = [file[:-4] for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] -_CHEF_ZZZ_ROOT = os.path.join(_CHEF_SCRIPT_PATH, "zzz_generated") -_CI_DEVICE_MANIFEST_NAME = "INPUTMD5.txt" -_CI_ZAP_MANIFEST_NAME = "ZAPSHA.txt" -_CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_meta.json") -_CI_ALLOW_LIST = ["rootnode_dimmablelight_gY80DaqEUL"] +_CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_config.json") +_CD_STAGING_DIR = os.path.join(_CHEF_SCRIPT_PATH, "staging") gen_dir = "" # Filled in after sample app type is read from args. @@ -97,64 +96,9 @@ def check_python_version() -> None: exit(1) -def check_zap() -> str: - """Produces SHA of ZAP submodule for current HEAD. - - Returns: - SHA of zap submodule. - """ - shell.run_cmd(f"cd {_REPO_BASE_PATH}") - branch = shell.run_cmd("git rev-parse --abbrev-ref HEAD", - return_cmd_output=True) - branch = branch.replace("\n", "") - command = f"git ls-tree {branch} third_party/zap/repo" - zap_commit = shell.run_cmd(command, return_cmd_output=True) - zap_commit = zap_commit.split(" ")[2] - zap_commit = zap_commit[:zap_commit.index("\t")] - flush_print(f"Found zap commit: {zap_commit}") - return zap_commit - - -def generate_device_manifest( - write_manifest_file: bool = False) -> Dict[str, Any]: - """Produces dictionary containing md5 of device dir zap files. - - Args: - write_manifest_file: Serialize manifest in tree. - Returns: - Dict containing MD5 of device dir zap files. - """ - ci_manifest = {"devices": {}} - devices_manifest = ci_manifest["devices"] - zap_sha = check_zap() - ci_manifest["zap_commit"] = zap_sha - for device_name in _DEVICE_LIST: - device_file_path = os.path.join(_DEVICE_FOLDER, device_name + ".zap") - with open(device_file_path, "rb") as device_file: - device_file_data = device_file.read() - device_file_md5 = hashlib.md5(device_file_data).hexdigest() - devices_manifest[device_name] = device_file_md5 - flush_print(f"Current digest for {device_name} : {device_file_md5}") - if write_manifest_file: - device_zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device_name) - device_zzz_md5_file = os.path.join(device_zzz_dir, _CI_DEVICE_MANIFEST_NAME) - with open(device_zzz_md5_file, "w+") as md5_file: - md5_file.write(device_file_md5) - device_zzz_zap_sha_file = os.path.join(device_zzz_dir, _CI_ZAP_MANIFEST_NAME) - with open(device_zzz_zap_sha_file, "w+") as zap_sha_file: - zap_sha_file.write(zap_sha) - return ci_manifest - - def load_cicd_config() -> Dict[str, Any]: with open(_CICD_CONFIG_FILE_NAME) as config_file: config = json.loads(config_file.read()) - for platform_name, platform_config in config.items(): - has_build_dir = "build_dir" in platform_config - has_plat_label = "platform_label" in platform_config - if not has_build_dir or not has_plat_label: - flush_print(f"{platform_name} CICD config missing build_dir or platform_label") - exit(1) return config @@ -168,11 +112,134 @@ def flush_print( with_border: Add boarder above and below to_print. """ if with_border: - border = ('-' * 64) + '\n' + border = ('-' * len(to_print)) + '\n' to_print = f"{border}{to_print}\n{border}" print(to_print, flush=True) +def unwrap_cmd(cmd: str) -> str: + """Dedent and replace new line with space.""" + return textwrap.dedent(cmd).replace("\n", " ") + + +def bundle(platform: str, device_name: str) -> None: + """Filters files from the build output folder for CD. + Clears _CD_STAGING_DIR. + Calls bundle_{platform}(device_name). + exit(1) for missing bundle_{platform}. + Adds .matter files into _CD_STAGING_DIR. + Generates metadata for device in _CD_STAGING_DIR. + + Args: + platform: The platform to bundle. + device_name: The example to bundle. + """ + matter_file = f"{device_name}.matter" + zap_file = os.path.join(_DEVICE_FOLDER, f"{device_name}.zap") + flush_print(f"Bundling {platform}", with_border=True) + flush_print(f"Cleaning {_CD_STAGING_DIR}") + shutil.rmtree(_CD_STAGING_DIR, ignore_errors=True) + os.mkdir(_CD_STAGING_DIR) + if platform == "linux": + bundle_linux(device_name) + elif platform == "nrfconnect": + bundle_nrfconnect(device_name) + elif platform == "esp32": + bundle_esp32(device_name) + else: + flush_print(f"No bundle function for {platform}!") + exit(1) + flush_print(f"Copying {matter_file}") + src_item = os.path.join(_REPO_BASE_PATH, + "zzz_generated", + "chef-"+device_name, + "zap-generated", + matter_file) + dest_item = os.path.join(_CD_STAGING_DIR, matter_file) + shutil.copy(src_item, dest_item) + flush_print(f"Generating metadata for {device_name}") + metadata_file = zap_file_parser.generate_hash_metadata_file(zap_file) + metadata_dest = os.path.join(_CD_STAGING_DIR, + os.path.basename(metadata_file)) + shutil.copy(metadata_file, metadata_dest) + + +# +# Per-platform bundle functions +# + + +def bundle_linux(device_name: str) -> None: + linux_root = os.path.join(_CHEF_SCRIPT_PATH, + "linux", + "out") + map_file_name = f"{device_name}.map" + src_item = os.path.join(linux_root, device_name) + dest_item = os.path.join(_CD_STAGING_DIR, device_name) + shutil.copy(src_item, dest_item) + src_item = os.path.join(linux_root, map_file_name) + dest_item = os.path.join(_CD_STAGING_DIR, map_file_name) + shutil.copy(src_item, dest_item) + + +def bundle_nrfconnect(device_name: str) -> None: + zephyr_exts = ["elf", "map", "hex"] + script_files = ["firmware_utils.py", + "nrfconnect_firmware_utils.py"] + nrf_root = os.path.join(_CHEF_SCRIPT_PATH, + "nrfconnect", + "build", + "zephyr") + scripts_root = os.path.join(_REPO_BASE_PATH, + "scripts", + "flashing") + gen_script_path = os.path.join(scripts_root, + "gen_flashing_script.py") + sub_dir = os.path.join(_CD_STAGING_DIR, device_name) + os.mkdir(sub_dir) + for zephyr_ext in zephyr_exts: + input_base = f"zephyr.{zephyr_ext}" + output_base = f"{device_name}.{zephyr_ext}" + src_item = os.path.join(nrf_root, input_base) + if zephyr_ext == "hex": + dest_item = os.path.join(sub_dir, output_base) + else: + dest_item = os.path.join(_CD_STAGING_DIR, output_base) + shutil.copy(src_item, dest_item) + for script_file in script_files: + src_item = os.path.join(scripts_root, script_file) + dest_item = os.path.join(sub_dir, script_file) + shutil.copy(src_item, dest_item) + shell.run_cmd(f"cd {sub_dir}") + command = f"""\ + python3 {gen_script_path} nrfconnect + --output {device_name}.flash.py + --application {device_name}.hex""" + shell.run_cmd(unwrap_cmd(command)) + + +def bundle_esp32(device_name: str) -> None: + """Reference example for bundle_{platform} + functions, which should copy/move files from a build + output dir into _CD_STAGING_DIR to be archived. + + Args: + device_name: The device to bundle. + """ + esp_root = os.path.join(_CHEF_SCRIPT_PATH, + "esp32", + "build") + manifest_file = os.path.join(esp_root, + "chip-shell.flashbundle.txt") + with open(manifest_file) as manifest: + for item in manifest: + item = item.strip() + src_item = os.path.join(esp_root, item) + dest_item = os.path.join(_CD_STAGING_DIR, item) + os.makedirs(os.path.dirname(dest_item), exist_ok=True) + shutil.copy(src_item, dest_item) + + def main(argv: Sequence[str]) -> None: check_python_version() config = load_config() @@ -241,6 +308,8 @@ def main(argv: Sequence[str]) -> None: metavar="TARGET", default="esp32") parser.add_option("-r", "--rpc", help="enables Pigweed RPC interface. Enabling RPC disables the shell interface. Your sdkconfig configurations will be reverted to default. Default is PW RPC off. When enabling or disabling this flag, on the first build force a clean build with -c", action="store_true", dest="do_rpc") + parser.add_option("-a", "--automated_test_stamp", help="provide the additional stamp \"branch:commit_id\" as the software version string for automated tests.", + action="store_true", dest="do_automated_test_stamp") parser.add_option("-v", "--vid", dest="vid", type=int, help="specifies the Vendor ID. Default is 0xFFF1", metavar="VID", default=0xFFF1) parser.add_option("-p", "--pid", dest="pid", type=int, @@ -249,67 +318,17 @@ def main(argv: Sequence[str]) -> None: action="store_true", dest="do_rpc_console") parser.add_option("-y", "--tty", help="Enumerated USB tty/serial interface enumerated for your physical device. E.g.: /dev/ACM0", dest="tty", metavar="TTY", default=None) - parser.add_option("", "--generate_zzz", help="Populates zzz_generated/chef//zap-generated with output of ZAP tool for every device in examples/chef/devices. If this flag is set, all other arguments are ignored except for --bootstrap_zap and --validate_zzz.", - dest="generate_zzz", action="store_true") - parser.add_option("", "--validate_zzz", help="Checks if cached ZAP output needs to be regenrated, for use in CI. If this flag is set, all other arguments are ignored.", - dest="validate_zzz", action="store_true") parser.add_option("", "--use_zzz", help="Use pre generated output from the ZAP tool found in the zzz_generated folder. Used to decrease execution time of CI/CD jobs", dest="use_zzz", action="store_true") parser.add_option("", "--build_all", help="For use in CD only. Builds and bundles all chef examples for the specified platform. Uses --use_zzz. Chef exits after completion.", dest="build_all", action="store_true") parser.add_option( - "", "--ci", help="Builds Chef examples defined in _CI_ALLOW_LIST. Uses --use_zzz. Uses specified target from -t. Chef exits after completion.", dest="ci", action="store_true") + "", "--ci", help="Builds Chef examples defined in cicd_config. Uses --use_zzz. Uses specified target from -t. Chef exits after completion.", dest="ci", action="store_true") options, _ = parser.parse_args(argv) splash() - # - # Validate zzz_generated - # - - if options.validate_zzz: - flush_print(f"Validating\n{_CHEF_ZZZ_ROOT}\n", - with_border=True) - fix_instructions = textwrap.dedent("""\ - Cached files out of date! - Please: - ./scripts/bootstrap.sh - source ./scripts/activate.sh - cd ./third_party/zap/repo - npm install - cd ../../.. - ./examples/chef/chef.py --generate_zzz - git add examples/chef/zzz_generated - Ensure you are running with the latest version of ZAP from master!""") - ci_manifest = generate_device_manifest() - current_zap = ci_manifest["zap_commit"] - for device, device_md5 in ci_manifest["devices"].items(): - zzz_dir = os.path.join(_CHEF_ZZZ_ROOT, device) - device_zap_sha_file = os.path.join(zzz_dir, _CI_ZAP_MANIFEST_NAME) - device_md5_file = os.path.join(zzz_dir, _CI_DEVICE_MANIFEST_NAME) - help_msg = f"{device}: {fix_instructions}" - if not os.path.exists(device_zap_sha_file): - flush_print(f"ZAP VERSION MISSING {help_msg}") - exit(1) - else: - with open(device_zap_sha_file) as zap_file: - output_cached_zap_sha = zap_file.read() - if output_cached_zap_sha != current_zap: - flush_print(f"ZAP VERSION MISMATCH {help_msg}") - exit(1) - if not os.path.exists(device_md5_file): - flush_print(f"INPUT MD5 MISSING {help_msg}") - exit(1) - else: - with open(device_md5_file) as md5_file: - output_cached_md5 = md5_file.read() - if output_cached_md5 != device_md5: - flush_print(f"INPUT MD5 MISMATCH {help_msg}") - exit(1) - flush_print("Cached ZAP output is up to date!") - exit(0) - # # ZAP bootstrapping # @@ -317,12 +336,11 @@ def main(argv: Sequence[str]) -> None: if options.do_bootstrap_zap: if sys.platform == "linux" or sys.platform == "linux2": flush_print("Installing ZAP OS package dependencies") - install_deps_cmd = textwrap.dedent("""\ + install_deps_cmd = """\ sudo apt-get install node node-yargs npm libpixman-1-dev libcairo2-dev libpango1.0-dev node-pre-gyp - libjpeg9-dev libgif-dev node-typescript""") - install_deps_cmd = install_deps_cmd.replace("\n", " ") - shell.run_cmd(install_deps_cmd) + libjpeg9-dev libgif-dev node-typescript""" + shell.run_cmd(unwrap_cmd(install_deps_cmd)) if sys.platform == "darwin": flush_print("Installation of ZAP OS packages not supported on MacOS") if sys.platform == "win32": @@ -333,50 +351,23 @@ def main(argv: Sequence[str]) -> None: shell.run_cmd( f"cd {_REPO_BASE_PATH}/third_party/zap/repo/ && npm install") - # - # Populate zzz_generated - # - - if options.generate_zzz: - flush_print(f"Cleaning {_CHEF_ZZZ_ROOT}") - if not os.path.exists(_CHEF_ZZZ_ROOT): - flush_print(f"{_CHEF_ZZZ_ROOT} doesn't exist; creating") - os.mkdir(_CHEF_ZZZ_ROOT) - else: - flush_print(f"Deleting and recreating existing {_CHEF_ZZZ_ROOT}") - shutil.rmtree(_CHEF_ZZZ_ROOT) - os.mkdir(_CHEF_ZZZ_ROOT) - flush_print(f"Generating files in {_CHEF_ZZZ_ROOT} for all devices") - for device_name in _DEVICE_LIST: - flush_print(f"Generating files for {device_name}") - device_out_dir = os.path.join(_CHEF_ZZZ_ROOT, - device_name, - "zap-generated") - os.makedirs(device_out_dir) - shell.run_cmd(textwrap.dedent(f"""\ - {_REPO_BASE_PATH}/scripts/tools/zap/generate.py \ - {_CHEF_SCRIPT_PATH}/devices/{device_name}.zap -o {device_out_dir}""")) - shell.run_cmd(f"touch {device_out_dir}/af-gen-event.h") - generate_device_manifest(write_manifest_file=True) - exit(0) - # # CI # if options.ci: - for device_name in [d for d in _DEVICE_LIST if d in _CI_ALLOW_LIST]: + for device_name in [d for d in _DEVICE_LIST if d in cicd_config["ci_allow_list"]]: if options.build_target == "nrfconnect": shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"") shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") command = f"./chef.py -cbr --use_zzz -d {device_name} -t {options.build_target}" flush_print(f"Building {command}", with_border=True) shell.run_cmd(command) - # TODO call per-platform bundle function for extra validation + bundle(options.build_target, device_name) exit(0) # - # Build all + # CD # if options.build_all: @@ -384,22 +375,42 @@ def main(argv: Sequence[str]) -> None: archive_prefix = "/workspace/artifacts/" archive_suffix = ".tar.gz" os.makedirs(archive_prefix, exist_ok=True) + failed_builds = [] for device_name in _DEVICE_LIST: - for platform, platform_meta in cicd_config.items(): - directory = platform_meta['build_dir'] - label = platform_meta['platform_label'] - output_dir = os.path.join(_CHEF_SCRIPT_PATH, directory) + for platform, label in cicd_config["cd_platforms"].items(): command = f"./chef.py -cbr --use_zzz -d {device_name} -t {platform}" flush_print(f"Building {command}", with_border=True) shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}") shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"") - shell.run_cmd(command) - # TODO Needs to call per-platform bundle function + try: + shell.run_cmd(command) + except RuntimeError as build_fail_error: + failed_builds.append((device_name, platform, "build")) + flush_print(str(build_fail_error)) + break + try: + bundle(platform, device_name) + except FileNotFoundError as bundle_fail_error: + failed_builds.append((device_name, platform, "bundle")) + flush_print(str(bundle_fail_error)) + break archive_name = f"{label}-{device_name}" archive_full_name = archive_prefix + archive_name + archive_suffix flush_print(f"Adding build output to archive {archive_full_name}") + if os.path.exists(archive_full_name): + os.remove(archive_full_name) with tarfile.open(archive_full_name, "w:gz") as tar: - tar.add(output_dir, arcname=".") + tar.add(_CD_STAGING_DIR, arcname=".") + if len(failed_builds) == 0: + flush_print("No build failures", with_border=True) + else: + flush_print("Logging build failures", with_border=True) + for failed_build in failed_builds: + fail_log = f"""\ + Device: {failed_build[0]}, + Platform: {failed_build[1]}, + Phase: {failed_build[2]}""" + flush_print(unwrap_cmd(fail_log)) exit(0) # @@ -490,21 +501,33 @@ def main(argv: Sequence[str]) -> None: # if options.do_build: + if options.do_automated_test_stamp: + branch = "" + for branch_text in shell.run_cmd("git branch", return_cmd_output=True).split("\n"): + match_texts = re.findall("\* (.*)", branch_text) + if match_texts: + branch = match_texts[0] + break + commit_id = shell.run_cmd("git rev-parse HEAD", return_cmd_output=True).replace("\n", "") + sw_ver_string = f"""{branch}:{commit_id}""" + # 64 bytes space could only contain 63 bytes string + 1 byte EOS. + if len(sw_ver_string) >= 64: + truncated_sw_ver_string = f"""{branch[:22]}:{commit_id}""" + flush_print( + f"""Truncate the software version string from \"{sw_ver_string}\" to \"{truncated_sw_ver_string}\" due to 64 bytes limitation""") + sw_ver_string = truncated_sw_ver_string + if options.use_zzz: flush_print("Using pre-generated ZAP output") - zzz_dir = os.path.join(_CHEF_SCRIPT_PATH, + zzz_dir = os.path.join(_REPO_BASE_PATH, "zzz_generated", - options.sample_device_type_name, + "chef-"+options.sample_device_type_name, "zap-generated") if not os.path.exists(zzz_dir): flush_print(textwrap.dedent(f"""\ You have specified --use_zzz for device {options.sample_device_type_name} which does not exist in the cached ZAP output. - To cache ZAP output for this device: - ensure {options.sample_device_type_name}.zap - is placed in {_DEVICE_FOLDER} - run chef with the option --generate_zzz """)) exit(1) shutil.rmtree(gen_dir, ignore_errors=True) @@ -569,6 +592,7 @@ def main(argv: Sequence[str]) -> None: elif options.build_target == "linux": shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/linux") with open(f"{_CHEF_SCRIPT_PATH}/linux/args.gni", "w") as f: + sw_ver_string_config_text = f"chip_device_config_device_software_version_string = \"{sw_ver_string}\"" if options.do_automated_test_stamp else "" f.write(textwrap.dedent(f"""\ import("//build_overrides/chip.gni") import("${{chip_root}}/config/standalone/args.gni") @@ -576,6 +600,7 @@ def main(argv: Sequence[str]) -> None: chip_build_libshell = true chip_config_network_layer_ble = false target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={'1' if options.do_rpc else '0'}"] + {sw_ver_string_config_text} """)) with open(f"{_CHEF_SCRIPT_PATH}/linux/sample.gni", "w") as f: f.write(textwrap.dedent(f"""\ diff --git a/examples/chef/cicd_config.json b/examples/chef/cicd_config.json new file mode 100644 index 00000000000000..a8b7ca99bad84f --- /dev/null +++ b/examples/chef/cicd_config.json @@ -0,0 +1,8 @@ +{ + "ci_allow_list": ["rootnode_dimmablelight_gY80DaqEUL"], + "cd_platforms": { + "linux": "linux_x86", + "esp32": "m5stack", + "nrfconnect": "nrf52840dk" + } +} diff --git a/examples/chef/cicd_meta.json b/examples/chef/cicd_meta.json deleted file mode 100644 index 34cabcb530a302..00000000000000 --- a/examples/chef/cicd_meta.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "linux": { - "build_dir": "linux/out", - "platform_label": "linux_x86" - }, - "esp32": { - "build_dir": "esp32/build", - "platform_label": "esp32-m5stack" - }, - "nrfconnect": { - "build_dir": "nrfconnect/build", - "platform_label": "nrf-nrf52840dk" - } -} diff --git a/examples/chef/zzz_generated/rootnode_contactsensor_DreXRHtsq9/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_contactsensor_DreXRHtsq9/INPUTMD5.txt deleted file mode 100644 index df26011d3f1567..00000000000000 --- a/examples/chef/zzz_generated/rootnode_contactsensor_DreXRHtsq9/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -de97c937bf519ecc46bf43912799a7c7 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_contactsensor_DreXRHtsq9/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_contactsensor_DreXRHtsq9/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_contactsensor_DreXRHtsq9/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_dimmablelight_gY80DaqEUL/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_dimmablelight_gY80DaqEUL/INPUTMD5.txt deleted file mode 100644 index a97fd894b1ee58..00000000000000 --- a/examples/chef/zzz_generated/rootnode_dimmablelight_gY80DaqEUL/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -065e9334527a21bab8cb3a3dd24ff135 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_dimmablelight_gY80DaqEUL/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_dimmablelight_gY80DaqEUL/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_dimmablelight_gY80DaqEUL/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_flowsensor_nRfPWc0i3j/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_flowsensor_nRfPWc0i3j/INPUTMD5.txt deleted file mode 100644 index c2a2b6fe0db123..00000000000000 --- a/examples/chef/zzz_generated/rootnode_flowsensor_nRfPWc0i3j/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -ea021cad6e2ccc4f67e4dbeeb4ca9288 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_flowsensor_nRfPWc0i3j/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_flowsensor_nRfPWc0i3j/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_flowsensor_nRfPWc0i3j/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_heatingcoolingunit_Yt3sl2ssuP/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_heatingcoolingunit_Yt3sl2ssuP/INPUTMD5.txt deleted file mode 100644 index 59ce2038be669a..00000000000000 --- a/examples/chef/zzz_generated/rootnode_heatingcoolingunit_Yt3sl2ssuP/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -c31f5d478acdf1cffe218788559cf2af \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_heatingcoolingunit_Yt3sl2ssuP/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_heatingcoolingunit_Yt3sl2ssuP/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_heatingcoolingunit_Yt3sl2ssuP/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_humiditysensor_bCXcaZPQ1O/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_humiditysensor_bCXcaZPQ1O/INPUTMD5.txt deleted file mode 100644 index 4161e3f6bb76f3..00000000000000 --- a/examples/chef/zzz_generated/rootnode_humiditysensor_bCXcaZPQ1O/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -8f86b354d5a8eee7ea019e65a64eb8cb \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_humiditysensor_bCXcaZPQ1O/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_humiditysensor_bCXcaZPQ1O/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_humiditysensor_bCXcaZPQ1O/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_occupancysensor_52g0FarxiO/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_occupancysensor_52g0FarxiO/INPUTMD5.txt deleted file mode 100644 index d7c549c3cf4f28..00000000000000 --- a/examples/chef/zzz_generated/rootnode_occupancysensor_52g0FarxiO/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -278e7ee5dd14e648844e75934e4d4302 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_occupancysensor_52g0FarxiO/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_occupancysensor_52g0FarxiO/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_occupancysensor_52g0FarxiO/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_onofflightswitch_zbddTYGOPV/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_onofflightswitch_zbddTYGOPV/INPUTMD5.txt deleted file mode 100644 index 78b2ae53a63f8e..00000000000000 --- a/examples/chef/zzz_generated/rootnode_onofflightswitch_zbddTYGOPV/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -d7e83aa5dfc0d2939fd1d4c6fa869b3f \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_onofflightswitch_zbddTYGOPV/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_onofflightswitch_zbddTYGOPV/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_onofflightswitch_zbddTYGOPV/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_onoffpluginunit_Jgnh29qK1p/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_onoffpluginunit_Jgnh29qK1p/INPUTMD5.txt deleted file mode 100644 index 1044618a0c23da..00000000000000 --- a/examples/chef/zzz_generated/rootnode_onoffpluginunit_Jgnh29qK1p/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -7d462526927251ecf6841784ca3dca9a \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_onoffpluginunit_Jgnh29qK1p/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_onoffpluginunit_Jgnh29qK1p/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_onoffpluginunit_Jgnh29qK1p/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_pressuresensor_fBO7Lvhj9j/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_pressuresensor_fBO7Lvhj9j/INPUTMD5.txt deleted file mode 100644 index 58fc5d49e7db6d..00000000000000 --- a/examples/chef/zzz_generated/rootnode_pressuresensor_fBO7Lvhj9j/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -61a2657bb47c1a836b5d657f5bb452f8 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_pressuresensor_fBO7Lvhj9j/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_pressuresensor_fBO7Lvhj9j/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_pressuresensor_fBO7Lvhj9j/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_speaker_TlTVZFjAlM/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_speaker_TlTVZFjAlM/INPUTMD5.txt deleted file mode 100644 index 4e54d2ed874141..00000000000000 --- a/examples/chef/zzz_generated/rootnode_speaker_TlTVZFjAlM/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -fa2b7db458e1330b1d2a079965c26d93 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_speaker_TlTVZFjAlM/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_speaker_TlTVZFjAlM/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_speaker_TlTVZFjAlM/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_temperaturesensor_19A4msmCzW/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_temperaturesensor_19A4msmCzW/INPUTMD5.txt deleted file mode 100644 index fb87cd34ace89f..00000000000000 --- a/examples/chef/zzz_generated/rootnode_temperaturesensor_19A4msmCzW/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -8b338275f9ff4e14f99896b083b0debc \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_temperaturesensor_19A4msmCzW/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_temperaturesensor_19A4msmCzW/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_temperaturesensor_19A4msmCzW/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_thermostat_dtbxxgX9aj/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_thermostat_dtbxxgX9aj/INPUTMD5.txt deleted file mode 100644 index b3a83af6563ab6..00000000000000 --- a/examples/chef/zzz_generated/rootnode_thermostat_dtbxxgX9aj/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -d538157c8174fec70905dc9580dd0b58 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_thermostat_dtbxxgX9aj/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_thermostat_dtbxxgX9aj/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_thermostat_dtbxxgX9aj/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_windowcovering_hv8WSnPgSV/INPUTMD5.txt b/examples/chef/zzz_generated/rootnode_windowcovering_hv8WSnPgSV/INPUTMD5.txt deleted file mode 100644 index 935d9013f264db..00000000000000 --- a/examples/chef/zzz_generated/rootnode_windowcovering_hv8WSnPgSV/INPUTMD5.txt +++ /dev/null @@ -1 +0,0 @@ -1ca223c176344ab1387c70db782a7210 \ No newline at end of file diff --git a/examples/chef/zzz_generated/rootnode_windowcovering_hv8WSnPgSV/ZAPSHA.txt b/examples/chef/zzz_generated/rootnode_windowcovering_hv8WSnPgSV/ZAPSHA.txt deleted file mode 100644 index 16cb68bb9c22eb..00000000000000 --- a/examples/chef/zzz_generated/rootnode_windowcovering_hv8WSnPgSV/ZAPSHA.txt +++ /dev/null @@ -1 +0,0 @@ -9a4e455c3a4956842d11971148b2d5ee0ccead53 \ No newline at end of file diff --git a/examples/darwin-framework-tool/templates/tests/tests.js b/examples/darwin-framework-tool/templates/tests/tests.js index 0a557afa9535cf..7469964c5e96df 100644 --- a/examples/darwin-framework-tool/templates/tests/tests.js +++ b/examples/darwin-framework-tool/templates/tests/tests.js @@ -66,6 +66,15 @@ function getTests() { // TODO: Test_TC_CC_9_3 does not work on Darwin for now. tests.disable('Test_TC_CC_9_3'); + // TODO: Test_TC_MC_3_7 does not work on Darwin for now. + tests.disable('Test_TC_MC_3_7'); + + // TODO: Test_TC_MC_3_8 does not work on Darwin for now. + tests.disable('Test_TC_MC_3_8'); + + // TODO: Test_TC_MC_3_9 does not work on Darwin for now. + tests.disable('Test_TC_MC_3_9'); + return tests; } diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 402faaeca9a70c..7d870ecd737eb0 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -89,7 +89,7 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { # WiFi settings if (chip_enable_wifi) { - wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" + wifi_sdk_dir = "${chip_root}/third_party/silabs/matter_support/matter/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", @@ -102,7 +102,7 @@ if (chip_enable_wifi) { if (use_rs911x) { wiseconnect_sdk_root = - "${chip_root}/third_party/efr32_sdk/wiseconnect-wifi-bt-sdk" + "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" import("${wifi_sdk_dir}/rs911x/rs911x.gni") } else { import("${wifi_sdk_dir}/wf200/wf200.gni") diff --git a/examples/lighting-app/ameba/chip_main.cmake b/examples/lighting-app/ameba/chip_main.cmake index ecdc70c49c25d2..0895eb194dc6eb 100755 --- a/examples/lighting-app/ameba/chip_main.cmake +++ b/examples/lighting-app/ameba/chip_main.cmake @@ -8,8 +8,123 @@ set(dir "${sdk_root}/component/common/api") set(chip_main chip_main) set(list_chip_main_sources chip_main_sources) +if (matter_enable_rpc) +set(pigweed_dir "${chip_dir}/third_party/pigweed/repo") + +include(${pigweed_dir}/pw_build/pigweed.cmake) +include(${pigweed_dir}/pw_protobuf_compiler/proto.cmake) + +set(dir_pw_third_party_nanopb "${chip_dir}/third_party/nanopb/repo" CACHE STRING "" FORCE) + +pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config) +pw_set_backend(pw_log pw_log_basic) +pw_set_backend(pw_assert.check pw_assert_log.check_backend) +pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend) +pw_set_backend(pw_sys_io pw_sys_io.ameba) +pw_set_backend(pw_trace pw_trace_tokenized) + +add_subdirectory(${chip_dir}/third_party/pigweed/repo ${chip_dir}/examples/lighting-app/ameba/out/pigweed) +add_subdirectory(${chip_dir}/third_party/nanopb/repo ${chip_dir}/examples/lighting-app/ameba/out/nanopb) +add_subdirectory(${chip_dir}/examples/platform/ameba/pw_sys_io ${chip_dir}/examples/lighting-app/ameba/out/pw_sys_io) + +pw_proto_library(attributes_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/attributes_service.proto + INPUTS + ${chip_dir}/examples/common/pigweed/protos/attributes_service.options + PREFIX + attributes_service + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(button_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/button_service.proto + PREFIX + button_service + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(descriptor_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/descriptor_service.proto + PREFIX + descriptor_service + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(device_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/device_service.proto + INPUTS + ${chip_dir}/examples/common/pigweed/protos/device_service.options + PREFIX + device_service + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(lighting_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/lighting_service.proto + PREFIX + lighting_service + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(locking_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/locking_service.proto + PREFIX + locking_service + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(wifi_service + SOURCES + ${chip_dir}/examples/common/pigweed/protos/wifi_service.proto + INPUTS + ${chip_dir}/examples/common/pigweed/protos/wifi_service.options + PREFIX + wifi_service + DEPS + pw_protobuf.common_proto + STRIP_PREFIX + ${chip_dir}/examples/common/pigweed/protos +) + +endif(matter_enable_rpc) + include(${prj_root}/GCC-RELEASE/project_hp/asdk/includepath.cmake) +if (matter_enable_rpc) +list( + APPEND ${list_chip_main_sources} + #rpc + ${chip_dir}/examples/platform/ameba/PigweedLogger.cpp + ${chip_dir}/examples/platform/ameba/Rpc.cpp + ${chip_dir}/examples/common/pigweed/RpcService.cpp + ${chip_dir}/examples/common/pigweed/ameba/PigweedLoggerMutex.cpp +) +endif (matter_enable_rpc) + if (matter_enable_ota_requestor) list( APPEND ${list_chip_main_sources} @@ -52,6 +167,22 @@ chip_configure_data_model(chip_main ZAP_FILE ${matter_example_path}/../lighting-common/lighting-app.zap ) +if (matter_enable_rpc) +target_include_directories( + ${chip_main} + PUBLIC + #rpc + ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/pw_sys_io/public + ${chip_dir}/examples/common + ${chip_dir}/examples/common/pigweed + ${chip_dir}/examples/common/pigweed/ameba + ${chip_dir}/src + ${chip_dir}/src/lib/support + ${pigweed_dir}/pw_rpc/nanopb/public +) +endif (matter_enable_rpc) + target_include_directories( ${chip_main} PUBLIC @@ -77,6 +208,31 @@ target_include_directories( ${chip_dir}/third_party/nlunit-test/repo/src ) +if (matter_enable_rpc) +target_link_libraries(${chip_main} PUBLIC + attributes_service.nanopb_rpc + button_service.nanopb_rpc + descriptor_service.nanopb_rpc + device_service.nanopb_rpc + lighting_service.nanopb_rpc + locking_service.nanopb_rpc + wifi_service.nanopb_rpc + pw_checksum + pw_hdlc + pw_log + pw_rpc.server + pw_trace_tokenized + pw_trace_tokenized.trace_buffer + pw_trace_tokenized.rpc_service + pw_trace_tokenized.protos.nanopb_rpc + PwRpc +) + +link_directories( + ${chip_dir_output}/lib +) +endif (matter_enable_rpc) + list( APPEND chip_main_flags @@ -89,6 +245,20 @@ list( -DMATTER_LIGHTING_APP=1 ) +if (matter_enable_rpc) +list( + APPEND chip_main_flags + + -DPW_RPC_ATTRIBUTE_SERVICE=1 + -DPW_RPC_BUTTON_SERVICE=1 + -DPW_RPC_DESCRIPTOR_SERVICE=1 + -DPW_RPC_DEVICE_SERVICE=1 + -DPW_RPC_LIGHTING_SERVICE=1 + -DPW_RPC_LOCKING_SERVICE=1 + -DCONFIG_ENABLE_PW_RPC=1 +) +endif (matter_enable_rpc) + list( APPEND chip_main_cpp_flags diff --git a/examples/lighting-app/ameba/main/chipinterface.cpp b/examples/lighting-app/ameba/main/chipinterface.cpp index 6ba9aa4a21686c..9520719ebdfd2e 100644 --- a/examples/lighting-app/ameba/main/chipinterface.cpp +++ b/examples/lighting-app/ameba/main/chipinterface.cpp @@ -43,6 +43,10 @@ #include +#if CONFIG_ENABLE_PW_RPC +#include "Rpc.h" +#endif + using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceManager; @@ -138,6 +142,10 @@ extern "C" void ChipTest(void) ChipLogProgress(DeviceLayer, "Lighting App Demo!"); CHIP_ERROR err = CHIP_NO_ERROR; +#if CONFIG_ENABLE_PW_RPC + chip::rpc::Init(); +#endif + initPref(); CHIPDeviceManager & deviceMgr = CHIPDeviceManager::GetInstance(); diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 341582d0287321..192833797494b2 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -89,7 +89,7 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { # WiFi settings if (chip_enable_wifi) { - wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" + wifi_sdk_dir = "${chip_root}/third_party/silabs/matter_support/matter/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", @@ -102,7 +102,7 @@ if (chip_enable_wifi) { if (use_rs911x) { wiseconnect_sdk_root = - "${chip_root}/third_party/efr32_sdk/wiseconnect-wifi-bt-sdk" + "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" import("${wifi_sdk_dir}/rs911x/rs911x.gni") } else { import("${wifi_sdk_dir}/wf200/wf200.gni") diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 50ebd01f436152..679ed1f46cda3d 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -89,7 +89,7 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { # WiFi settings if (chip_enable_wifi) { - wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" + wifi_sdk_dir = "${chip_root}/third_party/silabs/matter_support/matter/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", @@ -102,7 +102,7 @@ if (chip_enable_wifi) { if (use_rs911x) { wiseconnect_sdk_root = - "${chip_root}/third_party/efr32_sdk/wiseconnect-wifi-bt-sdk" + "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" import("${wifi_sdk_dir}/rs911x/rs911x.gni") } else { import("${wifi_sdk_dir}/wf200/wf200.gni") diff --git a/examples/placeholder/linux/apps/app1/tests.js b/examples/placeholder/linux/apps/app1/tests.js index 56cc1921bb748f..134085e4c85367 100644 --- a/examples/placeholder/linux/apps/app1/tests.js +++ b/examples/placeholder/linux/apps/app1/tests.js @@ -18,9 +18,7 @@ function getTests() { const tests = [ - "Test_TC_DM_1_3_Simulated", - "Test_TC_DM_3_3_Simulated", - "Test_TC_DM_2_3_Simulated", + "Test_TC_BINFO_2_3_Simulated", ]; return tests.join(', '); diff --git a/examples/platform/ameba/Rpc.cpp b/examples/platform/ameba/Rpc.cpp index c9caba3f504eb0..6abdfb5755152f 100644 --- a/examples/platform/ameba/Rpc.cpp +++ b/examples/platform/ameba/Rpc.cpp @@ -42,6 +42,10 @@ #include "pigweed/rpc_services/Button.h" #endif // defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +#if defined(PW_RPC_DESCRIPTOR_SERVICE) && PW_RPC_DESCRIPTOR_SERVICE +#include "pigweed/rpc_services/Descriptor.h" +#endif // defined(PW_RPC_DESCRIPTOR_SERVICE) && PW_RPC_DESCRIPTOR_SERVICE + #if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE #include "pigweed/rpc_services/Device.h" #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE @@ -104,6 +108,10 @@ Attributes attributes_service; AmebaButton button_service; #endif // defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +#if defined(PW_RPC_DESCRIPTOR_SERVICE) && PW_RPC_DESCRIPTOR_SERVICE +Descriptor descriptor_service; +#endif // defined(PW_RPC_DESCRIPTOR_SERVICE) && PW_RPC_DESCRIPTOR_SERVICE + #if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE AmebaDevice device_service; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE @@ -126,6 +134,10 @@ void RegisterServices(pw::rpc::Server & server) server.RegisterService(button_service); #endif // defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +#if defined(PW_RPC_DESCRIPTOR_SERVICE) && PW_RPC_DESCRIPTOR_SERVICE + server.RegisterService(descriptor_service); +#endif // defined(PW_RPC_DESCRIPTOR_SERVICE) && PW_RPC_DESCRIPTOR_SERVICE + #if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE server.RegisterService(device_service); #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE diff --git a/examples/platform/efr32/ldscripts/efr32mg12.ld b/examples/platform/efr32/ldscripts/efr32mg12.ld index 0851b5ffdf6a60..042f5f50a2a430 100644 --- a/examples/platform/efr32/ldscripts/efr32mg12.ld +++ b/examples/platform/efr32/ldscripts/efr32mg12.ld @@ -17,10 +17,9 @@ */ /***************************************************************************//** * Linker script for Silicon Labs EFR32MG12P devices - * @version 5.7.2 ******************************************************************************* * # License - * Copyright 2018 Silicon Laboratories Inc. www.silabs.com + * Copyright 2022 Silicon Laboratories Inc. www.silabs.com ******************************************************************************* * * SPDX-License-Identifier: Zlib @@ -45,6 +44,7 @@ * ******************************************************************************/ + MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576 @@ -81,8 +81,6 @@ MEMORY * __StackLimit * __StackTop * __stack - * __Vectors_End - * __Vectors_Size */ ENTRY(Reset_Handler) @@ -91,21 +89,12 @@ SECTIONS .text : { KEEP(*(.vectors)) - __Vectors_End = .; - __Vectors_Size = __Vectors_End - __Vectors; - __end__ = .; *(.text*) KEEP(*(.init)) KEEP(*(.fini)) - KEEP(*(.application_properties)) - KEEP(*(.gecko_configuration)) - KEEP(*(.xo_configuration)) - KEEP(*(.gatt_header)) - KEEP(*(.gatt_data)) - /* .ctors */ *crtbegin.o(.ctors) *crtbegin?.o(.ctors) @@ -122,11 +111,9 @@ SECTIONS *(.rodata*) - KEEP(*(.eh_frame*)) } > FLASH - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) @@ -139,44 +126,26 @@ SECTIONS } > FLASH __exidx_end = .; - - - /* To copy multiple ROM to RAM sections, - * uncomment .copy.table section and, - * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ - /* .copy.table : { . = ALIGN(4); __copy_table_start__ = .; + LONG (__etext) LONG (__data_start__) - LONG (__data_end__ - __data_start__) - LONG (__etext2) - LONG (__data2_start__) - LONG (__data2_end__ - __data2_start__) + LONG ((__data_end__ - __data_start__) / 4) + __copy_table_end__ = .; } > FLASH - */ - /* To clear multiple BSS sections, - * uncomment .zero.table section and, - * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ - /* .zero.table : { . = ALIGN(4); __zero_table_start__ = .; - LONG (__bss_start__) - LONG (__bss_end__ - __bss_start__) - LONG (__bss2_start__) - LONG (__bss2_end__ - __bss2_start__) __zero_table_end__ = .; } > FLASH - */ - - __etext = .; + __etext = ALIGN (4); .data : AT (__etext) { @@ -219,13 +188,14 @@ SECTIONS { . = ALIGN(4); __bss_start__ = .; - *(.bss*) + *(.bss) + *(.bss.*) *(COMMON) . = ALIGN(4); __bss_end__ = .; } > RAM - .heap (COPY): + .heap (COPY) : { __HeapBase = .; __end__ = .; @@ -240,7 +210,7 @@ SECTIONS /* .stack_dummy section doesn't contains any symbols. It is only * used for linker to calculate size of stack sections, and assign * values to stack symbols later */ - .stack_dummy (COPY): + .stack_dummy (COPY): { KEEP(*(.stack*)) } > RAM diff --git a/examples/platform/efr32/ldscripts/efr32mg24.ld b/examples/platform/efr32/ldscripts/efr32mg24.ld index 7b19dbea1bc03f..cac2b08a2b1371 100644 --- a/examples/platform/efr32/ldscripts/efr32mg24.ld +++ b/examples/platform/efr32/ldscripts/efr32mg24.ld @@ -16,11 +16,14 @@ * limitations under the License. */ /***************************************************************************//** - * @file + * @file gcc_EFR32MG24.ld + * @brief GNU Linker Script for Cortex-M based device + * @version V2.2.0 + * @date 16. December 2020 * Linker script for Silicon Labs EFR32MG24 devices ******************************************************************************* * # License - * Copyright 2021 Silicon Laboratories, Inc. www.silabs.com + * Copyright 2022 Silicon Laboratories, Inc. www.silabs.com ******************************************************************************* * * SPDX-License-Identifier: Zlib @@ -45,11 +48,11 @@ * ******************************************************************************/ - MEMORY - { - FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 0x178000 - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x40000 - } +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08006000, LENGTH = 0x178000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x40000 +} /* Linker script to place sections and symbol values. Should be used together * with other linker script that defines memory regions FLASH and RAM. @@ -76,14 +79,13 @@ * __bss_end__ * __end__ * end - * __HeapBase * __HeapLimit * __StackLimit * __StackTop * __stack - * __Vectors_End - * __Vectors_Size + * __StackSeal (only if ARMv8-M stack sealing is used) */ + ENTRY(Reset_Handler) SECTIONS @@ -91,21 +93,11 @@ SECTIONS .text : { KEEP(*(.vectors)) - __Vectors_End = .; - __Vectors_Size = __Vectors_End - __Vectors; - __end__ = .; - *(.text*) KEEP(*(.init)) KEEP(*(.fini)) - KEEP(*(.application_properties)) - KEEP(*(.gecko_configuration)) - KEEP(*(.xo_configuration)) - KEEP(*(.gatt_header)) - KEEP(*(.gatt_data)) - /* .ctors */ *crtbegin.o(.ctors) *crtbegin?.o(.ctors) @@ -122,11 +114,8 @@ SECTIONS *(.rodata*) - KEEP(*(.eh_frame*)) } > FLASH - - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) @@ -139,44 +128,25 @@ SECTIONS } > FLASH __exidx_end = .; - - - /* To copy multiple ROM to RAM sections, - * uncomment .copy.table section and, - * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ - /* .copy.table : { . = ALIGN(4); __copy_table_start__ = .; + LONG (__etext) LONG (__data_start__) - LONG (__data_end__ - __data_start__) - LONG (__etext2) - LONG (__data2_start__) - LONG (__data2_end__ - __data2_start__) + LONG ((__data_end__ - __data_start__) / 4) + __copy_table_end__ = .; } > FLASH - */ - /* To clear multiple BSS sections, - * uncomment .zero.table section and, - * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ - /* .zero.table : { . = ALIGN(4); __zero_table_start__ = .; - LONG (__bss_start__) - LONG (__bss_end__ - __bss_start__) - LONG (__bss2_start__) - LONG (__bss2_end__ - __bss2_start__) __zero_table_end__ = .; + __etext = ALIGN(4); } > FLASH - */ - - __etext = .; - .data : AT (__etext) { @@ -219,11 +189,12 @@ SECTIONS { . = ALIGN(4); __bss_start__ = .; - *(.bss*) + *(.bss) + *(.bss.*) *(COMMON) . = ALIGN(4); __bss_end__ = .; - } > RAM + } > RAM AT > RAM .heap (COPY): { @@ -243,6 +214,7 @@ SECTIONS .stack_dummy (COPY): { KEEP(*(.stack*)) + /* KEEP(*(.stackseal*))*/ } > RAM /* Set stack top to end of RAM, and stack limit move down by @@ -265,4 +237,6 @@ SECTIONS /*ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")*/ ASSERT( (linker_nvm_begin + SIZEOF(.nvm)) <= __main_flash_end__, "NVM3 is excessing the flash size !") + /* Check if FLASH usage exceeds FLASH size */ + ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !") } diff --git a/examples/platform/efr32/matter_config.cpp b/examples/platform/efr32/matter_config.cpp index 12bfbc5b8117d7..26c8541605dcfe 100644 --- a/examples/platform/efr32/matter_config.cpp +++ b/examples/platform/efr32/matter_config.cpp @@ -135,7 +135,7 @@ CHIP_ERROR EFR32MatterConfig::InitMatter(const char * appName) //============================================== EFR32_LOG("Init CHIP Stack"); // Init Chip memory management before the stack - chip::Platform::MemoryInit(); + ReturnErrorOnFailure(chip::Platform::MemoryInit()); ReturnErrorOnFailure(PlatformMgr().InitChipStack()); chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName(appName); diff --git a/examples/platform/efr32/uart.cpp b/examples/platform/efr32/uart.cpp index 91c8955525bff7..548416d177ce16 100644 --- a/examples/platform/efr32/uart.cpp +++ b/examples/platform/efr32/uart.cpp @@ -44,10 +44,20 @@ extern "C" { #define MIN(A, B) ((A) < (B) ? (A) : (B)) #endif +#ifdef EFR32MG24 +#define HELPER1(x) EUSART##x##_RX_IRQn +#else #define HELPER1(x) USART##x##_RX_IRQn +#endif + #define HELPER2(x) HELPER1(x) +#ifdef EFR32MG24 +#define HELPER3(x) EUSART##x##_RX_IRQHandler +#else #define HELPER3(x) USART##x##_RX_IRQHandler +#endif + #define HELPER4(x) HELPER3(x) // On MG24 boards VCOM runs on the EUSART device, MG12 uses the UART device @@ -55,7 +65,6 @@ extern "C" { #define USART_IRQ HELPER2(SL_UARTDRV_EUSART_VCOM_PERIPHERAL_NO) #define USART_IRQHandler HELPER4(SL_UARTDRV_EUSART_VCOM_PERIPHERAL_NO) #define vcom_handle sl_uartdrv_eusart_vcom_handle - #else #define USART_IRQ HELPER2(SL_UARTDRV_USART_VCOM_PERIPHERAL_NO) #define USART_IRQHandler HELPER4(SL_UARTDRV_USART_VCOM_PERIPHERAL_NO) @@ -208,12 +217,19 @@ void uartConsoleInit(void) UARTDRV_Receive(vcom_handle, sRxDmaBuffer, MAX_DMA_BUFFER_SIZE, UART_rx_callback); UARTDRV_Receive(vcom_handle, sRxDmaBuffer2, MAX_DMA_BUFFER_SIZE, UART_rx_callback); - // Enable USART0 interrupt to wake OT task when data arrives + // Enable USART0/EUSART0 interrupt to wake OT task when data arrives NVIC_ClearPendingIRQ(USART_IRQ); NVIC_EnableIRQ(USART_IRQ); #ifdef EFR32MG24 - EUSART_IntEnable(SL_UARTDRV_EUSART_VCOM_PERIPHERAL, USART_IF_RXDATAV); + // Clear previous RX interrupts + EUSART_IntClear(SL_UARTDRV_EUSART_VCOM_PERIPHERAL, EUSART_IF_RXFL); + + // Enable RX interrupts + EUSART_IntEnable(SL_UARTDRV_EUSART_VCOM_PERIPHERAL, EUSART_IF_RXFL); + + // Enable EUSART + EUSART_Enable(SL_UARTDRV_EUSART_VCOM_PERIPHERAL, eusartEnable); #else USART_IntEnable(SL_UARTDRV_USART_VCOM_PERIPHERAL, USART_IF_RXDATAV); #endif // EFR32MG24 @@ -229,6 +245,10 @@ void USART_IRQHandler(void) #elif !defined(PW_RPC_ENABLED) otSysEventSignalPending(); #endif + +#ifdef EFR32MG24 + EUSART_IntClear(SL_UARTDRV_EUSART_VCOM_PERIPHERAL, EUSART_IF_RXFL); +#endif } /* diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 33ea182d5316a7..d829fa9d15116b 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -82,7 +82,7 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { # WiFi settings if (chip_enable_wifi) { - wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" + wifi_sdk_dir = "${chip_root}/third_party/silabs/matter_support/matter/wifi" efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", @@ -95,7 +95,7 @@ if (chip_enable_wifi) { if (use_rs911x) { wiseconnect_sdk_root = - "${chip_root}/third_party/efr32_sdk/wiseconnect-wifi-bt-sdk" + "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" import("${wifi_sdk_dir}/rs911x/rs911x.gni") } else { import("${wifi_sdk_dir}/wf200/wf200.gni") diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index 4fee975ddb6dbc..27fa08e6289224 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -66,6 +66,13 @@ def generate(self): cmd = self.build_cmd() logging.info("Generating target: %s" % " ".join(cmd)) subprocess.check_call(cmd) + if "chef" in self.zap_config: + af_gen_event = os.path.join(self.output_dir, "af-gen-event.h") + with open(af_gen_event, "w+"): # Empty file needed for linux + pass + idl_path = self.zap_config.replace(".zap", ".matter") + target_path = os.path.join(self.output_dir, os.path.basename(idl_path)) + os.rename(idl_path, target_path) def checkPythonVersion(): @@ -116,7 +123,9 @@ def getGlobalTemplatesTargets(): continue if example_name == "chef": - continue + if os.path.join("chef", "devices") not in str(filepath): + continue + example_name = "chef-"+os.path.basename(filepath)[:-len(".zap")] logging.info("Found example %s (via %s)" % (example_name, str(filepath))) diff --git a/src/android/CHIPTool/app/src/main/AndroidManifest.xml b/src/android/CHIPTool/app/src/main/AndroidManifest.xml index 9e7ee8657d45e9..ede1f0980aee60 100644 --- a/src/android/CHIPTool/app/src/main/AndroidManifest.xml +++ b/src/android/CHIPTool/app/src/main/AndroidManifest.xml @@ -9,6 +9,8 @@ + + () + private val wifiApList = ArrayList() + private var wifiApSsid = String() private val scope = CoroutineScope(Dispatchers.Main + Job()) override fun onCreateView( @@ -69,6 +81,84 @@ class AddressCommissioningFragment : Fragment() { discoverBtn.isEnabled = true } } + + wifiConnectBtn.setOnClickListener { _ -> + wifiConnectBtn.isEnabled = false + val context = getActivity() + val wifiManager = context?.getSystemService(Context.WIFI_SERVICE) as WifiManager + + // TODO : filter SSID with Information Element, OPEN authentication + var config : WifiConfiguration = WifiConfiguration(); + config.SSID = "\"${wifiApSsid}\"" + config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE) + + Log.d(TAG, "Disconnect existing connection") + wifiManager.disconnect() + Log.d(TAG, "Add network ${config.SSID}") + var res = wifiManager.addNetwork(config) + if (res == -1) { + Log.d(TAG,"Add network failed") + } else { + var success = wifiManager.enableNetwork(res, true) + if (success) { + Log.d(TAG, "Enable network ${config.SSID} succeeded") + } else { + Log.d(TAG, "Enable network ${config.SSID} failed") + wifiConnectBtn.isEnabled = true + } + } + } + + wifiScanBtn.setOnClickListener { _ -> + wifiScanBtn.isEnabled = false + val context = getActivity() + val wifiManager = context?.getSystemService(Context.WIFI_SERVICE) as WifiManager + val wifiScanReceiver = object : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + Log.d(TAG, "Scan result event received") + val success = intent.getBooleanExtra(WifiManager.EXTRA_RESULTS_UPDATED, false) + if (success) { + Log.d(TAG, "Scan succeeded") + val results = wifiManager.scanResults + updateWifiScanListSpinner(results) + } else { + Log.d(TAG, "Scan failed") + } + wifiScanBtn.isEnabled = true + } + } + + val intentFilter = IntentFilter() + intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) + + context.registerReceiver(wifiScanReceiver, intentFilter) + val success = wifiManager.startScan() + if (!success) { + Log.d(TAG, "Scan not started") + // TODO: scan failure handling + } else { + Log.d(TAG, "Scan started") + } + } + } + + private fun updateWifiScanListSpinner(scanResults : MutableList) { + wifiApList.clear() + for (result in scanResults) { + if (result.SSID.toString().isNotEmpty()) + wifiApList.add("${result.SSID}, ${result.BSSID}, ${result.level}") + } + requireActivity().runOnUiThread { + wifiScanListSpinner.adapter = + ArrayAdapter(requireContext(), android.R.layout.simple_spinner_dropdown_item, wifiApList) + wifiScanListSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { + override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) { + wifiApSsid = wifiApList[position].split(",")[0].trim() + Log.d(TAG, "ready to connect to $wifiApSsid") + } + override fun onNothingSelected(parent: AdapterView<*>) {} + } + } } private fun updateSpinner() { @@ -98,4 +188,4 @@ class AddressCommissioningFragment : Fragment() { fun newInstance(): AddressCommissioningFragment = AddressCommissioningFragment() } -} \ No newline at end of file +} diff --git a/src/android/CHIPTool/app/src/main/res/layout/address_commissioning_fragment.xml b/src/android/CHIPTool/app/src/main/res/layout/address_commissioning_fragment.xml index 4ff57d1767d7ed..b82df0400a7a45 100644 --- a/src/android/CHIPTool/app/src/main/res/layout/address_commissioning_fragment.xml +++ b/src/android/CHIPTool/app/src/main/res/layout/address_commissioning_fragment.xml @@ -84,6 +84,24 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/address_commissioning_fragment_flow"> +