diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 386253bb609..d3c222df06c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -37,9 +37,14 @@ RUN apt-get update \ valgrind \ docker.io \ iputils-ping \ + icecc \ && : -RUN groupadd -g $USER_GID $USERNAME \ +RUN (getent passwd $USER_UID && userdel -f $(getent passwd $USER_UID | cut -d: -f1) || true) \ + && (getent group $USER_GID && groupdel -f $(getent group $USER_GID | cut -d: -f1) || true) \ + && (getent passwd $USERNAME && userdel -f $USERNAME || true) \ + && (getent group $USERNAME && groupdel -f $USERNAME || true) \ + && groupadd -g $USER_GID $USERNAME \ && useradd --no-log-init -s /bin/bash -u $USER_UID -g $USER_GID -G docker,sudo -m $USERNAME \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME \ @@ -80,3 +85,13 @@ ENV TIZEN_ROOTFS /tizen_rootfs # Fast Model GDB plugins path for debugging support ENV FAST_MODEL_PLUGINS_PATH /opt/FastModelsPortfolio_11.16/plugins/Linux64_GCC-9.3 + +# Set up ccache as a pigweed command launcher when using the scripts/build/build_examples.py +# script. Also, set up icecc as the command prefix for ccache. Such setup allows to benefit +# from compilation caching and distributed compilation at the same time. +# +# NOTE: In order to use distributed compilation with icecc, one should run +# "scripts/icecc.sh start" before starting the build. +ENV CHIP_PW_COMMAND_LAUNCHER ccache +ENV CCACHE_PREFIX icecc +ENV PATH /usr/lib/ccache:$PATH diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 5c24cdec825..9d916059a94 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -41,6 +41,9 @@ AFL AIDL algs alloc +allocator +allocators +Ambrose Ameba amebad amebaiot @@ -317,6 +320,7 @@ cryptographic CSA csg csrrequest +cstdint csu csv ctl @@ -440,6 +444,7 @@ DNSStubListener docbuild Dockerfile Dockerfiles +docstrings Don'ts DoorLock DoorState @@ -565,6 +570,8 @@ FlowMeasurement FluorideConcentrationMeasurement focusable forkpty +formatter +formatters FOTA FreeRTOS FreeRTOSConfig @@ -731,10 +738,12 @@ IPython ISCAN isHexString isLowerCase +isort isUpperCase itemName iterable itsfoss +IW JDK jinja JLink @@ -877,6 +886,7 @@ MediaPlayback MediaTek MEI mem +memcpy memdf MemMonitoring menuconfig @@ -893,6 +903,7 @@ microcontroller microcontrollers MicroSD middleware +MIMXRT minApplicableSoftwareVersion Minicom MinInterval @@ -924,12 +935,14 @@ Multicast multilib Multiprotocol multithreaded +Murata mutex mutexes mv MX mydir MyPASSWORD +mypy MySSID NAMESERVER NAMESPACE @@ -1006,6 +1019,7 @@ OpenThreadDemo openweave OperationalCredentials operationalDataset +operationalstate opkg OPTIGA optionMask @@ -1181,6 +1195,7 @@ rebase recommand recommanded recurse +refrigeratoralarm regen registerAttributeAccessOverride RegisterCommandHandler @@ -1438,6 +1453,7 @@ toJson tokenization tokenized tokenizer +toml toolchain toolchains topologies @@ -1451,6 +1467,8 @@ trackFree TransferSession transitionTime TransportMgrBase +triaged +triaging TriggerEffect TRNG trustm diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index dad1d2c6463..126296367b7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,12 +1,19 @@ -> !!!!!!!!!! Please delete the instructions below and replace with PR description + +#### Testing + +> !!!!!!!!!! Please delete the instructions below and replace with PR +> description above. > -> If you have an issue number, please use a syntax of -> `Fixes #12345` and a brief change description +> If you have an issue number, please use a syntax of `Fixes #12345` and a brief +> change description > -> If you do not have an issue number, please have a good description of -> the problem and the fix. Help the reviewer understand what to expect. +> If you do not have an issue number, please have a good description of the +> problem and the fix. Help the reviewer understand what to expect. +> +> Complete/append to the `### Testing` section above, to describe how testing +> was done. See +> > > Make sure you delete these instructions (to prove you have read them). > > !!!!!!!!!! Instructions end - diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index 909ef045c03..f47ce859328 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -12,8 +12,18 @@ darwin: # (?![a-z]) means "there is no next char in the range a-z". - "/(\\b[Ii][Oo][Ss](?![a-zA-Z])|[Hh][Oo][Mm][Ee][Pp][Oo][Dd]|[Dd][Aa][Rr][Ww][Ii][Nn]|\\bm[Aa][Cc]\\b|\\bMa[Cc]\\b|\\bM[Aa]c\\b|[Mm][Aa][Cc][Oo][Ss])/" -linux: - - "/(linux)/i" + +# NOTE: +# Linux intentionally disabled: most people compile either on linux or darwin and +# as a result a lot of issues get tagged as such even though they are not platform specific +# (e.g. we get test case failures reported as linux even though they are just normal +# test runs) +# +# Linux label should be reserved to platform-specific problems (usually bootstrap/packages +# or integration with wifi/ethernet/bluetootn/etc.) +# +# linux: +# - "/(linux)/i" # Special Keywords for Cert Blockers air purifiers: diff --git a/.github/labeler.yml b/.github/labeler.yml index 7e02fe6d368..cb4d0839816 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -119,15 +119,6 @@ test driver: - src/test_driver/* - src/test_driver/**/* -# Cert tests touched: add current milestone delta-tracking label. -# TODO: Change after Aug 15, 2024 -matter-1.4-te2-script-change: - - changed-files: - - any-glob-to-any-file: - - src/python_testing/* - - src/python_testing/**/* - - src/app/tests/suites/certification/* - ############################################################ # Source Code ############################################################ @@ -275,14 +266,22 @@ darwin: silabs: - changed-files: - any-glob-to-any-file: + - examples/platform/silabs/* + - examples/platform/silabs/**/* - src/platform/silabs/* - src/platform/silabs/**/* + - src/test_driver/efr32/* + - src/test_driver/efr32/**/* esp32: - changed-files: - any-glob-to-any-file: + - examples/platform/esp32/* + - examples/platform/esp32/**/* - src/platform/ESP32/* - src/platform/ESP32/**/* + - src/test_driver/esp32/* + - src/test_driver/esp32/**/* freeRTOS: - changed-files: @@ -290,23 +289,31 @@ freeRTOS: - src/platform/FreeRTOS/* - src/platform/FreeRTOS/**/* -k32w: +nxp: - changed-files: - any-glob-to-any-file: - - src/platform/K32W/* - - src/platform/K32W/**/* + - examples/platform/nxp/* + - examples/platform/nxp/**/* + - src/platform/nxp/* + - src/platform/nxp/**/* linux: - changed-files: - any-glob-to-any-file: + - examples/platform/linux/* + - examples/platform/linux/**/* - src/platform/Linux/* - src/platform/Linux/**/* nrf connect: - changed-files: - any-glob-to-any-file: + - examples/platform/nrfconnect/* + - examples/platform/nrfconnect/**/* - src/platform/nrfconnect/* - src/platform/nrfconnect/**/* + - src/test_driver/nrfconnect/* + - src/test_driver/nrfconnect/**/* openthread: - changed-files: @@ -323,11 +330,17 @@ zephyr: telink: - changed-files: - any-glob-to-any-file: + - examples/platform/telink/* + - examples/platform/telink/**/* - src/platform/telink/* - src/platform/telink/**/* tizen: - changed-files: - any-glob-to-any-file: + - examples/platform/tizen/* + - examples/platform/tizen/**/* - src/platform/Tizen/* - src/platform/Tizen/**/* + - src/test_driver/tizen/* + - src/test_driver/tizen/**/* diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 7ec2a6bf692..92667ddebec 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f14a16f5e01..42bd2cac737 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -43,7 +43,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -76,7 +76,7 @@ jobs: with: languages: "cpp" - name: Setup Build - run: scripts/build/gn_gen.sh --args="chip_config_memory_debug_checks=true chip_config_memory_debug_dmalloc=false chip_data_model_check_die_on_failure=true" + run: scripts/build/gn_gen.sh --args="chip_config_memory_debug_checks=true chip_config_memory_debug_dmalloc=false" - name: Run Build run: scripts/run_in_build_env.sh "ninja -C ./out" - name: Run Tests @@ -139,7 +139,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -157,6 +157,9 @@ jobs: run: echo "$CONCURRENCY_CONTEXT" - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 2 + persist-credentials: true - name: Try to ensure the directories for core dumping exist and we can write them. run: | @@ -180,12 +183,16 @@ jobs: scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" - name: Setup Build, Run Build and Run Tests run: | - BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false chip_data_model_check_die_on_failure=true" + BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false" scripts/run_in_build_env.sh "ninja -C ./out/gcc_release" BUILD_TYPE=gcc_release scripts/tests/gn_tests.sh - name: Clean output run: rm -rf ./out - name: Run Tests with sanitizers + # Sanitizer tests are not likely to find extra issues so running the same tests + # as above repeatedly on every pull request seems extra time. Instead keep this run + # for master only + if: github.event.pull_request.number == null env: LSAN_OPTIONS: detect_leaks=1 run: | @@ -198,20 +205,37 @@ jobs: esac rm -rf ./out/sanitizers - BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands + BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS" --add-export-compile-commands=* BUILD_TYPE=sanitizers scripts/tests/gn_tests.sh done + - name: Generate tests with sanitizers (for tidy) + if: github.event.pull_request.number != null + run: | + rm -rf ./out/sanitizers + BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="is_clang=true is_asan=true" --add-export-compile-commands=* - name: Ensure codegen is done for sanitize run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/sanitizers" + - name: Find changed files + id: changed-files + uses: tj-actions/changed-files@v45 - name: Clang-tidy validation # NOTE: clang-tidy crashes on CodegenDataModel_Write due to Nullable/std::optional check. # See https://github.com/llvm/llvm-project/issues/97426 + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | + touch out/changed_files.txt + for file in ${ALL_CHANGED_FILES}; do + echo "$file changed and will be considered for tidy" + echo "$file" >>out/changed_files.txt + done + ./scripts/run_in_build_env.sh \ "./scripts/run-clang-tidy-on-compile-commands.py \ --compile-database out/sanitizers/compile_commands.json \ --file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|-ReadImpl|-InvokeSubscribeImpl|CodegenDataModel_Write|QuieterReporting' \ + --file-list-file out/changed_files.txt \ check \ " - name: Clean output @@ -284,7 +308,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -309,7 +333,7 @@ jobs: - name: Setup Build, Run Build and Run Tests run: | - scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false chip_data_model_check_die_on_failure=true" + scripts/build/gn_gen.sh --args="enable_rtti=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false chip_generate_link_map_file=false" scripts/run_in_build_env.sh "ninja -C ./out" scripts/tests/gn_tests.sh - name: Setup test python environment @@ -339,6 +363,8 @@ jobs: python -m ensurepip --upgrade python -m pip install -r scripts/setup/requirements.setuppayload.txt python3 src/setup_payload/tests/run_python_setup_payload_test.py out/chip-tool + - name: Run revocation set generation tests + run: scripts/run_in_build_env.sh 'python3 -m unittest -v credentials/generate_revocation_set.py' build_linux_python_lighting_device: name: Build on Linux (python lighting-app) @@ -347,7 +373,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -375,13 +401,16 @@ jobs: scripts/build_python_device.sh --chip_detail_logging true build_darwin: - name: Build on Darwin (clang, python_lib, simulated) + name: Build on Darwin (clang, simulated) runs-on: macos-13 if: github.actor != 'restyled-io[bot]' steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 2 + persist-credentials: true - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: @@ -402,37 +431,42 @@ jobs: CHIP_ROOT_PATH=examples/placeholder/linux CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS" scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" - - name: Setup Build, Run Build and Run Tests + - name: Setup Build, Run Build and Run Tests (asan + target_os=all) # We can't enable leak checking here in LSAN_OPTIONS, because on # Darwin that's only supported with a new enough clang, and we're # not building with the pigweed clang here. + env: + BUILD_TYPE: default run: | - for BUILD_TYPE in default python_lib; do - case $BUILD_TYPE in - # We want to build various standalone example apps - # (similar to what examples-linux-standalone.yaml - # does), so use target_os="all" to get those picked - # up as part of the "unified" build. But then to - # save CI resources we want to exclude the - # "host clang" build, which uses the pigweed - # clang. - "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false';; - esac - BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands - scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" - BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh - done - - name: Ensure codegen is done for sanitize + # We want to build various standalone example apps (similar to what examples-linux-standalone.yaml + # does), so use target_os="all" to get those picked up as part of the "unified" build. But then + # to save CI resources we want to exclude the "host clang" build, which uses the pigweed clang. + scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false' --add-export-compile-commands=* + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + scripts/tests/gn_tests.sh + - name: Ensure codegen is done for default run: | ./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/default" + - name: Find changed files + id: changed-files + uses: tj-actions/changed-files@v45 - name: Clang-tidy validation # NOTE: clang-tidy crashes on CodegenDataModel_Write due to Nullable/std::optional check. # See https://github.com/llvm/llvm-project/issues/97426 + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | + touch out/changed_files.txt + for file in ${ALL_CHANGED_FILES}; do + echo "$file changed and will be considered for tidy" + echo "$file" >>out/changed_files.txt + done + ./scripts/run_in_build_env.sh \ "./scripts/run-clang-tidy-on-compile-commands.py \ --compile-database out/default/compile_commands.json \ --file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|CodegenDataModel_Write|QuieterReporting' \ + --file-list-file out/changed_files.txt \ check \ " - name: Uploading diagnostic logs @@ -458,7 +492,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/cancel_workflows_for_pr.yaml b/.github/workflows/cancel_workflows_for_pr.yaml new file mode 100644 index 00000000000..00146696913 --- /dev/null +++ b/.github/workflows/cancel_workflows_for_pr.yaml @@ -0,0 +1,53 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Cancel workflows on failing CI +on: + workflow_dispatch: + schedule: + - cron: "*/10 * * * *" + +jobs: + cancel_workflow: + name: Cancel CI on failing pull requests + + runs-on: ubuntu-latest + + # Don't run on forked repos + if: github.repository_owner == 'project-chip' + + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Setup pip modules we use + run: | + python3 -m venv venv + venv/bin/pip3 install \ + click \ + coloredlogs \ + python-dateutil \ + pygithub \ + && echo "DONE installing python prerequisites" + - name: Cancel runs + run: | + venv/bin/python3 scripts/tools/cancel_workflows_for_pr.py \ + --gh-api-token "${{ secrets.GITHUB_TOKEN }}" \ + --require "Restyled" \ + --require "Lint Code Base" \ + --require "ZAP" \ + --require "Run misspell" \ + --max-pr-age-minutes 20 diff --git a/.github/workflows/cert_test_checks.yaml b/.github/workflows/cert_test_checks.yaml index 44d545a6636..3f8f54dcf2d 100644 --- a/.github/workflows/cert_test_checks.yaml +++ b/.github/workflows/cert_test_checks.yaml @@ -18,6 +18,8 @@ on: pull_request: paths: - "src/app/tests/suites/certification/**" +permissions: + contents: read jobs: check-certification-tests: @@ -30,6 +32,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Run checks run: | python3 scripts/tests/matter_yaml_linter.py diff --git a/.github/workflows/check-data-model-directory-updates.yaml b/.github/workflows/check-data-model-directory-updates.yaml index 305da81d9da..7bd20c87e0e 100644 --- a/.github/workflows/check-data-model-directory-updates.yaml +++ b/.github/workflows/check-data-model-directory-updates.yaml @@ -12,20 +12,28 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Check for changes to data_model directory without a sha update +name: Data model directory checks on: pull_request: - paths: - - "data_model/**" jobs: - check-submodule-update-label: - name: Check for changes to data_model directory without a sha update + check-data_model-updates: + name: Check for updates to data model directory without SHA updates runs-on: ubuntu-latest - if: "git diff --name-only HEAD^..HEAD data_model/ | grep -q spec_sha" + container: + image: ghcr.io/project-chip/chip-build steps: - - name: Error Message - run: echo This pull request attempts to update data_model directory, but is missing updates to spec_sha file with the latest version of the sha. Files in the data_model directory are generated automatically and should not be updated manually. - - name: Fail Job - run: exit 1 + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Check for changes to master data_model directory without a SHA update + run: | + python3 scripts/dm_xml_ci_change_enforcement.py data_model/master + - name: Check for changes to 1.3 data_model directory without a SHA update + run: | + python3 scripts/dm_xml_ci_change_enforcement.py data_model/1.3 + - name: Check for changes to 1.4 data_model directory without a SHA update + run: | + python3 scripts/dm_xml_ci_change_enforcement.py data_model/1.4 \ No newline at end of file diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index a1e5907cb91..be8a6421f67 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 options: --user root steps: @@ -57,7 +57,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:81 + image: ghcr.io/project-chip/chip-build-esp32:97 options: --user root steps: @@ -78,7 +78,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:81 + image: ghcr.io/project-chip/chip-build-nrf-platform:97 options: --user root steps: @@ -99,7 +99,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:81 + image: ghcr.io/project-chip/chip-build-telink:97 options: --user root steps: @@ -111,7 +111,7 @@ jobs: platform: telink # - name: Update Zephyr to specific revision (for developers purpose) # shell: bash - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 3ed7686a9378de6be1368c912f9a42f998bbfb18" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py c05c461b1119782cc839cf436fa04ec5e1fb2c8c" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 1ddc9e9fbc4..2d46de23cfa 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -73,6 +73,10 @@ jobs: platform: darwin bootstrap-log-name: bootstrap-logs-darwin-${{ matrix.build_variant }} + - name: Build iOS Darwin Framework Tool Build Debug + working-directory: src/darwin/Framework + run: xcodebuild -target "darwin-framework-tool" -sdk iphoneos -configuration Debug AD_HOC_CODE_SIGNING_ALLOWED=YES + - name: Run macOS Darwin Framework Tool Build Debug working-directory: src/darwin/Framework run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index bc4441a84f1..e2ee439bbdb 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -117,9 +117,18 @@ jobs: export TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 # Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI. - xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx ${{ matrix.options.arguments }} \ + xcodebuild test -target "Matter" -scheme "Matter Framework Tests" \ + -resultBundlePath /tmp/darwin/framework-tests/TestResults.xcresult \ + -sdk macosx ${{ matrix.options.arguments }} \ CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} ${{ matrix.options.defines }}' \ > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2) + - name: Generate Summary + if: always() + working-directory: /tmp + run: | + wget https://github.com/a7ex/xcresultparser/releases/download/1.8.4/xcresultparser.zip + unzip -j xcresultparser.zip + ./xcresultparser --output-format md --failed-tests-only /tmp/darwin/framework-tests/TestResults.xcresult >>"$GITHUB_STEP_SUMMARY" - name: Collect crash logs if: failure() && !env.ACT run: | diff --git a/.github/workflows/docbuild.yaml b/.github/workflows/docbuild.yaml index 2d28a2a537d..a3d0247e6f8 100644 --- a/.github/workflows/docbuild.yaml +++ b/.github/workflows/docbuild.yaml @@ -29,17 +29,18 @@ jobs: - name: Install Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 cache-dependency-path: matter/docs/requirements.txt cache: pip - name: Install base dependencies working-directory: matter run: | - sudo pip3 install -U pip - pip3 install -r docs/requirements.txt + python3 -m venv venv + venv/bin/pip3 install -r docs/requirements.txt - name: Build documentation working-directory: matter/docs run: | + source ../venv/bin/activate mkdir -p _build/src make html touch _build/html/.nojekyll diff --git a/.github/workflows/docker_img.yaml b/.github/workflows/docker_img.yaml index 8921a55cb2b..663f9e037bb 100644 --- a/.github/workflows/docker_img.yaml +++ b/.github/workflows/docker_img.yaml @@ -33,7 +33,7 @@ on: required: false type: boolean default: false - + jobs: build_images_base: name: Build Docker CHIP Build images - base @@ -102,6 +102,7 @@ jobs: # - "-imx" - "-java" - "-nxp" + - "-nxp-zephyr" - "-nrf-platform" - "-telink" - "-ti" @@ -120,7 +121,7 @@ jobs: run: | cd integrations/docker/images/stage-2/chip-build${{ matrix.img }} ./build.sh --latest - + build_images_stage_3: needs: [build_images_base, build_images_stage_1, build_images_stage_2] name: Build Docker CHIP Build images - stage 3 diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 9dc5bbab1ac..c712ffed71a 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -84,7 +84,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:81 + image: ghcr.io/project-chip/chip-build-doxygen:97 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 1c87787cf67..ed978476c25 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:81 + image: ghcr.io/project-chip/chip-build-ameba:97 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index 7597ef1783e..bac2f05f7ff 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:81 + image: ghcr.io/project-chip/chip-build-asr:97 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 9a6989881e5..37fdb947bfd 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:81 + image: ghcr.io/project-chip/chip-build-bouffalolab:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -58,25 +58,15 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target bouffalolab-bl602dk-light-easyflash \ - --target bouffalolab-bl602dk-light-mfd-littlefs \ - --target bouffalolab-bl602dk-light-rpc-115200-littlefs \ + --target bouffalolab-bl602dk-light-wifi-littlefs-mfd-rpc \ 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 \ - bl602 bl602 lighting-app \ - out/artifacts/bouffalolab-bl602dk-light-easyflash/chip-bl602-lighting-example.out \ - /tmp/bloat_reports/ - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - bl602 bl602+mfd lighting-app \ - out/artifacts/bouffalolab-bl602dk-light-mfd-littlefs/chip-bl602-lighting-example.out \ - /tmp/bloat_reports/ - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - bl602 bl602+rpc lighting-app \ - out/artifacts/bouffalolab-bl602dk-light-rpc-115200-littlefs/chip-bl602-lighting-example.out \ + bl602 bl602+mfd+littlefs+rpc lighting-app \ + out/artifacts/bouffalolab-bl602dk-light-wifi-littlefs-mfd-rpc/chip-bl602-lighting-example.out \ /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out @@ -85,35 +75,25 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target bouffalolab-bl706dk-light-easyflash \ - --target bouffalolab-bl706dk-light-mfd-littlefs \ - --target bouffalolab-bl706dk-light-ethernet-littlefs \ + --target bouffalolab-bl706dk-light-ethernet-easyflash \ --target bouffalolab-bl706dk-light-wifi-littlefs \ - --target bouffalolab-bl706dk-light-rpc-115200-littlefs \ + --target bouffalolab-bl706dk-light-thread-littlefs-mfd-rpc \ 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 \ - bl702 bl702 lighting-app \ - out/artifacts/bouffalolab-bl706dk-light-easyflash/chip-bl702-lighting-example.out \ - /tmp/bloat_reports/ - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - bl702 bl702+mfd lighting-app \ - out/artifacts/bouffalolab-bl706dk-light-mfd-littlefs/chip-bl702-lighting-example.out \ - /tmp/bloat_reports/ - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - bl702 bl706-eth lighting-app \ - out/artifacts/bouffalolab-bl706dk-light-ethernet-littlefs/chip-bl702-lighting-example.out \ + bl702 bl702+eth lighting-app \ + out/artifacts/bouffalolab-bl706dk-light-ethernet-easyflash/chip-bl702-lighting-example.out \ /tmp/bloat_reports/ .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - bl702 bl706-wifi lighting-app \ + bl702 bl702+wifi lighting-app \ out/artifacts/bouffalolab-bl706dk-light-wifi-littlefs/chip-bl702-lighting-example.out \ /tmp/bloat_reports/ .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - bl702 bl702+rpc lighting-app \ - out/artifacts/bouffalolab-bl706dk-light-rpc-115200-littlefs/chip-bl702-lighting-example.out \ + bl702 bl706+mfd+rpc+littlefs lighting-app \ + out/artifacts/bouffalolab-bl706dk-light-thread-littlefs-mfd-rpc/chip-bl702-lighting-example.out \ /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out @@ -123,20 +103,33 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target bouffalolab-bl704ldk-light-easyflash \ - --target bouffalolab-bl704ldk-light-mfd-littlefs \ + --target bouffalolab-bl704ldk-light-thread-littlefs-mfd \ 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 \ - bl702l bl702l lighting-app \ - out/artifacts/bouffalolab-bl704ldk-light-easyflash/chip-bl702l-lighting-example.out \ + bl702l bl702l+mfd+littlefs lighting-app \ + out/artifacts/bouffalolab-bl704ldk-light-thread-littlefs-mfd/chip-bl702l-lighting-example.out \ /tmp/bloat_reports/ + - name: Clean out build output + run: rm -rf ./out + + - name: Build example BL702L Contact Sensor + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target bouffalolab-bl704ldk-contact-sensor-thread-mtd-littlefs-mfd \ + 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 \ - bl702l bl702l+mfd lighting-app \ - out/artifacts/bouffalolab-bl704ldk-light-mfd-littlefs/chip-bl702l-lighting-example.out \ + bl702l bl702l+mfd+littlefs contact-sensor-app \ + out/artifacts/bouffalolab-bl704ldk-contact-sensor-thread-mtd-littlefs-mfd/chip-bl702l-contact-sensor-example.out \ /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index 31988e66385..793a27a0287 100644 --- a/.github/workflows/examples-cc13xx_26xx.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:81 + image: ghcr.io/project-chip/chip-build-ti:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index 24edcb3fa92..703fea73afb 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:81 + image: ghcr.io/project-chip/chip-build-ti:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 6d286355970..bed526f1c14 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:81 + image: ghcr.io/project-chip/chip-build-efr32:95 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -68,8 +68,7 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target efr32-brd4187c-thermostat-openthread-mtd \ - --target efr32-brd4187c-air-quality-sensor-app-openthread-mtd \ + --target efr32-brd4187c-thermostat-use-ot-lib \ --target efr32-brd4187c-switch-shell-use-ot-coap-lib \ --target efr32-brd4187c-unit-test \ build \ @@ -82,29 +81,17 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target efr32-brd4187c-light-use-ot-lib \ - --target efr32-brd4187c-pump \ - --target efr32-brd4187c-lock-shell-heap-monitoring \ - build \ - --copy-artifacts-to out/artifacts \ - " - - name: Clean out build output - run: rm -rf ./out - - name: Build BRD4187C variants (3) - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py \ - --enable-flashbundle \ + --target efr32-brd4187c-lock-rpc \ + --target efr32-brd4187c-air-quality-sensor-app-shell-heap-monitoring \ --target efr32-brd4187c-window-covering-additional-data-advertising \ - --target efr32-brd4187c-light-rpc \ 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 BRD4187C lighting-app \ - out/efr32-brd4187c-light-rpc/matter-silabs-lighting-example.out \ + efr32 BRD4187C lock-app \ + out/efr32-brd4187c-lock-rpc/matter-silabs-lock-example.out \ /tmp/bloat_reports/ .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ efr32 BRD4187C window-app \ @@ -112,12 +99,12 @@ jobs: /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out - - name: Build BRD4338A WiFi Soc variants + - name: Build some WiFi Soc variants run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ --enable-flashbundle \ - --target efr32-brd4338a-light-skip-rps-generation \ + --target efr32-brd2605a-light-skip-rps-generation \ --target efr32-brd4338a-lock-skip-rps-generation \ build \ --copy-artifacts-to out/artifacts \ @@ -130,24 +117,6 @@ jobs: /tmp/bloat_reports/ - name: Clean out build output run: rm -rf ./out - - name: Build BRD2605A WiFi Soc variants - run: | - ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py \ - --enable-flashbundle \ - --target efr32-brd2605a-light-skip-rps-generation \ - --target efr32-brd2605a-lock-skip-rps-generation \ - build \ - --copy-artifacts-to out/artifacts \ - " - - name: Prepare bloat report for brd2605a lock app - run: | - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - efr32 BRD2605a lock-app \ - out/efr32-brd2605a-lock-skip-rps-generation/matter-silabs-lock-example.out \ - /tmp/bloat_reports/ - - name: Clean out build output - run: rm -rf ./out - name: Build EFR32 with WiFi NCP run: | ./scripts/run_in_build_env.sh \ diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index a2dca96dc6d..cd626fd0266 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:81 + image: ghcr.io/project-chip/chip-build-esp32:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -83,7 +83,6 @@ jobs: "./scripts/build/build_examples.py \ --enable-flashbundle \ --target esp32-m5stack-all-clusters-minimal \ - --target esp32-m5stack-all-clusters-rpc-ipv6only \ --pregen-dir ./zzz_pregenerated \ build \ --copy-artifacts-to out/artifacts \ @@ -94,7 +93,16 @@ jobs: mv scripts/codegen.py.renamed scripts/codegen.py mv scripts/tools/zap/generate.py.renamed scripts/tools/zap/generate.py - name: Build example All Clusters App(Target:ESP32C3) - run: scripts/examples/esp_example.sh all-clusters-app sdkconfig.defaults.esp32c3 esp32c3 + run: scripts/examples/esp_example.sh all-clusters-app sdkconfig.defaults esp32c3 + - name: Build example All Clusters App(Target:ESP32) + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --enable-flashbundle \ + --target esp32-devkitc-all-clusters-rpc-ipv6only \ + build \ + --copy-artifacts-to out/artifacts \ + " - name: Copy aside build products run: | mkdir -p example_binaries/esp32-build @@ -105,14 +113,11 @@ jobs: example_binaries/esp32-build/chip-all-clusters-app.elf \ /tmp/bloat_reports/ - - name: Build example Pigweed App - run: scripts/examples/esp_example.sh pigweed-app sdkconfig.defaults - - name: Build example Lighting App (Target:ESP32H2) - run: scripts/examples/esp_example.sh lighting-app sdkconfig.defaults.esp32h2 esp32h2 + run: scripts/examples/esp_example.sh lighting-app sdkconfig.defaults esp32h2 - - name: Build example Lock App (Target:ESP32C6) - run: scripts/examples/esp_example.sh lock-app sdkconfig.defaults.esp32c6 esp32c6 + - name: Build example Lighting App (Target:ESP32C6) + run: scripts/examples/esp_example.sh lighting-app sdkconfig.defaults esp32c6 - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports @@ -124,10 +129,10 @@ jobs: name: ESP32_1 runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' + if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32:81 + image: ghcr.io/project-chip/chip-build-esp32:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -158,7 +163,7 @@ jobs: run: scripts/examples/esp_example.sh ota-provider-app sdkconfig.defaults - name: Build example Light Switch App (Target:ESP32C3) - run: scripts/examples/esp_example.sh light-switch-app sdkconfig.defaults.esp32c3 esp32c3 + run: scripts/examples/esp_example.sh light-switch-app sdkconfig.defaults esp32c3 - name: Build example Lighting App (external platform) run: scripts/examples/esp_example.sh lighting-app sdkconfig.ext_plat.defaults @@ -168,3 +173,9 @@ jobs: - name: Build example LIT ICD App (Target:ESP32H2) run: scripts/examples/esp_example.sh lit-icd-app sdkconfig.defaults esp32h2 + + - name: Build example Pigweed App + run: scripts/examples/esp_example.sh pigweed-app sdkconfig.defaults + + - name: Build example Lock App (Target:ESP32C6) + run: scripts/examples/esp_example.sh lock-app sdkconfig.defaults esp32c6 diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index ada44f1557b..616b3a5bc4d 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:81 + image: ghcr.io/project-chip/chip-build-infineon:97 env: # TODO: this should probably be part of the dockerfile itself CY_TOOLS_PATHS: /opt/Tools/ModusToolbox/tools_3.2 diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index ee226b12dc2..6c0d7418103 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:81 + image: ghcr.io/project-chip/chip-build-crosscompile:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -70,6 +70,7 @@ jobs: --target linux-arm64-lit-icd-no-ble-clang \ --target linux-arm64-fabric-admin-clang-rpc \ --target linux-arm64-fabric-bridge-no-ble-clang-rpc \ + --target linux-arm64-fabric-sync-no-ble-clang \ build \ " - name: Bloat report - chip-tool diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index d2f1014eb57..bc02b0e7262 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:81 + image: ghcr.io/project-chip/chip-build-imx:97 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 83b82369ba4..9f03f103cfd 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -219,6 +219,16 @@ jobs: linux debug fabric-bridge-app \ out/linux-x64-fabric-bridge-no-ble-rpc/fabric-bridge-app \ /tmp/bloat_reports/ + - name: Build example Fabric Sync + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-fabric-sync-no-ble \ + build" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug fabric-sync \ + out/linux-x64-fabric-sync-no-ble/fabric-sync \ + /tmp/bloat_reports/ - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index e2617aeec7f..5d082fb1948 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 steps: - name: Checkout @@ -72,16 +72,13 @@ jobs: "python3 ./scripts/tests/run_tv_casting_test.py" timeout-minutes: 2 # Comment this out to debug if GitHub Action times out. - # TODO: this test is flaky and was disabled - # https://github.com/project-chip/connectedhomeip/issues/34598 - # - # - name: - # Test casting from Linux tv-casting-app to Linux tv-app - - # Commissioner Generated Passcode - # run: | - # ./scripts/run_in_build_env.sh \ - # "python3 ./scripts/tests/run_tv_casting_test.py --commissioner-generated-passcode=True" - # timeout-minutes: 2 # Comment this out to debug if GitHub Action times out. + - name: + Test casting from Linux tv-casting-app to Linux tv-app - + Commissioner Generated Passcode + run: | + ./scripts/run_in_build_env.sh \ + "python3 ./scripts/tests/run_tv_casting_test.py --commissioner-generated-passcode=True" + timeout-minutes: 2 # Comment this out to debug if GitHub Action times out. - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 8f76321a0c0..6e820e8faa0 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index d781087fc84..77a8ec626ba 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:81 + image: ghcr.io/project-chip/chip-build-nrf-platform:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index f1f682e0089..274a18ecd20 100644 --- a/.github/workflows/examples-nuttx.yaml +++ b/.github/workflows/examples-nuttx.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nuttx:81 + image: ghcr.io/project-chip/chip-build-nuttx:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 6354718f25b..d74f01bc813 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -30,17 +30,17 @@ env: CHIP_NO_LOG_TIMESTAMPS: true jobs: - k32w0: - name: K32W0 + FreeRTOS: + name: FREERTOS env: - BUILD_TYPE: gn_k32w + BUILD_TYPE: gn_FreeRTOS runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp:80 + image: ghcr.io/project-chip/chip-build-nxp:96 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -50,6 +50,15 @@ jobs: uses: ./.github/actions/checkout-submodules-and-bootstrap with: platform: nxp + extra-submodule-parameters: --recursive + + - name: Detect changed paths + uses: dorny/paths-filter@v3 + id: changed_paths + with: + filters: | + nxp: + - '**/nxp/**' - name: Set up environment for size reports uses: ./.github/actions/setup-size-reports @@ -57,222 +66,172 @@ jobs: with: gh-context: ${{ toJson(github) }} - - name: Build examples + - name: Build K32W0 examples run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ - --target nxp-k32w0-freertos-lighting \ - --target nxp-k32w0-freertos-lighting-factory \ - --target nxp-k32w0-freertos-lighting-rotating-id \ - --target nxp-k32w0-freertos-contact-sensor \ - --target nxp-k32w0-freertos-contact-sensor-low-power \ + --target nxp-k32w0-freertos-lighting-factory-log-progress \ --target nxp-k32w0-freertos-contact-sensor-low-power-factory \ build \ --copy-artifacts-to out/artifacts \ " - - name: Get lighting app size stats + - name: Get K32W0 lighting app size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w0+release light \ - out/artifacts/nxp-k32w0-freertos-lighting/chip-k32w0x-light-example.elf \ + out/artifacts/nxp-k32w0-freertos-lighting-factory-log-progress/chip-k32w0x-light-example.elf \ /tmp/bloat_reports/ - - name: Get contact sensor size stats + - name: Get K32W0 contact sensor size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w0+release contact \ - out/artifacts/nxp-k32w0-freertos-contact-sensor-low-power/chip-k32w0x-contact-example.elf \ + out/artifacts/nxp-k32w0-freertos-contact-sensor-low-power-factory/chip-k32w0x-contact-example.elf \ /tmp/bloat_reports/ - - name: Uploading Size Reports - uses: ./.github/actions/upload-size-reports - if: ${{ !env.ACT }} - with: - platform-name: K32W0 - k32w1: - name: K32W1 - env: - BUILD_TYPE: gn_k32w + - name: clean build + run: rm -rf ./out - runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' - - container: - image: ghcr.io/project-chip/chip-build-nxp:81 - volumes: - - "/tmp/bloat_reports:/tmp/bloat_reports" - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Checkout submodules & Bootstrap - uses: ./.github/actions/checkout-submodules-and-bootstrap - with: - platform: nxp - extra-submodule-parameters: --recursive - - - name: Set up environment for size reports - uses: ./.github/actions/setup-size-reports - if: ${{ !env.ACT }} - with: - gh-context: ${{ toJson(github) }} - - - name: Build examples + - name: Build K32W1 examples run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target nxp-k32w1-freertos-lighting \ - --target nxp-k32w1-freertos-contact-sensor-low-power \ - --target nxp-k32w1-freertos-lock-app \ build \ --copy-artifacts-to out/artifacts \ " - - name: Get lighting app size stats + - name: Get K32W1 lighting app size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w1+release light \ out/artifacts/nxp-k32w1-freertos-lighting/chip-k32w1-light-example.elf \ /tmp/bloat_reports/ - - name: Get contact sensor size stats - run: | - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - nxp k32w1+release contact \ - out/artifacts/nxp-k32w1-freertos-contact-sensor-low-power/chip-k32w1-contact-example.elf \ - /tmp/bloat_reports/ - - name: Get lock app size stats - run: | - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - nxp k32w1+release lock \ - out/artifacts/nxp-k32w1-freertos-lock-app/chip-k32w1-lock-example.elf \ - /tmp/bloat_reports/ - - name: Uploading Size Reports - uses: ./.github/actions/upload-size-reports - if: ${{ !env.ACT }} - with: - platform-name: K32W1 - mcxw71: - name: MCXW71 - - env: - BUILD_TYPE: gn_k32w - - runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' - - container: - image: ghcr.io/project-chip/chip-build-nxp:81 - volumes: - - "/tmp/bloat_reports:/tmp/bloat_reports" - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Checkout submodules & Bootstrap - uses: ./.github/actions/checkout-submodules-and-bootstrap - with: - platform: nxp - extra-submodule-parameters: --recursive - - name: Set up environment for size reports - uses: ./.github/actions/setup-size-reports - if: ${{ !env.ACT }} - with: - gh-context: ${{ toJson(github) }} + - name: clean build + run: rm -rf ./out - - name: Build examples + - name: Build MCXW71 examples run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ - --target nxp-mcxw71-freertos-lighting \ --target nxp-mcxw71-freertos-contact-sensor-low-power \ --target nxp-mcxw71-freertos-lock-app \ build \ --copy-artifacts-to out/artifacts \ " - - name: Get lighting app size stats - run: | - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - nxp mcxw71+release light \ - out/artifacts/nxp-mcxw71-freertos-lighting/chip-mcxw71-light-example.elf \ - /tmp/bloat_reports/ - - name: Get contact sensor size stats + - name: Get MCXW71 contact sensor size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp mcxw71+release contact \ out/artifacts/nxp-mcxw71-freertos-contact-sensor-low-power/chip-mcxw71-contact-example.elf \ /tmp/bloat_reports/ - - name: Get lock app size stats + - name: Get MCXW71 lock app size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp mcxw71+release lock \ out/artifacts/nxp-mcxw71-freertos-lock-app/chip-mcxw71-lock-example.elf \ /tmp/bloat_reports/ - - name: Uploading Size Reports - uses: ./.github/actions/upload-size-reports - if: ${{ !env.ACT }} - with: - platform-name: MCXW71 - rw61x: - name: RW61X - env: - BUILD_TYPE: gn_rw61x + - name: clean build + run: rm -rf ./out - runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' + - name: Build RT1060 all clusters example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rt1060-freertos-all-clusters-wifi-iw416 \ + --target nxp-rt1060-freertos-all-clusters-wifi-w8801 \ + --target nxp-rt1060-freertos-all-clusters-wifi-ota-evkc-iwx12 \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Build RT1060 thermostat example app + if: github.event_name == 'push' || steps.changed_paths.outputs.nxp == 'true' + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rt1060-freertos-thermostat-thread-wifi-evkc-iwx12 \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Build RT1060 laundry-washer example app + if: github.event_name == 'push' || steps.changed_paths.outputs.nxp == 'true' + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rt1060-freertos-laundry-washer-wifi-evkc-iwx12 \ + --target nxp-rt1060-freertos-laundry-washer-thread-evkc-iwx12 \ + build \ + --copy-artifacts-to out/artifacts \ + " - container: - image: ghcr.io/project-chip/chip-build-nxp:81 - volumes: - - "/tmp/bloat_reports:/tmp/bloat_reports" - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Checkout submodules & Bootstrap - uses: ./.github/actions/checkout-submodules-and-bootstrap - with: - platform: nxp - extra-submodule-parameters: --recursive + - name: clean build + run: rm -rf ./out - - name: Set up environment for size reports - uses: ./.github/actions/setup-size-reports - if: ${{ !env.ACT }} - with: - gh-context: ${{ toJson(github) }} + - name: Build RT1170 all clusters example app + if: github.event_name == 'push' || steps.changed_paths.outputs.nxp == 'true' + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rt1170-freertos-all-clusters-wifi-iwx12 \ + --target nxp-rt1170-freertos-all-clusters-wifi-ota-iwx12 \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Build RT1170 thermostat example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rt1170-freertos-thermostat-thread-wifi-iwx12 \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Build RT1170 laundry-washer example app + if: github.event_name == 'push' || steps.changed_paths.outputs.nxp == 'true' + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rt1170-freertos-laundry-washer-thread-iwx12 \ + build \ + --copy-artifacts-to out/artifacts \ + " + + - name: clean build + run: rm -rf ./out - name: Build RW61X all clusters example app run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target nxp-rw61x-freertos-all-clusters-wifi \ - --target nxp-rw61x-freertos-all-clusters-thread \ - --target nxp-rw61x-freertos-all-clusters-wifi-ota-cmake \ build \ --copy-artifacts-to out/artifacts \ " - - name: Build RW61X thermostat example app run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ - --target nxp-rw61x-freertos-thermostat-wifi \ - --target nxp-rw61x-freertos-thermostat-thread \ --target nxp-rw61x-freertos-thermostat-thread-wifi \ build \ --copy-artifacts-to out/artifacts \ " - - name: Build RW61X laundry-washer example app + if: github.event_name == 'push' || steps.changed_paths.outputs.nxp == 'true' run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target nxp-rw61x-freertos-laundry-washer-wifi \ - --target nxp-rw61x-freertos-laundry-washer-thread \ build \ --copy-artifacts-to out/artifacts \ " + + - name: clean build + run: rm -rf ./out + - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} with: - platform-name: RW61X + platform-name: NXP-FREERTOS zephyr: name: ZEPHYR @@ -280,7 +239,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp-zephyr:81 + image: ghcr.io/project-chip/chip-build-nxp-zephyr:97 steps: - name: Checkout @@ -289,8 +248,15 @@ jobs: uses: ./.github/actions/checkout-submodules-and-bootstrap with: platform: nxp - + - name: Detect changed paths + uses: dorny/paths-filter@v3 + id: changed_paths + with: + filters: | + nxp: + - '**/nxp/**' - name: Build NXP Zephyr examples + if: github.event_name == 'push' || steps.changed_paths.outputs.nxp == 'true' run: | scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 95389cb157f..eb132385506 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:81 + image: ghcr.io/project-chip/chip-build-openiotsdk:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 312c4932928..d1701e03de5 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 2e8f8576735..5f1e859c750 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 64b3d6bb7c9..a493982513c 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:81 + image: ghcr.io/project-chip/chip-build-telink:97 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -58,9 +58,11 @@ jobs: gh-context: ${{ toJson(github) }} # - name: Update Zephyr to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 3ed7686a9378de6be1368c912f9a42f998bbfb18" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py c05c461b1119782cc839cf436fa04ec5e1fb2c8c" - 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" @@ -73,6 +75,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (W91) All Clusters App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' continue-on-error: true run: | ./scripts/run_in_build_env.sh \ @@ -86,6 +90,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B92) All Clusters Minimal App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9528a-all-clusters-minimal' build" @@ -98,6 +104,7 @@ jobs: run: rm -rf ./out - name: Build example Telink (B95) Bridge App + # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9258a-bridge' build" @@ -110,6 +117,7 @@ jobs: run: rm -rf ./out - name: Build example Telink (B92 retention) Contact Sensor App + # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-contact-sensor' build" @@ -122,6 +130,7 @@ jobs: run: rm -rf ./out - 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 @@ -132,6 +141,7 @@ jobs: run: rm -rf ./out/telink* - name: Build example Telink (W91) Lighting App with OTA, Factory Data + # Run test for master and all PRs continue-on-error: true run: | ./scripts/run_in_build_env.sh \ @@ -145,6 +155,7 @@ jobs: run: rm -rf ./out/telink* - name: Build example Telink (B91) Lighting App with OTA, RPC, Factory Data and 4Mb flash + # Run test for master and all PRs run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb' build" @@ -156,19 +167,48 @@ jobs: - name: clean out build output (keep tools) run: rm -rf ./out/telink* - - name: Build example Telink (B92) Light Switch App with OTA, Shell, Factory Data + - 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-tlsr9528a-light-switch-ota-shell-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tl3218x-light-ota-compress-lzma-shell-factory-data' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9528a light-switch-app-ota-shell-factory-data \ - out/telink-tlsr9528a-light-switch-ota-shell-factory-data/zephyr/zephyr.elf \ + telink tl3218x light-app-ota-compress-lzma-shell-factory-data \ + out/telink-tl3218x-light-ota-compress-lzma-shell-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 + # 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" + .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 \ + /tmp/bloat_reports/ + + - 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" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + telink tlsr9528a light-switch-app-ota-compress-lzma-shell-factory-data \ + out/telink-tlsr9528a-light-switch-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output run: rm -rf ./out - name: Build example Telink (B92) Lock App with DFU + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9528a-lock-dfu' build" @@ -181,6 +221,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B95) OTA Requestor App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9258a-ota-requestor' build" @@ -193,6 +235,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B91 USB) Pump App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-usb' build" @@ -205,6 +249,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B91) Pump Controller App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-controller' build" @@ -217,6 +263,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B91) Shell App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-shell' build" @@ -229,6 +277,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B92 retention) Smoke CO Alarm App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-smoke-co-alarm' build" @@ -241,6 +291,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B91 Mars) Temperature Measurement App with OTA + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-temperature-measurement-mars-ota' build" @@ -253,6 +305,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (B91) Thermostat App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-thermostat' build" @@ -265,6 +319,8 @@ jobs: run: rm -rf ./out - name: Build example Telink (W91) Window Covering App + # Run test for master and s07641069 PRs + if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip' continue-on-error: true run: | ./scripts/run_in_build_env.sh \ diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index f0e4dfb3a20..11093d4ffc1 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:81 + image: ghcr.io/project-chip/chip-build-tizen:97 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index c3871ad8815..d672632edfc 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:81 + image: ghcr.io/project-chip/chip-build-android:97 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index c37ca98e1a5..b236d1bbb6a 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index abf2e75027b..7d5170c39bc 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:81 + image: ghcr.io/project-chip/chip-build-java:97 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -94,6 +94,7 @@ jobs: --target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-java-matter-controller \ --target linux-x64-lit-icd-ipv6only \ + --target linux-x64-ota-requestor \ build \ " - name: Build Kotlin Matter Controller @@ -104,6 +105,8 @@ jobs: build \ " - name: Run Discover Commissionables Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -115,6 +118,8 @@ jobs: --factoryreset \ ' - name: Run Pairing Onnetwork Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -126,6 +131,8 @@ jobs: --factoryreset \ ' - name: Run IM Invoke Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -137,6 +144,8 @@ jobs: --factoryreset \ ' - name: Run IM Extendable Invoke Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -148,6 +157,8 @@ jobs: --factoryreset \ ' - name: Run IM Read Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -159,6 +170,8 @@ jobs: --factoryreset \ ' - name: Run IM Write Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -170,6 +183,8 @@ jobs: --factoryreset \ ' - name: Run IM Subscribe Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -181,6 +196,8 @@ jobs: --factoryreset \ ' - name: Run Pairing AlreadyDiscovered Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -191,19 +208,22 @@ jobs: --tool-args "already-discovered --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ --factoryreset \ ' - # Disabled due to failure: https://github.com/project-chip/connectedhomeip/issues/27361 - # - name: Run Pairing Address-PaseOnly Test - # run: | - # scripts/run_in_python_env.sh out/venv \ - # './scripts/tests/run_java_test.py \ - # --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ - # --app-args "--discriminator 3840 --interface-id -1" \ - # --tool-path out/linux-x64-java-matter-controller \ - # --tool-cluster "pairing" \ - # --tool-args "address-paseonly --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ - # --factoryreset \ - # ' + - name: Run Pairing Address-PaseOnly Test + # Disabled due to failure: https://github.com/project-chip/connectedhomeip/issues/27361 + if: false + run: | + scripts/run_in_python_env.sh out/venv \ + './scripts/tests/run_java_test.py \ + --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ + --app-args "--discriminator 3840 --interface-id -1" \ + --tool-path out/linux-x64-java-matter-controller \ + --tool-cluster "pairing" \ + --tool-args "address-paseonly --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ + --factoryreset \ + ' - name: Run Pairing SetupQRCode Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -215,6 +235,8 @@ jobs: --factoryreset \ ' - name: Run Pairing ManualCode Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -226,6 +248,8 @@ jobs: --factoryreset \ ' - name: Run Pairing ICD Onnetwork Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_java_test.py \ @@ -236,7 +260,33 @@ jobs: --tool-args "onnetwork-long --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ --factoryreset \ ' + - name: Run Pairing ICD Onnetwork and OTA test + # Generally completes in seconds + timeout-minutes: 2 + run: | + scripts/run_in_python_env.sh out/venv \ + './scripts/tests/run_java_test.py \ + --app out/linux-x64-ota-requestor/chip-ota-requestor-app \ + --app-args "--discriminator 3840 --interface-id -1" \ + --tool-path out/linux-x64-java-matter-controller \ + --tool-cluster "ota" \ + --tool-args "onnetwork-long-ota-over-bdx --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ + --factoryreset \ + ' + - name: Run Pairing Onnetwork and get diagnostic log Test + run: | + scripts/run_in_python_env.sh out/venv \ + './scripts/tests/run_java_test.py \ + --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ + --app-args "--discriminator 3840 --interface-id -1 --crash_log ./crashLog.log --end_user_support_log ./enduser.log --network_diagnostics_log ./network.log" \ + --tool-path out/linux-x64-java-matter-controller \ + --tool-cluster "bdx" \ + --tool-args "onnetwork-long-downloadLog --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 3000 --logType CrashLogs --fileName ./crashLog.log" \ + --factoryreset \ + ' - name: Run Pairing Onnetwork Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_kotlin_test.py \ @@ -248,6 +298,8 @@ jobs: --factoryreset \ ' - name: Run Kotlin IM Invoke Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_kotlin_test.py \ @@ -259,6 +311,8 @@ jobs: --factoryreset \ ' - name: Run Kotlin IM Read Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_kotlin_test.py \ @@ -270,6 +324,8 @@ jobs: --factoryreset \ ' - name: Run Kotlin IM Write Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_kotlin_test.py \ @@ -281,6 +337,8 @@ jobs: --factoryreset \ ' - name: Run Kotlin IM Subscribe Test + # Generally completes in seconds + timeout-minutes: 2 run: | scripts/run_in_python_env.sh out/venv \ './scripts/tests/run_kotlin_test.py \ diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a914e5ae369..786fee68400 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 steps: - name: Checkout @@ -105,10 +105,8 @@ jobs: --known-failure app/reporting/reporting.cpp \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ --known-failure app/reporting/tests/MockReportScheduler.h \ - --known-failure app/util/attribute-storage.cpp \ --known-failure app/util/attribute-storage-detail.h \ --known-failure app/util/attribute-storage.h \ - --known-failure app/util/attribute-table.cpp \ --known-failure app/util/attribute-table-detail.h \ --known-failure app/util/attribute-table.h \ --known-failure app/util/binding-table.cpp \ @@ -116,11 +114,7 @@ jobs: --known-failure app/util/config.h \ --known-failure app/util/DataModelHandler.cpp \ --known-failure app/util/DataModelHandler.h \ - --known-failure app/util/ember-compatibility-functions.cpp \ - --known-failure app/util/ember-compatibility-functions.h \ - --known-failure app/util/ember-global-attribute-access-interface.cpp \ --known-failure app/util/ember-global-attribute-access-interface.h \ - --known-failure app/util/ember-io-storage.cpp \ --known-failure app/util/ember-io-storage.h \ --known-failure app/util/endpoint-config-api.h \ --known-failure app/util/generic-callbacks.h \ @@ -135,7 +129,12 @@ jobs: --known-failure platform/GLibTypeDeleter.h \ --known-failure platform/SingletonConfigurationManager.cpp \ " - + # These ARE actually orphaned but due to dynamic-server we have code paths + # for them. Keeping them as a list as they still need review ... + # --known-failure app/util/attribute-table.cpp \ + # --known-failure app/util/ember-io-storage.cpp \ + # --known-failure app/util/ember-global-attribute-access-interface.cpp \ + # --known-failure app/util/attribute-storage.cpp \ - name: Check for matter lint errors if: always() run: | @@ -293,13 +292,14 @@ jobs: git grep -I -n 'emberAfWriteAttribute' -- './*' \ ':(exclude).github/workflows/lint.yml' \ ':(exclude)examples/common/pigweed/rpc_services/Attributes.h' \ - ':(exclude)src/app/codegen-data-model-provider/CodegenDataModelProvider_Write.cpp' \ - ':(exclude)src/app/codegen-data-model-provider/tests/EmberReadWriteOverride.cpp' \ + ':(exclude)src/data-model-providers/codegen/CodegenDataModelProvider_Write.cpp' \ + ':(exclude)src/data-model-providers/codegen/tests/EmberReadWriteOverride.cpp' \ + ':(exclude)src/app/dynamic_server/DynamicDispatcher.cpp' \ ':(exclude)src/app/util/attribute-table.cpp' \ ':(exclude)src/app/util/attribute-table.h' \ - ':(exclude)src/app/util/ember-compatibility-functions.cpp' \ ':(exclude)src/app/util/mock/CodegenEmberMocks.cpp' \ ':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' \ + ':(exclude)src/darwin/Framework/CHIP/ServerEndpoint/MTRIMDispatch.mm' \ ':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' \ && exit 1 || exit 0 diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index dae8a2b8ce0..03766a639f7 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:81 + image: ghcr.io/project-chip/chip-build-minimal:97 steps: - name: Checkout @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:81 + image: ghcr.io/project-chip/chip-build-minimal:97 steps: - name: Checkout diff --git a/.github/workflows/pr-validation.yaml b/.github/workflows/pr-validation.yaml new file mode 100644 index 00000000000..d34867f7acc --- /dev/null +++ b/.github/workflows/pr-validation.yaml @@ -0,0 +1,69 @@ +name: PR validity + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + check_testing_header: + runs-on: ubuntu-latest + steps: + - name: Check for `### Testing` section in PR + id: check-testing + continue-on-error: true + run: | + cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary" + ${{ github.event.pull_request.body }} + EndMarkerForPrSummary + + python -c 'import sys; pr_summary = open("/tmp/pr-summary.txt", "rt").read(); sys.exit(0 if "### Testing" in pr_summary else 1)' + + - name: Check for PR starting instructions + id: check-instructions + continue-on-error: true + run: | + cat >/tmp/pr-summary.txt << "EndMarkerForPrSummary" + ${{ github.event.pull_request.body }} + EndMarkerForPrSummary + + python -c 'import sys; pr_summary = open("/tmp/pr-summary.txt", "rt").read(); sys.exit(1 if "Make sure you delete these instructions" in pr_summary else 0)' + + # NOTE: comments disabled for now as separate permissions are required + # failing CI step may be sufficient to start (although it contains less information about why it failed) + + # - name: Add comment (missing instructions) + # if: steps.check-instructions.outcome == 'failure' + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # script: | + # github.rest.issues.createComment({ + # issue_number: context.issue.number, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: 'Please make sure to delete starter instructions from your PR summary and replace them with a descriptive summary.' + # }) + + - name: Fail if PR instructions were not deleted + if: steps.check-instructions.outcome == 'failure' + run: | + python -c 'import sys; print("PR instructions were not replaced"); sys.exit(1)' + + # - name: Add comment (missing testing) + # if: steps.check-testing.outcome == 'failure' + # uses: actions/github-script@v6 + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # script: | + # github.rest.issues.createComment({ + # issue_number: context.issue.number, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: 'Please add a `### Testing` section to your PR summary describing the testing performed. See https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#pull-requests' + # }) + + - name: Fail if `### Testing` section not in PR + if: steps.check-testing.outcome == 'failure' + run: | + python -c 'import sys; print("Testing section missing (test failed)"); sys.exit(1)' + diff --git a/.github/workflows/protocol_compatibility.yaml b/.github/workflows/protocol_compatibility.yaml index 6c8960072ec..05e875ee2d8 100644 --- a/.github/workflows/protocol_compatibility.yaml +++ b/.github/workflows/protocol_compatibility.yaml @@ -30,11 +30,11 @@ jobs: - name: Setup python uses: actions/setup-python@v5 with: - python-version: 3.11 + python-version: 3.12 - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install click coloredlogs lark + python3 -m venv venv + venv/bin/pip3 install click coloredlogs lark - name: Create old/new copies run: | mkdir -p out @@ -45,5 +45,4 @@ jobs: patch -p1 /tmp/test_env.yaml - echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die/chip-all-clusters-app" >> /tmp/test_env.yaml + echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app" >> /tmp/test_env.yaml echo "CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app" >> /tmp/test_env.yaml echo "ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app" >> /tmp/test_env.yaml echo "LIT_ICD_APP: out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app" >> /tmp/test_env.yaml echo "CHIP_MICROWAVE_OVEN_APP: out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app" >> /tmp/test_env.yaml echo "CHIP_RVC_APP: out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app" >> /tmp/test_env.yaml echo "NETWORK_MANAGEMENT_APP: out/linux-x64-network-manager-ipv6only-no-ble-no-wifi-tsan-clang-test/matter-network-manager-app" >> /tmp/test_env.yaml - echo "FABRIC_ADMIN_APP: out/linux-x64-fabric-admin-rpc-ipv6only-clang/fabric-admin" >> /tmp/test_env.yaml + echo "FABRIC_ADMIN_APP: out/linux-x64-fabric-admin-rpc-ipv6only-no-ble-no-wifi-clang/fabric-admin" >> /tmp/test_env.yaml echo "FABRIC_BRIDGE_APP: out/linux-x64-fabric-bridge-rpc-ipv6only-no-ble-no-wifi-clang/fabric-bridge-app" >> /tmp/test_env.yaml + echo "FABRIC_SYNC_APP: out/linux-x64-fabric-sync-ipv6only-no-ble-no-wifi-clang/fabric-sync" >> /tmp/test_env.yaml echo "LIGHTING_APP_NO_UNIQUE_ID: out/linux-x64-light-data-model-no-unique-id-ipv6only-no-ble-no-wifi-clang/chip-lighting-app" >> /tmp/test_env.yaml echo "TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml echo "TRACE_TEST_JSON: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml echo "TRACE_TEST_PERFETTO: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml + - name: Verify Testing Support + run: | + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/test_IDM_10_4.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/test_TC_ICDM_2_1_full_pics.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/test_TC_ICDM_2_1_min_pics.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/test_TC_SC_7_1.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestDecorators.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestChoiceConformanceSupport.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestConformanceSupport.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestConformanceTest.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestIdChecks.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestMatterTestingSupport.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestSpecParsingDeviceType.py' + scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestSpecParsingSupport.py' + - name: Run Tests run: | mkdir -p out/trace_data - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/controller/python/test/test_scripts/mobile-device-test.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/execute_python_tests.py --env-file /tmp/test_env.yaml --search-directory src/python_testing' - scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py --all-clusters out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die/chip-all-clusters-app' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestSpecParsingDeviceType.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceSupport.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceTest.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestChoiceConformanceSupport.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestMatterTestingSupport.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestSpecParsingSupport.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_TC_ICDM_2_1.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_IDM_10_4.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_TC_SC_7_1.py' - scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/TestDecorators.py' - + scripts/run_in_python_env.sh out/venv 'scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/controller/python/test/test_scripts/mobile-device-test.py' + scripts/run_in_python_env.sh out/venv 'src/python_testing/execute_python_tests.py --env-file /tmp/test_env.yaml --search-directory src/python_testing' + scripts/run_in_python_env.sh out/venv 'scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py --all-clusters out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app' - name: Uploading core files uses: actions/upload-artifact@v4 @@ -594,7 +606,7 @@ jobs: " - name: Run Tests run: | - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factory-reset --quiet --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} diff --git a/.github/workflows/third-party-check.yaml b/.github/workflows/third-party-check.yaml index beda0af41b0..ad072da7558 100644 --- a/.github/workflows/third-party-check.yaml +++ b/.github/workflows/third-party-check.yaml @@ -21,6 +21,7 @@ on: paths: - "third_party/**" - ".gitmodules" + types: [opened, synchronize, reopened, labeled, unlabeled] jobs: check-submodule-update-label: @@ -32,7 +33,7 @@ jobs: run: | echo This pull request attempts to update submodules without the changing-submodules-on-purpose label. Please apply that label if the changes are intentional, or remove those changes. exit 1 - - if: ${{ contains(github.event.pull_request.labels.*.name, 'changing-submodules-on-purpose') }} + - if: ${{ contains(github.event.pull_request.labels.*.name, 'changing-submodules-on-purpose') }} name: Success run: | echo PR looks good. diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index b51dfaa8fc2..08296b1a00b 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -74,7 +74,7 @@ jobs: *) ;; esac - scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" + scripts/build/gn_gen.sh --args="$GN_ARGS" - name: Run Build run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE" - name: Run Tests diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 483b9486d1b..f861a31d29d 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 717f8ca9562..51e4a78c8fb 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:81 + image: ghcr.io/project-chip/chip-build:97 defaults: run: shell: sh @@ -62,7 +62,7 @@ jobs: - name: Generate all run: ./scripts/run_in_build_env.sh scripts/tools/zap_regen_all.py - name: Generate script-maintained items (ERROR_CODES.md) - run: ./scripts/run_in_build_env.sh "scripts/error_table.py > docs/ERROR_CODES.md" + run: ./scripts/run_in_build_env.sh "scripts/error_table.py > docs/ids_and_codes/ERROR_CODES.md" - name: Ensure git works in current working directory run: git config --global --add safe.directory `pwd` - name: Check for uncommited changes diff --git a/.gitmodules b/.gitmodules index ed472c937c5..de46fa19be7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -208,22 +208,22 @@ [submodule "third_party/silabs/matter_support"] path = third_party/silabs/matter_support url = https://github.com/SiliconLabs/sdk_support.git - branch = main + branch = brd4350a_support platforms = silabs,silabs_docker [submodule "third_party/silabs/simplicity_sdk"] path = third_party/silabs/simplicity_sdk url = https://github.com/SiliconLabs/simplicity_sdk.git - branch = v2024.6.1-0 + branch = v2024.6.2 platforms = silabs [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 = 2.10.0 + branch = 2.10.3 platforms = silabs [submodule "third_party/silabs/wifi_sdk"] path = third_party/silabs/wifi_sdk url = https://github.com/SiliconLabs/wiseconnect.git - branch = v3.3.2 + branch = v3.3.3 platforms = silabs [submodule "editline"] path = third_party/editline/repo @@ -329,6 +329,10 @@ path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration url = https://github.com/Infineon/lwip-network-interface-integration.git platforms = infineon +[submodule "third_party/lwip/repo"] + path = third_party/lwip/repo + url = https://github.com/lwip-tcpip/lwip.git + excluded-platforms = darwin [submodule "third_party/abseil-cpp/src"] path = third_party/abseil-cpp/src url = https://github.com/abseil/abseil-cpp.git @@ -340,7 +344,7 @@ [submodule "third_party/googletest"] path = third_party/googletest url = https://github.com/google/googletest - platforms = linux,darwin + platforms = linux,android,darwin,tizen [submodule "third_party/re2/src"] path = third_party/re2/src url = https://github.com/google/re2.git diff --git a/.gn b/.gn index f844fd20e9b..ebd301ee7cf 100644 --- a/.gn +++ b/.gn @@ -35,8 +35,8 @@ default_args = { # Required for pw_unit_test pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" - pw_assert_BACKEND = "$dir_pw_assert_log" - pw_log_BACKEND = "$dir_pw_log_basic" + pw_assert_BACKEND = "//src/pw_backends/assert" + pw_log_BACKEND = "//src/pw_backends/log" # TODO: Make sure only unit tests link against this pw_build_LINK_DEPS = [ diff --git a/.pullapprove.yml b/.pullapprove.yml index 83d7b70b34e..81267526ee8 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -8,257 +8,250 @@ github_api_version: "shadow-cat-preview" ############################################################ overrides: - - if: "'hotfix' in labels" - status: success - explanation: "Hotfix label added, bypassing reviews" + - if: "'hotfix' in labels" + status: success + explanation: "Hotfix label added, bypassing reviews" - ############################################################ - # Draft PRs - ############################################################ - - if: "draft" - status: pending - explanation: "PR is draft, pending review" + ############################################################ + # Draft PRs + ############################################################ + - if: "draft" + status: pending + explanation: "PR is draft, pending review" - ############################################################ - # License Checks - ############################################################ - - if: "'*license/cla*' not in statuses.successful" - status: pending - explanation: "CLA must be agreed to by all contributors" + ############################################################ + # License Checks + ############################################################ + - if: "'*license/cla*' not in statuses.successful" + status: pending + explanation: "CLA must be agreed to by all contributors" - ############################################################ - # Conditions to Skip Review - ############################################################ - - if: "base.ref != 'master'" - status: success - explanation: "Review not required unless merging to master" + ############################################################ + # Conditions to Skip Review + ############################################################ + - if: "base.ref != 'master'" + status: success + explanation: "Review not required unless merging to master" - ############################################################ - # Required status checks - ############################################################ - - if: "'*restyle*' not in statuses.successful" - status: failure - explanation: "Style must be inline before reviewing can be complete" + ############################################################ + # Require Issues + ############################################################ + # disabling until we have PRs up to date + # - if: "'*issue*' not in statuses.successful" + # status: failure + # explanation: "An issue is required for all PRs" - ############################################################ - # Require Issues - ############################################################ - # disabling until we have PRs up to date - # - if: "'*issue*' not in statuses.successful" - # status: failure - # explanation: "An issue is required for all PRs" - - ############################################################ - # Fast tracking - ############################################################ - - if: "'fast track' in labels" - status: success - explanation: "PR has been fast tracked, bypassing reviews" + ############################################################ + # Fast tracking + ############################################################ + - if: "'fast track' in labels" + status: success + explanation: "PR has been fast tracked, bypassing reviews" ############################################################ # Notifications ############################################################ notifications: - ############################################################ - # New contributors - ############################################################ - - when: pull_request.opened - if: "author_association == 'FIRST_TIME_CONTRIBUTOR'" - comment: | - Hey @{{ author }}, thanks for the PR! The review will start once - the tests and CI checks have passed. If they don't, please review - the logs and try to fix the issues (ask for help if you can't - figure it out). A reviewer will be assigned once the tests are - passing and they'll walk you through getting the PR finished - and merged. + ############################################################ + # New contributors + ############################################################ + - when: pull_request.opened + if: "author_association == 'FIRST_TIME_CONTRIBUTOR'" + comment: | + Hey @{{ author }}, thanks for the PR! The review will start once + the tests and CI checks have passed. If they don't, please review + the logs and try to fix the issues (ask for help if you can't + figure it out). A reviewer will be assigned once the tests are + passing and they'll walk you through getting the PR finished + and merged. groups: - ############################################################ - # Shared Reviewer Groups - ############################################################ - shared-reviewers-amazon: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-amazon] - reviews: - request: 0 # Do not auto-add - shared-reviewers-apple: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-apple] - reviews: - request: 0 # Do not auto-add - shared-reviewers-bosch: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-bosch] - reviews: - request: 0 # Do not auto-add - shared-reviewers-comcast: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-comcast] - reviews: - request: 0 # Do not auto-add - shared-reviewers-dyson: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-dyson] - reviews: - request: 0 # Do not auto-add - shared-reviewers-espressif: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-espressif] - reviews: - request: 0 # Do not auto-add - shared-reviewers-google: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-google] - reviews: - request: 0 # Do not auto-add - shared-reviewers-grundfos: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-grundfos] - reviews: - request: 0 # Do not auto-add - shared-reviewers-irobot: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-irobot] - reviews: - request: 0 # Do not auto-add - shared-reviewers-lg: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-lg] - reviews: - request: 0 # Do not auto-add - shared-reviewers-logitech: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-logitech] - reviews: - request: 0 # Requested to be only on demand - shared-reviewers-nordic: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-nordic] - reviews: - request: 0 # Do not auto-add - shared-reviewers-nxp: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-nxp] - reviews: - request: 0 # Do not auto-add - shared-reviewers-samsung: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-samsung] - reviews: - request: 0 # Do not auto-add - shared-reviewers-eve: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-eve] - reviews: - request: 0 # Do not auto-add - # shared-reviewers-signify disabled for now, because the reviewers-signify - # team is empty and pullapprove seems to mis-handle that badly and treats - # _all_ reviewers as being in this group. - # - # See https://github.com/dropseed/pullapprove/issues/71 - # - # shared-reviewers-signify: - # type: optional - # conditions: - # - files.include('*') - # reviewers: - # teams: [reviewers-signify] - # reviews: - # request: 0 # Do not auto-add - shared-reviewers-silabs: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-silabs] - reviews: - request: 0 # Do not auto-add - shared-reviewers-somfy: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-somfy] - reviews: - request: 0 # Do not auto-add - shared-reviewers-tcl: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-tcl] - reviews: - request: 0 # Do not auto-add - shared-reviewers-qorvo: - type: optional - conditions: - - files.include('*') - reviewers: - teams: [reviewers-qorvo] - reviews: - request: 0 # Do not auto-add + ############################################################ + # Shared Reviewer Groups + ############################################################ + shared-reviewers-amazon: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-amazon] + reviews: + request: 0 # Do not auto-add + shared-reviewers-apple: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-apple] + reviews: + request: 0 # Do not auto-add + shared-reviewers-bosch: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-bosch] + reviews: + request: 0 # Do not auto-add + shared-reviewers-comcast: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-comcast] + reviews: + request: 0 # Do not auto-add + shared-reviewers-dyson: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-dyson] + reviews: + request: 0 # Do not auto-add + shared-reviewers-espressif: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-espressif] + reviews: + request: 0 # Do not auto-add + shared-reviewers-google: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-google] + reviews: + request: 0 # Do not auto-add + shared-reviewers-grundfos: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-grundfos] + reviews: + request: 0 # Do not auto-add + shared-reviewers-irobot: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-irobot] + reviews: + request: 0 # Do not auto-add + shared-reviewers-lg: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-lg] + reviews: + request: 0 # Do not auto-add + shared-reviewers-logitech: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-logitech] + reviews: + request: 0 # Requested to be only on demand + shared-reviewers-nordic: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-nordic] + reviews: + request: 0 # Do not auto-add + shared-reviewers-nxp: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-nxp] + reviews: + request: 0 # Do not auto-add + shared-reviewers-samsung: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-samsung] + reviews: + request: 0 # Do not auto-add + shared-reviewers-eve: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-eve] + reviews: + request: 0 # Do not auto-add + # shared-reviewers-signify disabled for now, because the reviewers-signify + # team is empty and pullapprove seems to mis-handle that badly and treats + # _all_ reviewers as being in this group. + # + # See https://github.com/dropseed/pullapprove/issues/71 + # + # shared-reviewers-signify: + # type: optional + # conditions: + # - files.include('*') + # reviewers: + # teams: [reviewers-signify] + # reviews: + # request: 0 # Do not auto-add + shared-reviewers-silabs: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-silabs] + reviews: + request: 0 # Do not auto-add + shared-reviewers-somfy: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-somfy] + reviews: + request: 0 # Do not auto-add + shared-reviewers-tcl: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-tcl] + reviews: + request: 0 # Do not auto-add + shared-reviewers-qorvo: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-qorvo] + reviews: + request: 0 # Do not auto-add - ############################################################ - # Base Required Reviewers - ############################################################ - required-reviewers: - description: > - [Required - Reviewers](https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#review-requirements) - This is the main group of required reviews for general pull - requests. - type: required - requirements: - - len(groups.approved.include('shared-reviewers-*')) >= 2 - reviews: - required: 0 - labels: - approved: "review - approved" - pending: "review - pending" - rejected: "review - changed requested" + ############################################################ + # Base Required Reviewers + ############################################################ + required-reviewers: + description: > + [Required + Reviewers](https://github.com/project-chip/connectedhomeip/blob/master/CONTRIBUTING.md#review-requirements) + This is the main group of required reviews for general pull + requests. + type: required + requirements: + - len(groups.approved.include('shared-reviewers-*')) >= 2 + reviews: + required: 0 + labels: + approved: "review - approved" + pending: "review - pending" + rejected: "review - changed requested" diff --git a/.restyled.yaml b/.restyled.yaml index c201729d30e..446dad740b9 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -83,9 +83,7 @@ exclude: - "scripts/setup/bootstrap.sh" # tries to quote loop variable - "integrations/docker/build-all.sh" # tries to quote loop variable - "scripts/setup/pigweed.json" # TODO(#29547). This file is temporary copy from pigweed repo that has minor edits. No restyle help in diff. - - "docs/ERROR_CODES.md" # generated by scripts, not easy to align tables - - "docs/zap_clusters.md" # generated by scripts, not easy to align tables - - "docs/spec_clusters.md" # generated by scripts, not easy to align tables + - "docs/ids_and_codes/**" # generated by scripts, not easy to align tables - "docs/testing/yaml_pseudocluster.md" # generated by scripts, restyler makes the tables render improperly - "docs/testing/yaml_schema.md" # generated by scripts, restyler makes the tables render improperly diff --git a/.spellcheck.yml b/.spellcheck.yml index 7313f64ebd6..36461334c88 100644 --- a/.spellcheck.yml +++ b/.spellcheck.yml @@ -65,7 +65,7 @@ matrix: # converts markdown to HTML - pyspelling.filters.markdown: sources: - - '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md | !docs/testing/python.md | !docs/testing/ChipDeviceCtrlAPI.md' + - '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ids_and_codes/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md|!docs/testing/python.md|!docs/testing/ChipDeviceCtrlAPI.md|!docs/issue_triage.md' aspell: ignore-case: true camel-case: true diff --git a/.vscode/launch.json b/.vscode/launch.json index 898defc9c60..97ba95d77f0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -34,6 +34,25 @@ "args": [], "cwd": "${workspaceFolder}" }, + + { + "name": "Run pw FuzzTest (Linux x64) UnitTest Mode", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/out/${input:outPWFuzzTestLinux}", + "cwd": "${workspaceFolder}" + }, + + { + "name": "Run pw FuzzTest (Linux x64) Continuous Fuzzing Mode", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/out/${input:outPWFuzzTestLinux}", + "args": ["-fuzz=${input:fuzzTestName}"], + "cwd": "${workspaceFolder}", + "preLaunchTask": "" + }, + { "name": "QRCode Tests", "type": "cppdbg", @@ -419,6 +438,14 @@ "cwd": "${workspaceFolder}" }, + { + "name": "Fabric Sync (Linux)", + "type": "lldb", + "request": "launch", + "program": "${workspaceFolder}/out/debug/standalone/fabric-sync", + "cwd": "${workspaceFolder}" + }, + { "name": "OTA Requestor App (Linux)", "type": "lldb", @@ -520,6 +547,24 @@ "description": "Select the test to run" } }, + { + "type": "command", + "id": "outPWFuzzTestLinux", + "command": "shellCommand.execute", + "args": { + "command": "find ${workspaceFolder}/out/linux-x64-*/chip_pw_fuzztest/tests -type f -executable |sort |sed 's$${workspaceFolder}/out/$$'", + "description": "Select the FuzzTest to run" + } + }, + { + "id": "fuzzTestName", + "type": "command", + "command": "shellCommand.execute", + "args": { + "command": "./out/${input:outPWFuzzTestLinux} --list_fuzz_tests | grep 'Fuzz test:' | awk -F ': ' '{print $2}'", + "description": "Select the specific FuzzTest to fuzz continuously" + } + }, { "type": "pickString", "id": "mbedDebugProfile", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a0ae1b95fe4..ff584f221e6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -157,6 +157,30 @@ ] } }, + { + "label": "Build EFR32 Unit Tests and Test Runner", + "type": "shell", + "command": "source scripts/activate.sh; scripts/build/build_examples.py --target efr32-${input:efr32Board}-unit-test build; scripts/build/build_examples.py --target linux-x64-efr32-test-runner build; pip3 install out/linux-x64-efr32-test-runner/chip_pw_test_runner_wheels/*.whl --force-reinstall", + "problemMatcher": [] + }, + { + "label": "Rebuild EFR32 Unit Tests and Test Runner", + "type": "shell", + "command": "source scripts/activate.sh; rm -rf out/efr32-brd*-unit-test out/linux-x64-efr32-test-runner; scripts/build/build_examples.py --target efr32-${input:efr32Board}-unit-test build; scripts/build/build_examples.py --target linux-x64-efr32-test-runner build; pip3 install out/linux-x64-efr32-test-runner/chip_pw_test_runner_wheels/*.whl --force-reinstall", + "problemMatcher": [] + }, + { + "label": "Clean EFR32 Unit Tests and Test Runner", + "type": "shell", + "command": "rm -rf out/efr32-brd*-unit-test out/linux-x64-efr32-test-runner", + "problemMatcher": [] + }, + { + "label": "Run EFR32 Unit Tests", + "type": "shell", + "command": "source scripts/activate.sh; python -m src.test_driver.efr32.py.pw_test_runner.pw_test_runner -d /dev/ttyACM1 -f out/efr32-brd2703a-unit-test/tests -o out.log", + "problemMatcher": [] + }, { "label": "Flash EFR32 board", "type": "shell", @@ -579,8 +603,6 @@ "esp32-devkitc-temperature-measurement", "esp32-m5stack-all-clusters", "esp32-m5stack-all-clusters-ipv6only", - "esp32-m5stack-all-clusters-rpc", - "esp32-m5stack-all-clusters-rpc-ipv6only", "infineon-psoc6-all-clusters", "infineon-psoc6-lock", "infineon-psoc6-light", @@ -648,6 +670,27 @@ "tizen-arm-light" ] }, + { + "type": "pickString", + "id": "efr32Board", + "description": "Which board", + "options": [ + "brd2704b", + "brd4316a", + "brd4317a", + "brd4318a", + "brd4319a", + "brd4186a", + "brd4187a", + "brd2601b", + "brd4187c", + "brd4186c", + "brd2703a", + "brd4338a", + "brd2605a", + "brd4343a" + ] + }, { "type": "promptString", "id": "tizenTargetDeviceAddress", diff --git a/BUILD.gn b/BUILD.gn index e05f14312d8..a777fa84b32 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -70,6 +70,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { "${chip_root}/src/lib/core/tests:fuzz-tlv-reader-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", "${chip_root}/src/lib/dnssd/minimal_mdns/tests:fuzz-minmdns-packet-parsing-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", "${chip_root}/src/lib/format/tests:fuzz-payload-decoder-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", + "${chip_root}/src/protocols/secure_channel/tests:fuzz-PASE-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", "${chip_root}/src/setup_payload/tests:fuzz-setup-payload-base38-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)", ] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a71219f5606..68e28dae951 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -160,6 +160,99 @@ This will trigger the continuous-integration checks. You can view the results in the respective services. Note that the integration checks will report failures on occasion. +#### Pull requests + +Aim to make pull requests easy to read both when viewed in a list (title only) +as well as clear in content within the description. + +##### Title formatting + +Describe the change as a one-line in some descriptive manner. Add sufficient +context for a reader to understand what is improved. If platform-specific +consider adding the platform as a prefix, like `[Android]` or any other tags may +be useful for quick filtering like `[TC-ABC-1.2]` to tag test changes. + +Examples of descriptive titles: + +- `[Silabs] Fix compile of SiWx917 if LED and BUTTON are disabled` +- `[Telink] Update build Dockerfile with new Zeprhy SHA: c05c4.....` +- `General Commissioning Cluster: use AttributeAccessInterface/CommandHandlerInterface for processing` +- `Scenes Management/CopyScene: set access as manage instead of default to match the spec` +- `Fix build errors due to ChipDeviceEvent default constructor not being available` +- `Fix crash during DNSSD processing due to malformed packet` +- `[NRF] Fix crash due to stack overflow during logging for PW-RPC builds` +- `[TC-ABC-2.3] added new python test case based on test plan` +- `[TC-ABC] migrate tests from yaml to python` + +Examples of titles that are vague (not clear what the change is, one would need +to open the pull request for details or open additional issue in GitHub) + +- `Work on issue 1234` +- `Fix android JniTypeWrappers` +- `Fix segfault in BLE` +- `Fix TC-ABC-1.2` +- `Update Readme` + +##### Summary contents + +Ensure that there is sufficient detail in issue summaries to make the content of +the PR clear: + +- a `TLDR` of the change content. This is a judgment call on details, + generally you should include a what was changed and why. The change is + trivial/short, this can be very short (i.e. "fixed typos" is perfectly + acceptable, however if changing 100-1000s of line, the areas of changes + should be explained) +- If a crash/error is fixed, explain the root cause and if the fix is not + obvious (again, judgment call), explain why the given approach was taken. +- Help the reviewer out with any notable information (specific platform + issues, extra thoughts or requests for feedback or gotchas on tricky code, + followup work or PR dependencies) +- TIP: use the syntax of `Fixes #....` to mark issues completed on PR merge or + use `#...` to reference issues that are addressed. +- TIP: prefer adding some brief description (especially about the content of + the changes) instead of just referencing an issue (helps reviewers get + context faster without extra clicks). + +##### Testing section + +All Pull Requests **MUST** contain a `#### Testing` section that describes how +the pull request was tested. Ideally every test should have automated testing, +however for platform specific changes or hardware-specific issues we may not be +able to have such tests (e.g. we may not BLE or NFC capability in CI). As such, +manual testing is acceptable, however the description has to be detailed +intentionally to avoid a bias towards marking pull requests as "manually tested" +out of convenience. + +- Automated testing + + **AWESOME**. You can say "unit tests added/updated" or "Integration tests + updated to cover functionality" or "existing tests already cover this" (make + sure they do. Integration tests often only cover happy paths). + + Add any notes on not covered things. It is a judgment call on how much can + be covered as 100% sounds great however not always possible. + +- Manual testing + + Describe why automated testing is impossible in the current CI environment + or difficult to add. If adding later, reference the issue to add automation + and a timeline for adding such automation. + + Describe in **DETAIL** how manual testing was done: what environment, what + builds were used (`build-example` names are ok such as + `flashed qpg-qpg6105-light` and `used linux-x64-chip-tool-clang`). Describe + commands ran (often chip-tool) and physical interaction and what was + observed. + +- Trivial/obvious change + + In rare cases the change is trivial (e.g. fixing a typo in a `Readme.md`). + Scripts still require a `#### Testing` section however you can be brief like + `N/A` or `checked new URL opens`. Note that these cases are rare - e.g. + fixing a typo in an ID still requires some description on how you checked + that the new ID takes effect. + ### Review Requirements #### Documentation Best Practices diff --git a/build/chip/chip_test_suite.gni b/build/chip/chip_test_suite.gni index de6b7c16848..553b963a741 100644 --- a/build/chip/chip_test_suite.gni +++ b/build/chip/chip_test_suite.gni @@ -14,6 +14,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") +import("//build_overrides/googletest.gni") import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/tests.gni") @@ -92,6 +93,10 @@ template("chip_test_suite") { } else { public_deps += [ "${chip_root}/src/platform/logging:default" ] } + + if (chip_device_platform == "esp32") { + complete_static_lib = true + } } # Build a source_set or a flashable executable for each individual unit test source, which also includes the common files. @@ -120,6 +125,10 @@ template("chip_test_suite") { # Link to the common lib for this suite so we get its `sources`. public_deps += [ ":${_suite_name}.lib" ] + if (pw_unit_test_BACKEND == "$dir_pw_unit_test:googletest") { + test_main = "$dir_pigweed/third_party/googletest:gmock_main" + } + # Set variables that the platform executable may need. if (test_executable_output_name != "") { output_name = test_executable_output_name + _test_name + diff --git a/build/chip/esp32/esp32_codegen.cmake b/build/chip/esp32/esp32_codegen.cmake deleted file mode 100644 index 7febb089875..00000000000 --- a/build/chip/esp32/esp32_codegen.cmake +++ /dev/null @@ -1,85 +0,0 @@ -# -# 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. -# - -macro(chip_app_component_codegen IDL_NAME) - include("${CHIP_ROOT}/build/chip/chip_codegen.cmake") - include("${CHIP_ROOT}/src/app/codegen-data-model-provider/model.cmake") - - # The IDF build system performs a two-pass expansion to determine - # component expansion. The first pass runs in script-mode - # to determine idf_component_register REQUIRES and PRIV_REQUIRES. - # - # We can only set up code generation during the 2nd pass - # - # see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html - if (NOT CMAKE_BUILD_EARLY_EXPANSION) - - chip_codegen(app-codegen - INPUT "${IDL_NAME}" - GENERATOR "cpp-app" - OUTPUTS - "app/PluginApplicationCallbacks.h" - "app/callback-stub.cpp" - "app/cluster-init-callback.cpp" - OUTPUT_PATH APP_GEN_DIR - OUTPUT_FILES APP_GEN_FILES - ) - - add_dependencies(${COMPONENT_LIB} app-codegen) - target_include_directories(${COMPONENT_LIB} PUBLIC "${APP_GEN_DIR}") - target_sources(${COMPONENT_LIB} PRIVATE ${APP_GEN_FILES}) - endif() -endmacro() - -macro(chip_app_component_zapgen ZAP_NAME) - include("${CHIP_ROOT}/build/chip/chip_codegen.cmake") - - # The IDF build system performs a two-pass expansion to determine - # component expansion. The first pass runs in script-mode - # to determine idf_component_register REQUIRES and PRIV_REQUIRES. - # - # We can only set up code generation during the 2nd pass - # - # see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html - if (NOT CMAKE_BUILD_EARLY_EXPANSION) - - chip_zapgen(app-zapgen - INPUT "${ZAP_NAME}" - GENERATOR "app-templates" - OUTPUTS - "zap-generated/access.h" - "zap-generated/endpoint_config.h" - "zap-generated/gen_config.h" - "zap-generated/IMClusterCommandHandler.cpp" - OUTPUT_PATH APP_TEMPLATE_GEN_DIR - OUTPUT_FILES APP_TEMPLATE_GEN_FILES - ) - - add_dependencies(${COMPONENT_LIB} app-zapgen) - target_include_directories(${COMPONENT_LIB} PUBLIC "${APP_TEMPLATE_GEN_DIR}") - target_sources(${COMPONENT_LIB} PRIVATE ${APP_TEMPLATE_GEN_FILES}) - - # When data model interface is used, provide a default code-generation data model as - # part of zapgen. See `chip_data_model.cmake` for similar logic - set(CHIP_DATA_MODEL_INTERFACE "disabled" CACHE STRING "Data model interface option to use: enabled or disabled") - - if ("${CHIP_DATA_MODEL_INTERFACE}" STREQUAL "enabled") - target_sources(${COMPONENT_LIB} PRIVATE ${CODEGEN_DATA_MODEL_SOURCES}) - endif() - - endif() -endmacro() diff --git a/build/chip/tests.gni b/build/chip/tests.gni index 0c2c742d646..57d0311694f 100755 --- a/build/chip/tests.gni +++ b/build/chip/tests.gni @@ -26,6 +26,10 @@ declare_args() { declare_args() { # Enable building tests. chip_build_tests = current_os != "freertos" + + # Enabling useful support functions when building using GoogleTest framework (used in unit tests and pw_fuzzer FuzzTests) + # For unit tests: this should only be enabled through build_examples.py, see PR #36268 + chip_build_tests_googletest = false } declare_args() { diff --git a/build/toolchain/pw_fuzzer/BUILD.gn b/build/toolchain/pw_fuzzer/BUILD.gn index 385e57cc81b..b5a751bc98a 100644 --- a/build/toolchain/pw_fuzzer/BUILD.gn +++ b/build/toolchain/pw_fuzzer/BUILD.gn @@ -13,6 +13,7 @@ # limitations under the License. import("//build_overrides/build.gni") +import("//build_overrides/googletest.gni") import("//build_overrides/pigweed.gni") import("$dir_pigweed/targets/host/target_toolchains.gni") @@ -61,7 +62,10 @@ gcc_toolchain("chip_pw_fuzztest") { dir_pw_third_party_abseil_cpp = "//third_party/abseil-cpp/src" dir_pw_third_party_fuzztest = "//third_party/fuzztest" - dir_pw_third_party_googletest = "//third_party/googletest" + dir_pw_third_party_googletest = "$dir_googletest" + + # Since pw_fuzzer uses GoogleTest, activating this allows us to benefit from supporting functions + chip_build_tests_googletest = true # TODO: Seems that re2 support within FuzzTest was deprecated, keeping it defined is triggering warning # Remove if re2 is indeed not needed diff --git a/build_overrides/efr32_sdk.gni b/build_overrides/efr32_sdk.gni index 4a7344b4c7e..fd5e7ce094b 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/silabs" + silabs_sdk_build_root = "//third_party/silabs" } diff --git a/build_overrides/googletest.gni b/build_overrides/googletest.gni new file mode 100644 index 00000000000..c06354b399c --- /dev/null +++ b/build_overrides/googletest.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +declare_args() { + # Location of the GoogleTest repository. + dir_googletest = "//third_party/googletest" +} diff --git a/config/ameba/chip.cmake b/config/ameba/chip.cmake index 47444055f66..9cd2ab5511b 100644 --- a/config/ameba/chip.cmake +++ b/config/ameba/chip.cmake @@ -32,6 +32,7 @@ list( -DMBEDTLS_CONFIG_FILE= -D_POSIX_REALTIME_SIGNALS -DCHIP_SHELL_MAX_TOKENS=11 + -DCONFIG_ENABLE_AMEBA_SNTP=1 ) list( diff --git a/config/android/CHIPProjectConfig.h b/config/android/CHIPProjectConfig.h index 5b55f3ba744..fd8c7abaa8f 100644 --- a/config/android/CHIPProjectConfig.h +++ b/config/android/CHIPProjectConfig.h @@ -26,18 +26,11 @@ #ifndef CHIPPROJECTCONFIG_H #define CHIPPROJECTCONFIG_H -// Enable UDP listening on demand in the CHIPDeviceController -#define CHIP_CONFIG_DEVICE_CONTROLLER_DEMAND_ENABLE_UDP 1 - #define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0 // Uncomment this for a large Tunnel MTU. -//#define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000) +// #define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000) #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 300 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - -#define CHIP_CONFIG_MAX_SOFTWARE_VERSION_LENGTH 128 - #endif /* CHIPPROJECTCONFIG_H */ diff --git a/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni b/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni index 2cfbc034e87..86c20ccc72c 100644 --- a/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni +++ b/config/bouffalolab/common/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "${chip_root}/examples/platform/bouffalolab/common/rpc/pw_sys_io:pw_sys_io" diff --git a/config/bouffalolab/toolchain/riscv_toolchain.gni b/config/bouffalolab/toolchain/riscv_toolchain.gni index db46fc1a98f..9035a6c0b48 100644 --- a/config/bouffalolab/toolchain/riscv_toolchain.gni +++ b/config/bouffalolab/toolchain/riscv_toolchain.gni @@ -17,13 +17,18 @@ import("//build_overrides/chip.gni") import("//build_overrides/bouffalolab_iot_sdk.gni") import("${build_root}/toolchain/gcc_toolchain.gni") +import("${chip_root}/src/platform/device.gni") template("riscv_toolchain") { gcc_toolchain(target_name) { _tool_name_root = "" if ("linux" == host_os) { - _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-" + if (chip_device_platform == "bl616") { + _tool_name_root = "${bouffalolab_sdk_root}/toolchain/t-head-riscv/gcc_t-head_v2.6.1/bin/riscv64-unknown-elf-" + } else { + _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Linux/bin/riscv64-unknown-elf-" + } } else if ("mac" == host_os || "darwin" == host_os) { _tool_name_root = "${bouffalolab_sdk_root}/toolchain/riscv/Darwin/bin/riscv64-unknown-elf-" } diff --git a/config/common/cmake/chip_gn_args.cmake b/config/common/cmake/chip_gn_args.cmake index 8fde49c3438..7d86d1fb433 100644 --- a/config/common/cmake/chip_gn_args.cmake +++ b/config/common/cmake/chip_gn_args.cmake @@ -171,7 +171,6 @@ macro(matter_common_gn_args) LIB_PW_RPC DEVICE_INFO_EXAMPLE_PROVIDER PROJECT_CONFIG - DATA_MODEL_INTERFACE ) set(multiValueArgs PROJECT_CONFIG_INC_DIR @@ -204,10 +203,6 @@ macro(matter_common_gn_args) matter_add_gn_arg_bool ("chip_build_example_providers" ${ARG_DEVICE_INFO_EXAMPLE_PROVIDER}) endif() # ARG_DEVICE_INFO_EXAMPLE_PROVIDER - if (ARG_DATA_MODEL_INTERFACE) - matter_add_gn_arg_string("chip_use_data_model_interface" "${ARG_DATA_MODEL_INTERFACE}") - endif() - if (ARG_PROJECT_CONFIG) get_filename_component(PROJECT_CONFIG ${ARG_PROJECT_CONFIG} diff --git a/config/darwin/args.gni b/config/darwin/args.gni new file mode 100644 index 00000000000..0e973188404 --- /dev/null +++ b/config/darwin/args.gni @@ -0,0 +1,22 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") + +chip_device_platform = "darwin" + +chip_project_config_include = "" +chip_system_project_config_include = "" + +pw_build_PIP_CONSTRAINTS = [ "${chip_root}/scripts/setup/constraints.txt" ] diff --git a/config/efr32/lib/pw_rpc/pw_rpc.gni b/config/efr32/lib/pw_rpc/pw_rpc.gni index 101112c12da..ac5e3831da3 100644 --- a/config/efr32/lib/pw_rpc/pw_rpc.gni +++ b/config/efr32/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" pw_sys_io_BACKEND = "${chip_root}/examples/platform/silabs/pw_sys_io:pw_sys_io_silabs" diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index f7685cf760a..71dca52bc03 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -31,13 +31,7 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/ota-image.cmake) -set(CHIP_REQUIRE_COMPONENTS esp_eth freertos lwip bt mbedtls fatfs app_update console openthread nvs_flash spi_flash) - -set(CHIP_DATA_MODEL_INTERFACE "disabled" CACHE STRING "Data model interface option to use: enabled or disabled") - -if(NOT "${IDF_TARGET}" STREQUAL "esp32h2") - list(APPEND CHIP_REQUIRE_COMPONENTS mdns) -endif() +set(CHIP_REQUIRE_COMPONENTS esp_eth freertos lwip bt mbedtls fatfs app_update console openthread nvs_flash spi_flash mdns) if (NOT CMAKE_BUILD_EARLY_EXPANSION) if (CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE) @@ -66,12 +60,6 @@ macro(chip_gn_arg_bool arg boolean) endif() endmacro() -if ("${CHIP_DATA_MODEL_INTERFACE}" STREQUAL "enabled") - chip_gn_arg_append("chip_use_data_model_interface" "\"enabled\"") -else() - chip_gn_arg_append("chip_use_data_model_interface" "\"disabled\"") -endif() - # ESP-IDF lets user set software version string by two ways: # 1. Project's CMakeLists.txt file and 2. Config option # It depends on CONFIG_APP_PROJECT_VER_FROM_CONFIG option @@ -143,9 +131,6 @@ endif() if(CONFIG_ENABLE_ICD_SERVER) chip_gn_arg_append("chip_enable_icd_server" "true") - if(CONFIG_ICD_ENFORCE_SIT_SLOW_POLL_LIMIT) - chip_gn_arg_append("icd_enforce_sit_slow_poll_limit" "true") - endif() if(CONFIG_ICD_REPORT_ON_ACTIVE_MODE) chip_gn_arg_append("chip_icd_report_on_active_mode" "true") endif() @@ -321,6 +306,14 @@ if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE) target_include_directories(${COMPONENT_LIB} INTERFACE "${CHIP_ROOT}/src/tracing/esp32_trace/include") endif() +if (CONFIG_CHIP_DEVICE_ENABLE_DYNAMIC_SERVER) + chip_gn_arg_append("chip_build_controller_dynamic_server" "true") +endif() + +if (CONFIG_ICD_MAX_NOTIFICATION_SUBSCRIBERS) + chip_gn_arg_append("icd_max_notification_subscribers" ${CONFIG_ICD_MAX_NOTIFICATION_SUBSCRIBERS}) +endif() + set(args_gn_input "${CMAKE_CURRENT_BINARY_DIR}/args.gn.in") file(GENERATE OUTPUT "${args_gn_input}" CONTENT "${chip_gn_args}") @@ -396,7 +389,6 @@ externalproject_add( BUILD_COMMAND ninja "esp32" INSTALL_COMMAND "" BUILD_BYPRODUCTS ${chip_libraries} - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} DEPENDS args_gn BUILD_ALWAYS 1 ) @@ -428,155 +420,28 @@ target_include_directories(${COMPONENT_LIB} INTERFACE "${CHIP_ROOT}/config/esp32/${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}/../../" ) -idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB) - -idf_build_get_property(idf_target IDF_TARGET) -set(target_name "${idf_target}") - -if(CONFIG_BT_ENABLED) - idf_component_get_property(bt_lib bt COMPONENT_LIB) - if((target_name STREQUAL "esp32h2") OR (target_name STREQUAL "esp32c2") OR (target_name STREQUAL "esp32c6")) - idf_component_get_property(bt_dir bt COMPONENT_DIR) - list(APPEND chip_libraries $) - list(APPEND chip_libraries "${bt_dir}/controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a") - else() - list(APPEND chip_libraries $ -lbtdm_app) - endif() -endif() - -if (CONFIG_ENABLE_CHIP_SHELL) - idf_component_get_property(console_lib console COMPONENT_LIB) - list(APPEND chip_libraries $) -endif() - -if(CONFIG_OPENTHREAD_ENABLED) - idf_component_get_property(openthread_lib openthread COMPONENT_LIB) - list(APPEND chip_libraries $) - if (CONFIG_IEEE802154_ENABLED) - idf_component_get_property(ieee802154_lib ieee802154 COMPONENT_LIB) - list(APPEND chip_libraries $) - endif() -endif() - -if(NOT CONFIG_USE_MINIMAL_MDNS) - idf_build_get_property(build_components BUILD_COMPONENTS) - # For IDF v5.x, the mdns component was moved to idf_managed_components. - # We should use 'espressif__mdns' for 'idf_component_get_property'. - if("espressif__mdns" IN_LIST build_components) - idf_component_get_property(mdns_lib espressif__mdns COMPONENT_LIB) - list(APPEND chip_libraries $) - elseif("mdns" IN_LIST build_components) - idf_component_get_property(mdns_lib mdns COMPONENT_LIB) - list(APPEND chip_libraries $) - endif() -endif() - -if(CONFIG_OPENTHREAD_BORDER_ROUTER) - idf_component_get_property(rcp_update_lib espressif__esp_rcp_update COMPONENT_LIB) - list(APPEND chip_libraries $) - idf_component_get_property(serial_flasher_lib espressif__esp-serial-flasher COMPONENT_LIB) - list(APPEND chip_libraries $) -endif() - -if (CONFIG_ENABLE_ENCRYPTED_OTA) - idf_component_get_property(esp_encrypted_img_lib espressif__esp_encrypted_img COMPONENT_LIB) - list(APPEND chip_libraries $) -endif() - -# Let user set EXECUTABLE_COMPONENT_NAME and defaults to main if not specified -if (NOT EXECUTABLE_COMPONENT_NAME) - set(EXECUTABLE_COMPONENT_NAME "main") +set(matter_requires lwip freertos console bt) +idf_build_get_property(build_components BUILD_COMPONENTS) +if("espressif__mdns" IN_LIST build_components) + list(APPEND matter_requires espressif__mdns) +elseif("mdns" IN_LIST build_components) + list(APPEND matter_requires mdns) endif() -if (CONFIG_ENABLE_DELTA_OTA) - idf_component_get_property(esp_delta_ota_lib espressif__esp_delta_ota COMPONENT_LIB) - list(APPEND chip_libraries $) +if (CONFIG_OPENTHREAD_BORDER_ROUTER) + list(APPEND matter_requires espressif__esp_rcp_update) endif() -idf_component_get_property(main_lib ${EXECUTABLE_COMPONENT_NAME} COMPONENT_LIB) -list(APPEND chip_libraries $) - if (CONFIG_SEC_CERT_DAC_PROVIDER) - idf_component_get_property(esp32_secure_cert_mgr_lib espressif__esp_secure_cert_mgr COMPONENT_LIB) - list(APPEND chip_libraries $) -endif() - -if (CONFIG_ENABLE_ESP_INSIGHTS_TRACE) - idf_build_get_property(build_components BUILD_COMPONENTS) - # esp_insights can be used as an independent component or through component manager so, - # We should check and add the right component. - if("espressif__esp_insights" IN_LIST build_components) - idf_component_get_property(esp_insights_lib espressif__esp_insights COMPONENT_LIB) - elseif("esp_insights" IN_LIST build_components) - idf_component_get_property(esp_insights_lib esp_insights COMPONENT_LIB) - endif() - - list(APPEND chip_libraries $) -endif() - -idf_component_get_property(lwip_lib lwip COMPONENT_LIB) -list(APPEND chip_libraries $) - - -if (CONFIG_ESP32_WIFI_ENABLED) - idf_component_get_property(esp_wifi_lib esp_wifi COMPONENT_LIB) - idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR) - list(APPEND chip_libraries $) - if (CONFIG_IDF_TARGET_ESP32C2) - set(blobs core net80211 pp) - else() - set(blobs core mesh net80211 pp) - endif() - - foreach(blob ${blobs}) - list(APPEND chip_libraries "${esp_wifi_dir}/lib/${target_name}/lib${blob}.a") - endforeach() - - idf_component_get_property(wpa_supplicant_lib wpa_supplicant COMPONENT_LIB) - list(APPEND chip_libraries $) -endif() - -if (CONFIG_ETH_ENABLED) - idf_component_get_property(esp_eth_lib esp_eth COMPONENT_LIB) - list(APPEND chip_libraries $) -endif() - -idf_component_get_property(esp_netif_lib esp_netif COMPONENT_LIB) -list(APPEND chip_libraries $) - -idf_component_get_property(esp_hw_support_lib esp_hw_support COMPONENT_LIB) -list(APPEND chip_libraries $) - -idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB) -idf_component_get_property(esp_phy_dir esp_phy COMPONENT_DIR) -list(APPEND chip_libraries $) - -if (CONFIG_IDF_TARGET_ESP32) - set(phy_blobs phy rtc) -elseif (CONFIG_IDF_TARGET_ESP32S2) - set(phy_blobs phy) -else() - set(phy_blobs phy btbb) + list(APPEND matter_requires espressif__esp_secure_cert_mgr) endif() -foreach(phy_blob ${phy_blobs}) - list(APPEND chip_libraries "${esp_phy_dir}/lib/${target_name}/lib${phy_blob}.a") -endforeach() -set(components_to_link esp_event hal esp_system soc efuse vfs driver esp_coex freertos esp_timer) -idf_build_get_property(build_components BUILD_COMPONENTS) -foreach(component ${components_to_link}) - # Some of the components are not present in IDF v4.x - # So, Check if the component is in the list of build components - if("${component}" IN_LIST build_components) - idf_component_get_property(lib_name ${component} COMPONENT_LIB) - list(APPEND chip_libraries $) - endif() -endforeach() +add_prebuilt_library(matterlib "${CMAKE_CURRENT_BINARY_DIR}/lib/libCHIP.a" + REQUIRES ${matter_requires}) target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group ${chip_libraries} - $ $ - $ + matterlib -Wl,--end-group) # Make the component dependent on our CHIP build diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index 5c36284f072..f8885b77e97 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -32,21 +32,11 @@ menu "CHIP Core" default 8 help The maximum number of simultaneously active CHIP exchange contexts. - + An exchange context object is used to track the state of an ongoing CHIP message exchange (conversation) with a peer, e.g. a cloud service, a mobile application, or another device. - config MAX_BINDINGS - int "Max Bindings" - range 0 65535 - default 8 - help - The maximum number of simultaneously active CHIP Binding objects. - - A Binding object is used to configure how the local device communicates with - a remote entity, be it a cloud service, a mobile application, or another device. - config MAX_FABRICS int "Max Fabrics" range 5 255 @@ -57,15 +47,6 @@ menu "CHIP Core" Each fabric can provision the device with its unique operational credentials and manage its own access control lists. - config MAX_PEER_NODES - int "Max Peer Nodes" - range 0 65535 - default 16 - help - The maximum number of peer nodes that the local node can communicate with using - connectionless communication (e.g. UDP). This value sizes a table that tracks - communication state with peer nodes by their CHIP node id. - config MAX_UNSOLICITED_MESSAGE_HANDLERS int "Max Unsolicited Message Handlers" range 0 65535 @@ -203,6 +184,13 @@ menu "CHIP Core" help Specifies the maximum number of group key sets supported per fabric. + config CHIP_DEVICE_ENABLE_DYNAMIC_SERVER + bool "Enable dynamic server" + default n + help + Enable dynamic server to handle a different interaction model dispatch. + Can be implied when users do not want to use the same server clusters. + endmenu # "General Options" menu "Networking Options" @@ -226,28 +214,6 @@ menu "CHIP Core" CHIP generally needs one UDP EndPoint object for each local network interface, plus 2 additional EndPoints for general UDP communcation. - config MAX_CONNECTIONS - int "Max CHIP Connections" - range 0 65535 - default 8 - help - The maximum number of simultaneously active CHIP connections, either locally - or remotely initiated. This limit covers both CHIP TCP connections, and - CHIP-over-BLE (WoBLE) connections. - - config DEFAULT_INCOMING_CONNECTION_IDLE_TIMEOUT - int "Default Incoming Connection Idle Timeout (ms)" - range 0 1000000 - default 15000 - help - The maximum amount of time, in milliseconds, that an idle inbound - CHIP connection will be allowed to exist before being closed. - - This is a default value that can be overridden at runtime by the - application. - - A value of 0 disables automatic closing of idle connections. - config ENABLE_ROUTE_HOOK bool "Enable route hook" depends on LWIP_HOOK_IP6_ROUTE_DEFAULT && LWIP_HOOK_ND6_GET_GW_DEFAULT @@ -410,13 +376,6 @@ menu "CHIP Device Layer" help Enables or Disables ICD server - config ICD_ENFORCE_SIT_SLOW_POLL_LIMIT - bool "Enforce SIT Slow Polling Max value to 15 seconds" - depends on ENABLE_ICD_SERVER - default n - help - Set to true to enforce SIT Slow Polling Max value to 15seconds - config ICD_REPORT_ON_ACTIVE_MODE bool "Emit a report on entering active mode" depends on ENABLE_ICD_SERVER @@ -653,58 +612,6 @@ menu "CHIP Device Layer" endmenu - menu "WiFi AP Options" - - config ENABLE_WIFI_AP - depends on ESP_WIFI_SOFTAP_SUPPORT - bool "Enable CHIP WIFI AP" - default y - help - Enables WiFi AP for CHIP. - - config WIFI_AP_SSID_PREFIX - string "WiFi AP SSID Prefix" - default "MATTER-" - depends on ENABLE_WIFI_AP - help - A prefix string used in forming the WiFi soft-AP SSID. The remainder of the SSID - consists of the final two bytes of the device's primary WiFi MAC address in hex. - - config WIFI_AP_CHANNEL - int "WiFi AP Channel" - range 1 14 - default 1 - depends on ENABLE_WIFI_AP - help - The WiFi channel number to be used by the soft-AP. - - config WIFI_AP_MAX_STATIONS - int "WiFi AP Max Allowed Stations" - range 1 10 - default 4 - depends on ENABLE_WIFI_AP - help - The maximum number of stations allowed to connect to the soft-AP. - - config WIFI_AP_BEACON_INTERVAL - int "WiFi AP Beacon Interval (ms)" - range 100 60000 - default 100 - depends on ENABLE_WIFI_AP - help - The beacon interval (in milliseconds) for the WiFi soft-AP. - - config WIFI_AP_IDLE_TIMEOUT - int "WiFi AP Idle Timeout (ms)" - range 0 600000 - default 120000 - depends on ENABLE_WIFI_AP - help - The amount of time (in milliseconds) after which the CHIP platform will deactivate the soft-AP - if it has been idle. - - endmenu - menu "BLE Options" visible if BT_ENABLED @@ -863,85 +770,7 @@ menu "CHIP Device Layer" endmenu - menu "Time Sync Options" - - config ENABLE_SERVICE_DIRECTORY_TIME_SYNC - bool "Enable Service Directory Time Sync" - default y - help - Enables synchronizing the device real-time clock using information returned during - a CHIP service directory query. For any device that uses the CHIP service directory - to lookup a tunnel server, enabling this option will result in the real time clock being - synchronized every time the service tunnel is established. - - config ENABLE_CHIP_TIME_SERVICE_TIME_SYNC - bool "Enable Time Service Time Sync" - default n - help - Enables synchronizing the device's real time clock with a remote CHIP Time service - using the CHIP Time Sync protocol. - - config CHIP_TIME_SERVICE_ENDPOINT_ID - hex "CHIP Time Service Endpoint Id" - default 18B4300200000005 - depends on ENABLE_CHIP_TIME_SERVICE_TIME_SYNC - help - Specifies the service endpoint id of the CHIP Time Sync service to be used to synchronize time. - - config DEFAULT_TIME_SYNC_INTERVAL - int "Time Sync Interval (seconds)" - default 60 - depends on ENABLE_CHIP_TIME_SERVICE_TIME_SYNC - help - Specifies the minimum interval (in seconds) at which the device should synchronize its real time - clock with the configured CHIP Time Sync server. - - config TIME_SYNC_TIMEOUT - int "Time Sync Timeout (ms)" - default 10000 - depends on ENABLE_CHIP_TIME_SERVICE_TIME_SYNC - help - Specifies the maximum amount of time (in milliseconds) to wait for a response from a - CHIP Time Sync server. - - endmenu - - menu "Service Provisioning Options" - - config SERVICE_PROVISIONING_ENDPOINT_ID - hex "CHIP Service Provisioning Endpoint Id" - default 18B4300200000010 - help - Specifies the service endpoint id of the CHIP Service Provisioning service. When a device - undergoes service provisioning, this is the endpoint to which it will send its Pair Device - to Account request. - - config SERVICE_PROVISIONING_CONNECTIVITY_TIMEOUT - int "Service Provisioning Connectivity Timeout (ms)" - default 10000 - help - The maximum amount of time (in milliseconds) to wait for service connectivity during the device - service provisioning step. More specifically, this is the maximum amount of time the device will - wait for connectivity to be established with the service at the point where the device waiting - to send a Pair Device to Account request to the Service Provisioning service. - - config SERVICE_PROVISIONING_REQUEST_TIMEOUT - int "Service Provisioning Request Timeout (ms)" - default 10000 - help - Specifies the maximum amount of time (in milliseconds) to wait for a response from the Service - Provisioning service. - - endmenu - menu "Commissioning options" - config RENDEZVOUS_WAIT_FOR_COMMISSIONING_COMPLETE - int "Use full IP-based commissioning (expect cluster commands)" - default 0 - help - Setting this to y will cause the commissioner to send commissioning commands to the - various clusters after establishing a PASE session. - config ENABLE_ROTATING_DEVICE_ID depends on ENABLE_CHIPOBLE bool "Enable Rotating Device Identifier Support" @@ -1075,24 +904,6 @@ menu "CHIP Device Layer" The EnableKey in hex string format used by TestEventTrigger command in GeneralDiagnostics cluster. The length of the string should be 32. - config ENABLE_FIXED_TUNNEL_SERVER - bool "Use Fixed Tunnel Server" - default n - help - Forces the use of a service tunnel server at a fixed IP address and port. This - bypasses the need for a directory query to the service directory endpoint to - determine the tunnel server address. When enabled, this option allows devices - that haven't been service provisioned to establish a service tunnel. - - config TUNNEL_SERVER_ADDRESS - string "Tunnel Server Address" - default "" - depends on ENABLE_FIXED_TUNNEL_SERVER - help - The IP address and port of the server to which the device should establish a service tunnel. - The supplied address must be a dot-notation IP address--not a host name. The port number is - optional; if present it should be separated from the IP address with a colon (e.g. 192.168.1.100:5540). - endmenu menu "Network Telemetry Options" diff --git a/config/esp32/components/chip/idf_component.yml b/config/esp32/components/chip/idf_component.yml index aeffec708db..c11eef55d97 100644 --- a/config/esp32/components/chip/idf_component.yml +++ b/config/esp32/components/chip/idf_component.yml @@ -4,10 +4,9 @@ dependencies: version: "^1.1.0" rules: - if: "idf_version >=5.0" - - if: "target != esp32h2" espressif/esp_secure_cert_mgr: - version: "^2.3.0" + version: "^2.5.0" rules: - if: "idf_version >=4.3" @@ -18,7 +17,7 @@ dependencies: - if: "idf_version >=4.4" espressif/esp_insights: - version: "1.0.1" + version: "1.2.2" require: public # There is an issue with IDF-Component-Manager when ESP Insights is included. # Issue: https://github.com/project-chip/connectedhomeip/issues/29125 @@ -36,3 +35,8 @@ dependencies: require: public rules: - if: "idf_version >=4.3" + + espressif/esp_wifi_remote: + version: ">=0.1.12" + rules: + - if: "target in [esp32p4]" diff --git a/config/ios/CHIPProjectConfig.h b/config/ios/CHIPProjectConfig.h deleted file mode 100644 index dfa35f7cfd5..00000000000 --- a/config/ios/CHIPProjectConfig.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Copyright (c) 2020-2022 Project CHIP Authors - * Copyright (c) 2016-2017 Nest Labs, Inc. - * Copyright (c) 2019-2020 Google LLC. - * 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. - */ - -/** - * @file - * Project-specific configuration file for iOS builds. - * - */ -#ifndef CHIPPROJECTCONFIG_H -#define CHIPPROJECTCONFIG_H - -// Enable UDP listening on demand in the CHIPDeviceController -#define CHIP_CONFIG_DEVICE_CONTROLLER_DEMAND_ENABLE_UDP 1 - -#define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0 - -// Uncomment this for a large Tunnel MTU. -//#define CHIP_CONFIG_TUNNEL_INTERFACE_MTU (9000) - -#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 - -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - -#define CHIP_CONFIG_MAX_SOFTWARE_VERSION_LENGTH 128 - -#ifndef CHIP_CONFIG_KVS_PATH -#define CHIP_CONFIG_KVS_PATH "chip.store" -#endif - -// The session pool size limits how many subscriptions we can have live at -// once. Home supports up to 1000 accessories, and we subscribe to all of them, -// so we need to make sure the pool is big enough for that. -#define CHIP_CONFIG_SECURE_SESSION_POOL_SIZE 1000 - -#endif /* CHIPPROJECTCONFIG_H */ diff --git a/config/ios/SystemProjectConfig.h b/config/ios/SystemProjectConfig.h deleted file mode 100644 index 06d9baaee59..00000000000 --- a/config/ios/SystemProjectConfig.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * chip::System project configuration for standalone builds on iOS - * - */ -#ifndef SYSTEMPROJECTCONFIG_H -#define SYSTEMPROJECTCONFIG_H - -#endif /* SYSTEMPROJECTCONFIG_H */ diff --git a/config/ios/args.gni b/config/ios/args.gni deleted file mode 100644 index b4426a61a43..00000000000 --- a/config/ios/args.gni +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/chip.gni") - -chip_system_config_clock = "gettimeofday" -chip_device_platform = "darwin" - -chip_project_config_include_dirs = [ "${chip_root}/config/ios" ] - -pw_build_PIP_CONSTRAINTS = [ "${chip_root}/scripts/setup/constraints.txt" ] diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index 37dad135327..88567b604e3 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -112,9 +112,6 @@ if (CONFIG_MBED_BSD_SOCKET_TRACE) matter_add_flags(-DMBED_BSD_SOCKET_TRACE=1) endif() -# Option can be set with `-DCHIP_DATA_MODEL_INTERFACE=enabled` or similar on the command line -set(CHIP_DATA_MODEL_INTERFACE "disabled" CACHE STRING "Data model interface option to use: enabled or disabled") - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -124,7 +121,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS LIB_PW_RPC CONFIG_CHIP_PW_RPC PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} - DATA_MODEL_INTERFACE ${CHIP_DATA_MODEL_INTERFACE} ) if (CONFIG_CHIP_PW_RPC) matter_add_gn_arg_import("${GN_ROOT_TARGET}/lib/pw_rpc/pw_rpc.gni") diff --git a/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni b/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni index 2b03f6b4c99..50ef9977fa5 100644 --- a/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni +++ b/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "${chip_root}/examples/platform/mbed/pw_sys_io:pw_sys_io_mbed" pw_rpc_system_server_BACKEND = diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 3896ed6be7d..e904da06e0d 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -88,7 +88,7 @@ matter_add_cxxflags(${ZEPHYR_GNU_CPP_STD}) # Set up custom OpenThread configuration if (CONFIG_CHIP_OPENTHREAD_CONFIG) - get_filename_component(CHIP_OPENTHREAD_CONFIG + get_filename_component(CHIP_OPENTHREAD_CONFIG ${CONFIG_CHIP_OPENTHREAD_CONFIG} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR} @@ -106,13 +106,6 @@ endif() get_property(CHIP_COMPILER_LAUNCHER GLOBAL PROPERTY RULE_LAUNCH_COMPILE) - -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -123,7 +116,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) matter_add_gn_arg_string("zephyr_cc" ${CMAKE_C_COMPILER}) @@ -133,7 +125,7 @@ matter_add_gn_arg_bool ("chip_enable_openthread" CONFIG_NET_L2_ matter_add_gn_arg_bool ("chip_openthread_ftd" CONFIG_OPENTHREAD_FTD) matter_add_gn_arg_bool ("chip_config_network_layer_ble" CONFIG_BT) matter_add_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_CHIP_IPV4) -matter_add_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NFC_COMMISSIONING) +matter_add_gn_arg_bool ("chip_enable_nfc_onboarding_payload" CONFIG_CHIP_NFC_ONBOARDING_PAYLOAD) matter_add_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR) matter_add_gn_arg_bool ("chip_persist_subscriptions" CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS) matter_add_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) @@ -156,7 +148,6 @@ if (CONFIG_CHIP_ENABLE_ICD_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT) matter_add_gn_arg_bool ("chip_enable_icd_dsls" CONFIG_CHIP_ICD_DSLS_SUPPORT) - matter_add_gn_arg_bool ("icd_enforce_sit_slow_poll_limit" TRUE) endif() if (CONFIG_CHIP_FACTORY_DATA OR CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND) diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index 2fd4f45de4b..08f65eabb83 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -34,7 +34,7 @@ config CHIP_NRF_PLATFORM config CHIP_DEVICE_VENDOR_NAME default "Nordic Semiconductor ASA" -config CHIP_NFC_COMMISSIONING +config CHIP_NFC_ONBOARDING_PAYLOAD bool "Share onboarding payload in NFC tag" default n imply NFC_T2T_NRFXLIB diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index a2e0a2ba5ee..e49893cffa1 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -178,10 +178,10 @@ config MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL default y if MPSL_FEM # ============================================================================== -# NFC configuration +# NFC Onboarding Payload configuration # ============================================================================== -config CHIP_NFC_COMMISSIONING +config CHIP_NFC_ONBOARDING_PAYLOAD default y # Disable not needed NFC callback to save flash diff --git a/config/nxp/chip-cmake-freertos/CMakeLists.txt b/config/nxp/chip-cmake-freertos/CMakeLists.txt index 27bedc50ae5..a3c59dcb1fe 100644 --- a/config/nxp/chip-cmake-freertos/CMakeLists.txt +++ b/config/nxp/chip-cmake-freertos/CMakeLists.txt @@ -44,18 +44,12 @@ endif() # ============================================================================== matter_add_gn_arg_string("nxp_nvm_component" ${CONFIG_CHIP_NVM_COMPONENT}) matter_add_gn_arg_string("nxp_platform" ${CONFIG_CHIP_NXP_PLATFORM}) -matter_add_gn_arg("chip_with_factory_data" ${CONFIG_CHIP_FACTORY_DATA}) -matter_add_gn_arg("chip_enable_secure_dac_private_key_storage" ${CONFIG_CHIP_SECURE_DAC_PRIVATE_KEY_STORAGE}) -matter_add_gn_arg("chip_enable_secure_whole_factory_data" ${CONFIG_CHIP_ENABLE_SECURE_WHOLE_FACTORY_DATA}) -matter_add_gn_arg_bool("chip_enable_matter_cli" CONFIG_CHIP_LIB_SHELL) +matter_add_gn_arg_bool("nxp_use_factory_data" ${CONFIG_CHIP_FACTORY_DATA}) +matter_add_gn_arg_bool("nxp_enable_secure_dac_private_key_storage" ${CONFIG_CHIP_SECURE_DAC_PRIVATE_KEY_STORAGE}) +matter_add_gn_arg_bool("nxp_enable_secure_whole_factory_data" ${CONFIG_CHIP_ENABLE_SECURE_WHOLE_FACTORY_DATA}) +matter_add_gn_arg_bool("nxp_enable_matter_cli" CONFIG_CHIP_LIB_SHELL) matter_add_gn_arg_bool("chip_enable_pairing_autostart" CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART) -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - if(CONFIG_BOOTLOADER_MCUBOOT) matter_add_gn_arg_bool("no_mcuboot" false) endif(CONFIG_BOOTLOADER_MCUBOOT) @@ -73,7 +67,6 @@ else() PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} PROJECT_CONFIG_INC_DIR ${CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) endif() diff --git a/config/nxp/chip-module/CMakeLists.txt b/config/nxp/chip-module/CMakeLists.txt index 5024672e144..66894861d40 100644 --- a/config/nxp/chip-module/CMakeLists.txt +++ b/config/nxp/chip-module/CMakeLists.txt @@ -91,13 +91,6 @@ endif() get_property(CHIP_COMPILER_LAUNCHER GLOBAL PROPERTY RULE_LAUNCH_COMPILE) -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -108,7 +101,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) matter_add_gn_arg_string("zephyr_cc" ${CMAKE_C_COMPILER}) diff --git a/config/nxp/chip-module/Kconfig.defaults b/config/nxp/chip-module/Kconfig.defaults index 3d0fcf08d75..3676d3eed6c 100644 --- a/config/nxp/chip-module/Kconfig.defaults +++ b/config/nxp/chip-module/Kconfig.defaults @@ -252,6 +252,15 @@ choice SCHED_ALGORITHM default SCHED_MULTIQ endchoice +config WIFI_NM_MAX_MANAGED_INTERFACES + default 2 + +config WIFI_NM_WPA_SUPPLICANT_WQ_PRIO + default 3 + +config WIFI_NM_WPA_SUPPLICANT_PRIO + default 3 + choice WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_CHOICE default WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF endchoice @@ -320,6 +329,9 @@ config HEAP_MEM_POOL_SIZE config CHIP_MALLOC_SYS_HEAP_SIZE default 28672 # 28 kB +config ETH_DRIVER + default n + endif if CHIP_ETHERNET || CHIP_WIFI @@ -336,6 +348,9 @@ choice NXP_ENET_DRIVER default ETH_NXP_ENET endchoice +config NET_SOCKETS_POLL_MAX + default 7 + endif # Configure MBEDTLS lib @@ -351,10 +366,10 @@ config MBEDTLS_USER_CONFIG_ENABLE config MBEDTLS_USER_CONFIG_FILE default "nxp-zephyr-mbedtls-config.h" -config MBEDTLS_ENTROPY_ENABLED +config MBEDTLS_ENTROPY_C default y -config MBEDTLS_ZEPHYR_ENTROPY +config MBEDTLS_ENTROPY_POLL_ZEPHYR default y config MBEDTLS_SSL_MAX_CONTENT_LEN diff --git a/config/nxp/chip-module/Kconfig.features b/config/nxp/chip-module/Kconfig.features index 9c388a20f9d..50f72eb0164 100644 --- a/config/nxp/chip-module/Kconfig.features +++ b/config/nxp/chip-module/Kconfig.features @@ -95,6 +95,8 @@ config CHIP_ETHERNET select NET_TCP select DNS_RESOLVER select MDNS_RESOLVER + select MDNS_RESPONDER + select DNS_SD select MBEDTLS_PKCS5_C select MBEDTLS_HKDF_C select MBEDTLS_ECDSA_C diff --git a/config/nxp/lib/pw_rpc/pw_rpc.gni b/config/nxp/lib/pw_rpc/pw_rpc.gni index 68255db8bb9..f91c53cf354 100644 --- a/config/nxp/lib/pw_rpc/pw_rpc.gni +++ b/config/nxp/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" pw_sys_io_BACKEND = "${chip_root}/examples/platform/nxp/pw_sys_io:pw_sys_io_nxp" diff --git a/config/python/CHIPProjectConfig.h b/config/python/CHIPProjectConfig.h index 4412c5bec75..d8960f647de 100644 --- a/config/python/CHIPProjectConfig.h +++ b/config/python/CHIPProjectConfig.h @@ -59,8 +59,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - /* TODO: Ideally, these #defines should be enabled by default for Linux AND the python tool would provide runtime options to enable/disable them */ #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY 1 diff --git a/config/qpg/chip-gn/args.gni b/config/qpg/chip-gn/args.gni index cccb41016a6..2e5afbbfa98 100644 --- a/config/qpg/chip-gn/args.gni +++ b/config/qpg/chip-gn/args.gni @@ -24,7 +24,7 @@ lwip_debug = false chip_enable_openthread = true chip_config_network_layer_ble = true chip_inet_config_enable_ipv4 = false -chip_enable_nfc = false +chip_enable_nfc_onboarding_payload = false chip_build_tests = false chip_monolithic_tests = false chip_inet_config_enable_tcp_endpoint = false diff --git a/config/qpg/chip-gn/build.sh b/config/qpg/chip-gn/build.sh index 541da262525..974caaaf0ac 100755 --- a/config/qpg/chip-gn/build.sh +++ b/config/qpg/chip-gn/build.sh @@ -31,7 +31,7 @@ gn \ --root-target=//config/qpg/chip-gn \ --dotfile="$GN_ROOT_TARGET/.gn" \ --script-executable=python3 \ - --export-compile-commands \ + --add-export-compile-commands="*" \ gen \ --check \ --args="$GN_ARGS" \ diff --git a/config/qpg/lib/pw_rpc/pw_rpc.gni b/config/qpg/lib/pw_rpc/pw_rpc.gni index 60fb93e6b8f..8e282c3bf05 100644 --- a/config/qpg/lib/pw_rpc/pw_rpc.gni +++ b/config/qpg/lib/pw_rpc/pw_rpc.gni @@ -15,8 +15,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "${chip_root}/examples/platform/qpg/pw_sys_io:pw_sys_io_qpg" pw_build_LINK_DEPS = [ diff --git a/config/standalone/CHIPProjectConfig.h b/config/standalone/CHIPProjectConfig.h index 27abcbb247b..3e91ea40c11 100644 --- a/config/standalone/CHIPProjectConfig.h +++ b/config/standalone/CHIPProjectConfig.h @@ -60,8 +60,6 @@ #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0 -#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1 - #ifndef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 4 #endif diff --git a/config/telink/app/bootloader.conf b/config/telink/app/bootloader.conf index 52937e1649e..0ffacc8c0b0 100644 --- a/config/telink/app/bootloader.conf +++ b/config/telink/app/bootloader.conf @@ -30,7 +30,8 @@ CONFIG_BOOT_SWAP_USING_SCRATCH=n CONFIG_BOOT_VALIDATE_SLOT0=y # Maximum number of image sectors supported by the bootloader. -CONFIG_BOOT_MAX_IMG_SECTORS=4096 +# Maximum signed image size: 512 * 4096 = 2M Bytes +CONFIG_BOOT_MAX_IMG_SECTORS=512 # Sets log level for modules which don't specify it explicitly. # When set to 0 it means log will not be activated for those modules. @@ -40,4 +41,4 @@ CONFIG_BOOT_MAX_IMG_SECTORS=4096 # - 2 WARNING, default to write LOG_LEVEL_WRN # - 3 INFO, default to write LOG_LEVEL_INFO # - 4 DEBUG, default to write LOG_LEVEL_DBG -CONFIG_LOG_DEFAULT_LEVEL=1 +CONFIG_LOG_DEFAULT_LEVEL=3 diff --git a/config/telink/app/bootloader_compress_lzma.conf b/config/telink/app/bootloader_compress_lzma.conf new file mode 100644 index 00000000000..cb349eed0ce --- /dev/null +++ b/config/telink/app/bootloader_compress_lzma.conf @@ -0,0 +1,46 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Enable overwrite the primary slot with the upgrade image instead of swapping them. +# This prevents the fallback recovery. +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 + +# Maximum number of image sectors supported by the bootloader. +# Maximum signed image size: 512 * 4096 = 2M Bytes +CONFIG_BOOT_MAX_IMG_SECTORS=512 + +# Sets log level for modules which don't specify it explicitly. +# When set to 0 it means log will not be activated for those modules. +# Levels are: +# - 0 OFF, do not write by default +# - 1 ERROR, default to only write LOG_LEVEL_ERR +# - 2 WARNING, default to write LOG_LEVEL_WRN +# - 3 INFO, default to write LOG_LEVEL_INFO +# - 4 DEBUG, default to write LOG_LEVEL_DBG +CONFIG_LOG_DEFAULT_LEVEL=3 + +# LZMA used sys_heap based allocators +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=78000 + +# Enable build size optimizations +CONFIG_SIZE_OPTIMIZATIONS=y + +# Enable support LZMA compression +CONFIG_COMPRESS_LZMA=y diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index bfc26ce5d96..bb42a26b6ff 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -69,7 +69,7 @@ matter_add_flags(-DMBEDTLS_USER_CONFIG_FILE=) # Set up custom OpenThread configuration if (CONFIG_CHIP_OPENTHREAD_CONFIG) - get_filename_component(CHIP_OPENTHREAD_CONFIG + get_filename_component(CHIP_OPENTHREAD_CONFIG ${CONFIG_CHIP_OPENTHREAD_CONFIG} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR} @@ -77,12 +77,6 @@ if (CONFIG_CHIP_OPENTHREAD_CONFIG) zephyr_set_openthread_config(${CHIP_OPENTHREAD_CONFIG}) endif() -if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") -else() - set(DATA_MODEL_INTERFACE "disabled") -endif() - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -93,7 +87,6 @@ matter_common_gn_args( LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) matter_add_gn_arg_string("zephyr_cc" ${CMAKE_C_COMPILER}) @@ -103,7 +96,7 @@ matter_add_gn_arg_bool ("chip_enable_openthread" CONFIG_NET_L2_ matter_add_gn_arg_bool ("chip_openthread_ftd" CONFIG_OPENTHREAD_FTD) matter_add_gn_arg_bool ("chip_config_network_layer_ble" CONFIG_BT) matter_add_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_CHIP_IPV4) -matter_add_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NFC_COMMISSIONING) +matter_add_gn_arg_bool ("chip_enable_nfc_onboarding_payload" CONFIG_CHIP_NFC_ONBOARDING_PAYLOAD) matter_add_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR) matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" FALSE) matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 1) @@ -162,6 +155,10 @@ set_property(GLOBAL APPEND PROPERTY ZEPHYR_INTERFACE_LIBS chip) include(${TELINK_COMMON}/common.cmake) +if (CONFIG_CHIP_APP_LOG_LEVEL GREATER_EQUAL 4) + include(${TELINK_COMMON}/build_info.cmake) +endif() + # ============================================================================== # Define 'process_binaries' target for collecting final binary to flash # ============================================================================== @@ -177,7 +174,7 @@ add_dependencies(process_binaries ${ZEPHYR_FINAL_EXECUTABLE}) # Define 'build_mcuboot' target for building the MCUBoot bootloader # ============================================================================== -if (CONFIG_BOOTLOADER_MCUBOOT AND CONFIG_SOC_SERIES_RISCV_TELINK_B9X) +if (CONFIG_BOOTLOADER_MCUBOOT AND (CONFIG_SOC_SERIES_RISCV_TELINK_B9X OR CONFIG_SOC_SERIES_RISCV_TELINK_TLX)) add_custom_target(build_mcuboot ALL COMMAND west build -b ${BASE_BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr @@ -192,8 +189,17 @@ endif() # ============================================================================== if (CONFIG_CHIP_OTA_IMAGE_BUILD) + if (CONFIG_COMPRESS_LZMA) + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/${CONFIG_SIGNED_OTA_IMAGE_FILE_NAME} + COMMAND ${CMAKE_COMMAND} -E true + COMMENT "Fake command, ${CONFIG_SIGNED_OTA_IMAGE_FILE_NAME} file created in process_binaries target" + DEPENDS ${ZEPHYR_FINAL_EXECUTABLE} + ) + endif() + chip_ota_image(chip-ota-image - INPUT_FILES ${PROJECT_BINARY_DIR}/zephyr.signed.bin + INPUT_FILES ${PROJECT_BINARY_DIR}/${CONFIG_SIGNED_OTA_IMAGE_FILE_NAME} OUTPUT_FILE ${PROJECT_BINARY_DIR}/${CONFIG_CHIP_OTA_IMAGE_FILE_NAME} ) add_dependencies(chip-ota-image process_binaries) diff --git a/config/telink/chip-module/Kconfig b/config/telink/chip-module/Kconfig index 7d9296bed5d..923a2de8c9b 100644 --- a/config/telink/chip-module/Kconfig +++ b/config/telink/chip-module/Kconfig @@ -22,7 +22,7 @@ if CHIP config CHIP_DEVICE_VENDOR_NAME default "Telink Semiconductor" -config CHIP_NFC_COMMISSIONING +config CHIP_NFC_ONBOARDING_PAYLOAD bool "Share onboarding payload in NFC tag" default n imply I2C @@ -71,6 +71,27 @@ config CHIP_OTA_IMAGE_BUILD bool default y if CHIP_OTA_REQUESTOR +config SIGNED_OTA_IMAGE_FILE_NAME + string "Zephyr signed image file name" + default "zephyr.signed.lzma.signed.bin" if COMPRESS_LZMA + default "zephyr.signed.bin" + depends on CHIP_OTA_REQUESTOR + help + Provides the file name of the generated Zephyr signed image. + +config TELINK_OTA_BUTTON_TEST + bool "Enable image update initiation via button press" + default n + depends on CHIP_OTA_REQUESTOR + help + Merge the signed binary with the same version as the main into slot-1 of merged.hex. + Pressing the button initiates a forced image update. + +config TELINK_OTA_PARTITION_ADDR + hex "image-1 partition address" + default $(dt_node_reg_addr_hex,$(dt_nodelabel_path,slot1_partition),0) + depends on TELINK_OTA_BUTTON_TEST + config CHIP_ROTATING_DEVICE_ID bool "Generate rotating device ID" default y @@ -225,6 +246,8 @@ config CHIP_ENABLE_POWER_ON_FACTORY_RESET config CHIP_TASK_STACK_SIZE int + default 6192 if SOC_RISCV_TELINK_TL321X + default 5352 if PM default 8192 config CHIP_USE_MARS_SENSOR diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index ed8172b1824..e50aa413b90 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -34,6 +34,7 @@ choice LOG_MODE endchoice choice MATTER_LOG_LEVEL_CHOICE + default MATTER_LOG_LEVEL_WRN if SOC_RISCV_TELINK_TL321X default MATTER_LOG_LEVEL_DBG endchoice @@ -61,17 +62,19 @@ config POSIX_MAX_FDS # Application stack size config MAIN_STACK_SIZE - default 3240 if PM + default 3240 if PM || SOC_RISCV_TELINK_TL321X default 4096 config INIT_STACKS default y config IDLE_STACK_SIZE - default 512 if PM + default 512 if PM || SOC_RISCV_TELINK_TL321X + config ISR_STACK_SIZE - default 502 if PM + default 576 if PM + default 528 if SOC_RISCV_TELINK_TL321X config SYSTEM_WORKQUEUE_STACK_SIZE default 616 if PM @@ -79,27 +82,34 @@ config SYSTEM_WORKQUEUE_STACK_SIZE config HEAP_MEM_POOL_SIZE default 256 -config COMMON_LIBC_MALLOC_ARENA_SIZE +config COMMON_LIBC_MALLOC_ARENA_SIZE + default 20716 if SOC_RISCV_TELINK_TL321X || SOC_SERIES_RISCV_TELINK_B9X_RETENTION + default 16384 if SOC_RISCV_TELINK_TL721X default 12288 config NET_IPV6_MLD - default n + default n if PM + default y + +config NET_IF_MCAST_IPV6_ADDR_COUNT + default 8 if PM + default 15 # Network buffers config NET_PKT_RX_COUNT - default 4 if PM + default 4 if PM || SOC_RISCV_TELINK_TL321X default 8 config NET_PKT_TX_COUNT - default 4 if PM + default 4 if PM || SOC_RISCV_TELINK_TL321X default 8 config NET_BUF_RX_COUNT - default 16 if PM + default 12 if PM || SOC_RISCV_TELINK_TL321X default 32 config NET_BUF_TX_COUNT - default 16 if PM + default 12 if PM || SOC_RISCV_TELINK_TL321X default 32 config GPIO @@ -128,60 +138,89 @@ config BT_MAX_CONN default 1 config BT_L2CAP_TX_MTU + default 103 if SOC_RISCV_TELINK_TL321X default 247 config BT_BUF_ACL_RX_SIZE + default 107 if SOC_RISCV_TELINK_TL321X default 251 config BT_BUF_ACL_TX_SIZE + default 107 if SOC_RISCV_TELINK_TL321X default 251 + +#ifdef CONFIG_SOC_RISCV_TELINK_TL321X + +config BT_BUF_EVT_RX_COUNT + default 4 + +config BT_BUF_ACL_RX_COUNT + default 4 + +config BT_GATT_CACHING + bool + default n + + +#endif + config BT_RX_STACK_SIZE - default 810 if BT_B9X + default 1352 if BT_B9X || BT_TLX default 2048 if BT_W91 config BT_HCI_TX_STACK_SIZE - default 640 if BT_B9X + default 640 if BT_B9X || BT_TLX default 2048 if BT_W91 config BT_DEVICE_NAME_GATT_WRITABLE bool default n -config B9X_BLE_CTRL_THREAD_STACK_SIZE - default 576 +if SOC_SERIES_RISCV_TELINK_B9X || SOC_SERIES_RISCV_TELINK_TLX + +config TL_BLE_CTRL_THREAD_STACK_SIZE + default 648 -config B9X_BLE_CTRL_MASTER_MAX_NUM +config TL_BLE_CTRL_MASTER_MAX_NUM default 0 -config B9X_BLE_CTRL_SLAVE_MAX_NUM +config TL_BLE_CTRL_SLAVE_MAX_NUM default 1 -config B9X_BLE_CTRL_RF_POWER +config TL_BLE_CTRL_RF_POWER default 3 if PM + default 8 if BT_TLX default 9 -choice B9X_BLE_CTRL_MAC_TYPE - default B9X_BLE_CTRL_MAC_TYPE_RANDOM_STATIC +choice TL_BLE_CTRL_MAC_TYPE + default TL_BLE_CTRL_MAC_TYPE_RANDOM_STATIC endchoice -endif +endif # SOC_SERIES_RISCV_TELINK_B9X || SOC_SERIES_RISCV_TELINK_TLX + + +endif # BT # Board retention config +# Cut down the ram cost by matter's change,it can keep ramcode (driver). +# No need load the ramcode every time in thread mode (retention mode). +# If the ram is not enough , can change it back , initial setting is n. if BOARD_TLSR9528A_RETENTION || BOARD_TLSR9258A_RETENTION || BOARD_TLSR9518ADK80D_RETENTION config SOC_SERIES_RISCV_TELINK_B9X_NON_RETENTION_RAM_CODE - default y if PM + default n if PM config TELINK_B9X_MATTER_RETENTION_LAYOUT default y if PM config PWM default n + endif # Board non-retention config if BOARD_TLSR9118BDK40D || BOARD_TLSR9118BDK40D_V1 || \ - BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D + BOARD_TLSR9528A || BOARD_TLSR9258A || BOARD_TLSR9518ADK80D || BOARD_TL3218X || BOARD_TL7218X config PWM default y endif @@ -217,6 +256,7 @@ config NVS_LOOKUP_CACHE default y config NVS_LOOKUP_CACHE_SIZE + default 400 if SOC_RISCV_TELINK_TL321X default 2048 if !PM # Set multiplicator of Name Value Storage (NVS) as 1 to reach NVS sector size 4KB @@ -256,10 +296,10 @@ config CHIP_ENABLE_ICD_SUPPORT default y if CHIP_THREAD_DEVICE_ROLE_SLEEPY_END_DEVICE config OPENTHREAD_THREAD_STACK_SIZE - default 2178 if PM + default 2400 if PM || SOC_RISCV_TELINK_TL321X config OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE - default 361 if PM + default 432 if PM default 608 config OPENTHREAD_SLAAC @@ -272,13 +312,17 @@ config OPENTHREAD_DEFAULT_TX_POWER default 3 if PM default 9 +config OPENTHREAD_IP6_MAX_EXT_MCAST_ADDRS + default 2 if PM + default 8 + endif # NET_L2_OPENTHREAD config NET_TX_STACK_SIZE - default 554 if PM + default 554 if PM || SOC_RISCV_TELINK_TL321X config NET_RX_STACK_SIZE - default 554 if PM + default 554 if PM || SOC_RISCV_TELINK_TL321X # Disable certain parts of Zephyr IPv6 stack config NET_IPV6_NBR_CACHE @@ -357,6 +401,9 @@ config CHIP_WIFI_CONNECTION_RECOVERY_JITTER a random jitter interval is added to it to avoid periodicity. The random jitter is selected within range [-JITTER; +JITTER]. +config NET_MGMT_EVENT_STACK_SIZE + default 1128 + endif # CHIP_WIFI config CHIP_ENABLE_PAIRING_AUTOSTART @@ -439,7 +486,17 @@ config PWM_SHELL config OPENTHREAD_SHELL default n -config CHIP_TASK_STACK_SIZE - default 4864 if PM +# Thread analyzer +config THREAD_ANALYZER + default n + select THREAD_ANALYZER_AUTO + +config THREAD_ANALYZER_AUTO_INTERVAL + default 5 + depends on THREAD_ANALYZER_AUTO + +config THREAD_ANALYZER_LOG_LEVEL + default 3 # info + depends on THREAD_ANALYZER endif diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 27598c7095c..7534fbd2e03 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -30,7 +30,6 @@ menuconfig CHIP imply NET_IPV6 imply NET_CONFIG_NEED_IPV6 imply NET_SOCKETS - imply NET_SOCKETS_POSIX_NAMES if !ARCH_POSIX && CHIP_NRF_PLATFORM imply NETWORKING imply HWINFO imply FLASH @@ -581,11 +580,11 @@ config CHIP_BLE_ADVERTISING_DURATION If CHIP_BLE_EXT_ADVERTISING is set to false, the maximum duration time is 15 minutes, else the maximum duration time can be extended to 2880 minutes (48h). -config USE_CHIP_DATA_MODEL_INTERFACE - bool "Use a DataModel::Provider interface for data access" - help - This enables a level of indiraction in the CHIP interaction model engine in - accessing underlying data and executing operations such as - wildcard-expansion, read, write and invoke. +endif +if BT +config CHIP_CUSTOM_BLE_ADV_DATA + bool "Use custom BLE advertising data" + help + Customization of BLE advertising data at the application layer endif diff --git a/config/zephyr/chip-module/CMakeLists.txt b/config/zephyr/chip-module/CMakeLists.txt index fb94465b772..3461a974678 100644 --- a/config/zephyr/chip-module/CMakeLists.txt +++ b/config/zephyr/chip-module/CMakeLists.txt @@ -70,12 +70,6 @@ if(CONFIG_CHIP) zephyr_set_openthread_config(${CHIP_OPENTHREAD_CONFIG}) endif() - if (CONFIG_USE_CHIP_DATA_MODEL_INTERFACE) - set(DATA_MODEL_INTERFACE "enabled") - else() - set(DATA_MODEL_INTERFACE "disabled") - endif() - # ============================================================================== # Generate configuration for CHIP GN build system # ============================================================================== @@ -84,7 +78,6 @@ if(CONFIG_CHIP) LIB_SHELL CONFIG_CHIP_LIB_SHELL LIB_TESTS CONFIG_CHIP_BUILD_TESTS PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} - DATA_MODEL_INTERFACE ${DATA_MODEL_INTERFACE} ) matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) diff --git a/credentials/generate-revocation-set.py b/credentials/generate-revocation-set.py deleted file mode 100644 index e0d0cb611fa..00000000000 --- a/credentials/generate-revocation-set.py +++ /dev/null @@ -1,423 +0,0 @@ -#!/usr/bin/env python3 - -# -# Copyright (c) 2023-2024 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# 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. -# - -# Generates a basic RevocationSet from TestNet -# Usage: -# python ./credentials/generate-revocation-set.py --help - -import base64 -import json -import logging -import subprocess -import sys -from enum import Enum - -import click -import requests -from click_option_group import RequiredMutuallyExclusiveOptionGroup, optgroup -from cryptography import x509 -from cryptography.hazmat.primitives.asymmetric import ec -from cryptography.x509.oid import NameOID - -# Supported log levels, mapping string values required for argument -# parsing into logging constants -__LOG_LEVELS__ = { - 'debug': logging.DEBUG, - 'info': logging.INFO, - 'warn': logging.WARN, - 'fatal': logging.FATAL, -} - - -class RevocationType(Enum): - CRL = 1 - - -OID_VENDOR_ID = x509.ObjectIdentifier("1.3.6.1.4.1.37244.2.1") -OID_PRODUCT_ID = x509.ObjectIdentifier("1.3.6.1.4.1.37244.2.2") - -PRODUCTION_NODE_URL = "https://on.dcl.csa-iot.org:26657" -PRODUCTION_NODE_URL_REST = "https://on.dcl.csa-iot.org" -TEST_NODE_URL_REST = "https://on.test-net.dcl.csa-iot.org" - - -def extract_single_integer_attribute(subject, oid): - attribute_list = subject.get_attributes_for_oid(oid) - - if len(attribute_list) == 1: - return int(attribute_list[0].value, 16) - - return None - - -def extract_fallback_tag_from_common_name(cn, marker): - val_len = 4 - start_idx = cn.find(marker) - - if start_idx != -1: - val_start_idx = start_idx + len(marker) - val = cn[val_start_idx:val_start_idx + val_len] - return int(val, 16) if len(val) == 4 else None - - return None - - -def parse_vid_pid_from_distinguished_name(distinguished_name): - # VID/PID encoded using Matter specific RDNs - vid = extract_single_integer_attribute(distinguished_name, OID_VENDOR_ID) - pid = extract_single_integer_attribute(distinguished_name, OID_PRODUCT_ID) - - # Fallback method to get the VID/PID, encoded in CN as "Mvid:FFFF Mpid:1234" - if vid is None and pid is None: - cn = distinguished_name.get_attributes_for_oid(NameOID.COMMON_NAME)[0].value - vid = extract_fallback_tag_from_common_name(cn, 'Mvid:') - pid = extract_fallback_tag_from_common_name(cn, 'Mpid:') - - return vid, pid - - -class DCLDClient: - ''' - A client for interacting with DCLD using either the REST API or command line interface (CLI). - - ''' - - def __init__(self, use_rest: bool, dcld_exe: str, production: bool, rest_node_url: str): - ''' - Initialize the client - - use_rest: bool - Use RESTful API with HTTPS against `rest_node_url` - dcld_exe: str - Path to `dcld` executable - production: bool - Use MainNet DCL URL with dcld executable - rest_node_url: str - RESTful API URL - ''' - - self.use_rest = use_rest - self.dcld_exe = dcld_exe - self.production = production - self.rest_node_url = rest_node_url - - def build_dcld_command_line(self, cmdlist: list[str]) -> list[str]: - ''' - Build command line for `dcld` executable. - - Parameters - ---------- - cmdlist: list[str] - List of command line arguments to append to some predefined arguments - - Returns - ------- - list[str] - The complete command list including the DCLD executable and node option if in production - ''' - - return [self.dcld_exe] + cmdlist + (['--node', PRODUCTION_NODE_URL] if self.production else []) - - def get_dcld_cmd_output_json(self, cmdlist: list[str]) -> dict: - ''' - Executes a DCLD CLI command and returns the JSON output. - - Parameters - ---------- - cmdlist: list[str] - List of command line arguments to append to some predefined arguments - - Returns - ------- - dict - The JSON output from the command - ''' - - # Set the output as JSON - subprocess.Popen([self.dcld_exe, 'config', 'output', 'json']) - - cmdpipe = subprocess.Popen(self.build_dcld_command_line(cmdlist), - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - return json.loads(cmdpipe.stdout.read()) - - def get_revocation_points(self) -> list[dict]: - ''' - Get revocation points from DCL - - Returns - ------- - list[dict] - List of revocation points - ''' - - if self.use_rest: - response = requests.get(f"{self.rest_node_url}/dcl/pki/revocation-points").json() - else: - response = self.get_dcld_cmd_output_json(['query', 'pki', 'all-revocation-points']) - - return response["PkiRevocationDistributionPoint"] - - def get_paa_cert_for_crl_issuer(self, crl_signer_issuer_name_b64, crl_signer_authority_key_id) -> str: - ''' - Get PAA certificate for CRL issuer - - Parameters - ---------- - crl_signer_issuer_name_b64: str - The issuer name of the CRL signer. - crl_signer_authority_key_id: str - The authority key ID of the CRL signer. - - Returns - ------- - str - PAA certificate in PEM format - ''' - if self.use_rest: - response = requests.get( - f"{self.rest_node_url}/dcl/pki/certificates/{crl_signer_issuer_name_b64}/{crl_signer_authority_key_id}").json() - else: - response = self.get_dcld_cmd_output_json( - ['query', 'pki', 'x509-cert', '-u', crl_signer_issuer_name_b64, '-k', crl_signer_authority_key_id]) - - return response["approvedCertificates"]["certs"][0]["pemCert"] - - def get_revocations_points_by_skid(self, issuer_subject_key_id) -> list[dict]: - ''' - Get revocation points by subject key ID - - Parameters - ---------- - issuer_subject_key_id: str - Subject key ID - - Returns - ------- - list[dict] - List of revocation points - ''' - if self.use_rest: - response = requests.get(f"{self.rest_node_url}/dcl/pki/revocation-points/{issuer_subject_key_id}").json() - else: - response = self.get_dcld_cmd_output_json(['query', 'pki', 'revocation-points', - '--issuer-subject-key-id', issuer_subject_key_id]) - - return response["pkiRevocationDistributionPointsByIssuerSubjectKeyID"]["points"] - - -@click.command() -@click.help_option('-h', '--help') -@optgroup.group('Input data sources', cls=RequiredMutuallyExclusiveOptionGroup) -@optgroup.option('--use-main-net-dcld', type=str, default='', metavar='PATH', help="Location of `dcld` binary, to use `dcld` for mirroring MainNet.") -@optgroup.option('--use-test-net-dcld', type=str, default='', metavar='PATH', help="Location of `dcld` binary, to use `dcld` for mirroring TestNet.") -@optgroup.option('--use-main-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public MainNet observer.") -@optgroup.option('--use-test-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public TestNet observer.") -@optgroup.group('Optional arguments') -@optgroup.option('--output', default='sample_revocation_set_list.json', type=str, metavar='FILEPATH', - help="Output filename (default: sample_revocation_set_list.json)") -@optgroup.option('--log-level', default='INFO', show_default=True, type=click.Choice(__LOG_LEVELS__.keys(), - case_sensitive=False), callback=lambda c, p, v: __LOG_LEVELS__[v], - help='Determines the verbosity of script output') -def main(use_main_net_dcld: str, use_test_net_dcld: str, use_main_net_http: bool, use_test_net_http: bool, output: str, log_level: str): - """Tool to construct revocation set from DCL""" - - logging.basicConfig( - level=log_level, - format='%(asctime)s %(name)s %(levelname)-7s %(message)s', - datefmt='%Y-%m-%d %H:%M:%S' - ) - - production = False - dcld = use_test_net_dcld - - if len(use_main_net_dcld) > 0: - dcld = use_main_net_dcld - production = True - - use_rest = use_main_net_http or use_test_net_http - if use_main_net_http: - production = True - - rest_node_url = PRODUCTION_NODE_URL_REST if production else TEST_NODE_URL_REST - - dcld_client = DCLDClient(use_rest, dcld, production, rest_node_url) - - revocation_point_list = dcld_client.get_revocation_points() - - revocation_set = [] - - for revocation_point in revocation_point_list: - # 1. Validate Revocation Type - if revocation_point["revocationType"] != RevocationType.CRL.value: - logging.warning("Revocation Type is not CRL, continue...") - continue - - # 2. Parse the certificate - crl_signer_certificate = x509.load_pem_x509_certificate(bytes(revocation_point["crlSignerCertificate"], 'utf-8')) - - vid = revocation_point["vid"] - pid = revocation_point["pid"] - is_paa = revocation_point["isPAA"] - - # 3. && 4. Validate VID/PID - crl_vid, crl_pid = parse_vid_pid_from_distinguished_name(crl_signer_certificate.subject) - - if is_paa: - if crl_vid is not None: - if vid != crl_vid: - logging.warning("VID is not CRL VID, continue...") - continue - else: - if crl_vid is None or vid != crl_vid: - logging.warning("VID is not CRL VID, continue...") - continue - if crl_pid is not None: - if pid != crl_pid: - logging.warning("PID is not CRL PID, continue...") - continue - - # 5. Validate the certification path containing CRLSignerCertificate. - crl_signer_issuer_name = base64.b64encode(crl_signer_certificate.issuer.public_bytes()).decode('utf-8') - - crl_signer_authority_key_id = crl_signer_certificate.extensions.get_extension_for_oid( - x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier - - # Convert CRL Signer AKID to colon separated hex - crl_signer_authority_key_id = crl_signer_authority_key_id.hex().upper() - crl_signer_authority_key_id = ':'.join([crl_signer_authority_key_id[i:i+2] - for i in range(0, len(crl_signer_authority_key_id), 2)]) - - paa_certificate = dcld_client.get_paa_cert_for_crl_issuer(crl_signer_issuer_name, crl_signer_authority_key_id) - - if paa_certificate is None: - logging.warning("PAA Certificate not found, continue...") - continue - - paa_certificate_object = x509.load_pem_x509_certificate(bytes(paa_certificate, 'utf-8')) - - # TODO: use verify_directly_issued_by() method when we upgrade cryptography to v40.0.0 - # Verify issuer matches with subject - if crl_signer_certificate.issuer != paa_certificate_object.subject: - logging.warning("CRL Signer Certificate issuer does not match with PAA Certificate subject, continue...") - continue - - # Check crl signers AKID matches with SKID of paa_certificate_object's AKID - paa_skid = paa_certificate_object.extensions.get_extension_for_oid(x509.OID_SUBJECT_KEY_IDENTIFIER).value.key_identifier - crl_akid = crl_signer_certificate.extensions.get_extension_for_oid(x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier - if paa_skid != crl_akid: - logging.warning("CRL Signer's AKID does not match with PAA Certificate SKID, continue...") - continue - - # verify if PAA singed the crl signer certificate - try: - paa_certificate_object.public_key().verify(crl_signer_certificate.signature, - crl_signer_certificate.tbs_certificate_bytes, - ec.ECDSA(crl_signer_certificate.signature_hash_algorithm)) - except Exception: - logging.warning("CRL Signer Certificate is not signed by PAA Certificate, continue...") - continue - - # 6. Obtain the CRL - logging.debug(f"Fetching CRL from {revocation_point['dataURL']}") - try: - r = requests.get(revocation_point["dataURL"], timeout=5) - except Exception: - logging.error('Failed to fetch CRL') - continue - - try: - crl_file = x509.load_der_x509_crl(r.content) - except Exception: - logging.error('Failed to load CRL') - continue - - # 7. Perform CRL File Validation - crl_authority_key_id = crl_file.extensions.get_extension_for_oid(x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier - crl_signer_subject_key_id = crl_signer_certificate.extensions.get_extension_for_oid( - x509.OID_SUBJECT_KEY_IDENTIFIER).value.key_identifier - if crl_authority_key_id != crl_signer_subject_key_id: - logging.warning("CRL Authority Key ID is not CRL Signer Subject Key ID, continue...") - continue - - issuer_subject_key_id = ''.join('{:02X}'.format(x) for x in crl_authority_key_id) - - # b. - same_issuer_points = dcld_client.get_revocations_points_by_skid(issuer_subject_key_id) - count_with_matching_vid_issuer_skid = sum(item.get('vid') == vid for item in same_issuer_points) - - if count_with_matching_vid_issuer_skid > 1: - try: - issuing_distribution_point = crl_file.extensions.get_extension_for_oid( - x509.OID_ISSUING_DISTRIBUTION_POINT).value - except Exception: - logging.warning("CRL Issuing Distribution Point not found, continue...") - continue - - uri_list = issuing_distribution_point.full_name - if len(uri_list) == 1 and isinstance(uri_list[0], x509.UniformResourceIdentifier): - if uri_list[0].value != revocation_point["dataURL"]: - logging.warning("CRL Issuing Distribution Point URI is not CRL URL, continue...") - continue - else: - logging.warning("CRL Issuing Distribution Point URI is not CRL URL, continue...") - continue - - # 9. Assign CRL File Issuer - certificate_authority_name = base64.b64encode(crl_file.issuer.public_bytes()).decode('utf-8') - logging.debug(f"CRL File Issuer: {certificate_authority_name}") - - serialnumber_list = [] - # 10. Iterate through the Revoked Certificates List - for revoked_cert in crl_file: - # a. - try: - revoked_cert_issuer = revoked_cert.extensions.get_extension_for_oid( - x509.CRLEntryExtensionOID.CERTIFICATE_ISSUER).value.get_values_for_type(x509.DirectoryName).value - - if revoked_cert_issuer is not None: - if revoked_cert_issuer != certificate_authority_name: - logging.warning("CRL Issuer is not CRL File Issuer, continue...") - continue - except Exception: - pass - - # b. - # TODO: Verify that the certificate chain of the entry is linking to the same PAA - # that issued the CRLSignerCertificate for this entry, including path through - # CRLSignerDelegator if present. If the PAAs under which were issued the certificate - # and the CRLSignerCertificate are different, ignore the entry. - - # c. and d. - serialnumber_list.append(bytes(str('{:02X}'.format(revoked_cert.serial_number)), 'utf-8').decode('utf-8')) - - issuer_name = base64.b64encode(crl_file.issuer.public_bytes()).decode('utf-8') - - revocation_set.append({"type": "revocation_set", - "issuer_subject_key_id": issuer_subject_key_id, - "issuer_name": issuer_name, - "revoked_serial_numbers": serialnumber_list}) - - with open(output, 'w+') as outfile: - json.dump(revocation_set, outfile, indent=4) - - -if __name__ == "__main__": - if len(sys.argv) == 1: - main.main(['--help']) - else: - main() diff --git a/credentials/generate_revocation_set.py b/credentials/generate_revocation_set.py new file mode 100755 index 00000000000..afd69dcc1dd --- /dev/null +++ b/credentials/generate_revocation_set.py @@ -0,0 +1,690 @@ +#!/usr/bin/env python3 + +# +# Copyright (c) 2023-2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. +# + +# Generates a basic RevocationSet from TestNet +# Usage: +# python ./credentials/generate-revocation-set.py --help + +import base64 +import json +import logging +import os +import subprocess +import sys +import unittest +from enum import Enum +from typing import Optional + +import click +import requests +from click_option_group import RequiredMutuallyExclusiveOptionGroup, optgroup +from cryptography import x509 +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives.asymmetric import ec +from cryptography.x509.oid import NameOID + +# Supported log levels, mapping string values required for argument +# parsing into logging constants +__LOG_LEVELS__ = { + 'debug': logging.DEBUG, + 'info': logging.INFO, + 'warn': logging.WARN, + 'fatal': logging.FATAL, +} + + +class RevocationType(Enum): + CRL = 1 + + +OID_VENDOR_ID = x509.ObjectIdentifier("1.3.6.1.4.1.37244.2.1") +OID_PRODUCT_ID = x509.ObjectIdentifier("1.3.6.1.4.1.37244.2.2") + +PRODUCTION_NODE_URL = "https://on.dcl.csa-iot.org:26657" +PRODUCTION_NODE_URL_REST = "https://on.dcl.csa-iot.org" +TEST_NODE_URL_REST = "https://on.test-net.dcl.csa-iot.org" + + +def extract_single_integer_attribute(subject, oid): + attribute_list = subject.get_attributes_for_oid(oid) + + if len(attribute_list) == 1: + return int(attribute_list[0].value, 16) + + return None + + +def extract_fallback_tag_from_common_name(cn, marker): + val_len = 4 + start_idx = cn.find(marker) + + if start_idx != -1: + val_start_idx = start_idx + len(marker) + val = cn[val_start_idx:val_start_idx + val_len] + return int(val, 16) if len(val) == 4 else None + + return None + + +def parse_vid_pid_from_distinguished_name(distinguished_name): + # VID/PID encoded using Matter specific RDNs + vid = extract_single_integer_attribute(distinguished_name, OID_VENDOR_ID) + pid = extract_single_integer_attribute(distinguished_name, OID_PRODUCT_ID) + + # Fallback method to get the VID/PID, encoded in CN as "Mvid:FFFF Mpid:1234" + if vid is None and pid is None: + cn = distinguished_name.get_attributes_for_oid(NameOID.COMMON_NAME)[0].value + vid = extract_fallback_tag_from_common_name(cn, 'Mvid:') + pid = extract_fallback_tag_from_common_name(cn, 'Mpid:') + + return vid, pid + + +def get_akid(cert: x509.Certificate) -> Optional[bytes]: + try: + return cert.extensions.get_extension_for_oid(x509.OID_AUTHORITY_KEY_IDENTIFIER).value.key_identifier + except Exception: + logging.warning("AKID not found in certificate") + return None + + +def get_skid(cert: x509.Certificate) -> Optional[bytes]: + try: + return cert.extensions.get_extension_for_oid(x509.OID_SUBJECT_KEY_IDENTIFIER).value.key_identifier + except Exception: + logging.warning("SKID not found in certificate") + return None + + +def get_subject_b64(cert: x509.Certificate) -> str: + return base64.b64encode(cert.subject.public_bytes()).decode('utf-8') + + +def get_issuer_b64(cert: x509.Certificate) -> str: + return base64.b64encode(cert.issuer.public_bytes()).decode('utf-8') + + +def verify_cert(cert: x509.Certificate, root: x509.Certificate) -> bool: + ''' + Verifies if the cert is signed by root. + ''' + + cert_akid = get_akid(cert) + root_skid = get_skid(root) + if cert_akid is None or root_skid is None or cert_akid != root_skid: + return False + + if cert.issuer != root.subject: + return False + + # public_key().verify() do not return anything if signature is valid, + # will raise an exception if signature is invalid + try: + root.public_key().verify(cert.signature, cert.tbs_certificate_bytes, ec.ECDSA(cert.signature_hash_algorithm)) + except Exception: + logging.warning(f"Signature verification failed for cert subject: {get_subject_b64(cert)}, issuer: {get_issuer_b64(cert)}") + return False + + return True + + +def is_self_signed_certificate(cert: x509.Certificate) -> bool: + return verify_cert(cert, cert) + + +# delegator is optional so can be None, but crl_signer and paa has to be present +def validate_cert_chain(crl_signer: x509.Certificate, crl_signer_delegator: x509.Certificate, paa: x509.Certificate): + ''' + There could be four scenarios: + 1. CRL Signer is PAA itself, hence its self-signed certificate + 2. CRL Signer is PAI certificate, and we can validate (crl_signer -> paa) chain + 3. CRL Signer delegator is PAA, and we can validate (crl_signer -> crl_signer_delegator(paa) -> paa) chain + 4. CRL Signer delegator is PAI, and we can validate (crl_signer -> crl_signer_delegator -> paa) chain + ''' + + if crl_signer_delegator: + return verify_cert(crl_signer, crl_signer_delegator) and verify_cert(crl_signer_delegator, paa) + else: + return verify_cert(crl_signer, paa) + + +def validate_vid_pid(revocation_point: dict, crl_signer_certificate: x509.Certificate, crl_signer_delegator_certificate: x509.Certificate) -> bool: + crl_signer_vid, crl_signer_pid = parse_vid_pid_from_distinguished_name(crl_signer_certificate.subject) + + if revocation_point["isPAA"]: + if crl_signer_vid is not None: + if revocation_point["vid"] != crl_signer_vid: + logging.warning("VID in CRL Signer Certificate does not match with VID in revocation point, continue...") + return False + else: + vid_to_match = crl_signer_vid + pid_to_match = crl_signer_pid + + # if the CRL Signer is delegated then match the VID and PID of the CRL Signer Delegator + if crl_signer_delegator_certificate: + vid_to_match, pid_to_match = parse_vid_pid_from_distinguished_name(crl_signer_delegator_certificate.subject) + + if vid_to_match is None or revocation_point["vid"] != vid_to_match: + logging.warning("VID in CRL Signer Certificate does not match with VID in revocation point, continue...") + return False + + if pid_to_match is not None: + if revocation_point["pid"] != pid_to_match: + logging.warning("PID in CRL Signer Certificate does not match with PID in revocation point, continue...") + return False + + return True + + +def fetch_crl_from_url(url: str, timeout: int) -> x509.CertificateRevocationList: + logging.debug(f"Fetching CRL from {url}") + + try: + r = requests.get(url, timeout=timeout) + return x509.load_der_x509_crl(r.content) + except Exception: + logging.error('Failed to fetch a valid CRL') + + +def generate_revocation_set_from_crl(crl_file: x509.CertificateRevocationList, + crl_signer_certificate: x509.Certificate, + certificate_authority_name_b64: str, + certificate_akid_hex: str, + crl_signer_delegator_cert: x509.Certificate) -> dict: + """Generate a revocation set from a CRL file. + + Args: + crl_file: The CRL object containing revoked certificates + crl_signer_certificate: The certificate object used to sign the CRL + certificate_authority_name_b64: Base64 encoded issuer name + certificate_akid_hex: Hex encoded Authority Key Identifier + crl_signer_delegator_cert: crl signer delegator certificate object + + Returns: + dict: A dictionary containing the revocation set data with fields: + - type: "revocation_set" + - issuer_subject_key_id: Authority Key Identifier (hex) + - issuer_name: Issuer name (base64) + - revoked_serial_numbers: List of revoked serial numbers + - crl_signer_cert: CRL signer certificate (base64 DER) + - crl_signer_delegator: Optional delegator certificate (base64 DER) + """ + serialnumber_list = [] + + for revoked_cert in crl_file: + try: + cert_issuer_entry_ext = revoked_cert.extensions.get_extension_for_oid(x509.CRLEntryExtensionOID.CERTIFICATE_ISSUER) + revoked_cert_issuer = cert_issuer_entry_ext.value.get_values_for_type(x509.DirectoryName)[0].public_bytes() + revoked_cert_issuer_b64 = base64.b64encode(revoked_cert_issuer).decode('utf-8') + + if revoked_cert_issuer_b64 is not None: + # check if this really are the same thing + if revoked_cert_issuer_b64 != certificate_authority_name_b64: + logging.warning("CRL Issuer is not CRL File Issuer, continue...") + continue + except Exception: + pass + + # Ensure the serial number is always a 2-byte aligned hex string. + # TestDACRevocationDelegateImpl encodes the serial number as an even-length hex string + # using BytesToHex in src/lib/support/BytesToHex.cpp. + # As the primary consumer of this data, we should use the same here. + serialnumber = '{:02X}'.format(revoked_cert.serial_number) + serialnumber = serialnumber if len(serialnumber) % 2 == 0 else '0' + serialnumber + serialnumber_list.append(serialnumber) + + entry = { + "type": "revocation_set", + "issuer_subject_key_id": certificate_akid_hex, + "issuer_name": certificate_authority_name_b64, + "revoked_serial_numbers": serialnumber_list, + "crl_signer_cert": base64.b64encode(crl_signer_certificate.public_bytes(serialization.Encoding.DER)).decode('utf-8'), + } + + if crl_signer_delegator_cert: + entry["crl_signer_delegator"] = base64.b64encode( + crl_signer_delegator_cert.public_bytes(serialization.Encoding.DER)).decode('utf-8') + + return entry + + +# This is implemented as per point (9) in 6.2.4.1. Conceptual algorithm for revocation set construction +def get_certificate_authority_details(crl_signer_certificate: x509.Certificate, + crl_signer_delegator_cert: x509.Certificate, + paa_certificate_object: x509.Certificate, + is_paa: bool) -> tuple[str, str]: + """Get certificate authority name and AKID based on certificate hierarchy. + + Args: + crl_signer_certificate: The CRL signer certificate + crl_signer_delegator_cert: Optional delegator certificate + paa_certificate_object: Optional PAA certificate + is_paa: Whether this is a PAA certificate + + Returns: + tuple[str, str]: (certificate_authority_name_b64, certificate_akid_hex) + """ + if is_paa and not is_self_signed_certificate(crl_signer_certificate): + cert_for_details = paa_certificate_object + logging.debug("Using PAA certificate for details") + elif crl_signer_delegator_cert: + cert_for_details = crl_signer_delegator_cert + logging.debug("Using CRL Signer Delegator certificate for details") + else: + cert_for_details = crl_signer_certificate + logging.debug("Using CRL Signer certificate for details") + + certificate_authority_name_b64 = get_subject_b64(cert_for_details) + certificate_akid = get_skid(cert_for_details) + certificate_akid_hex = ''.join('{:02X}'.format(x) for x in certificate_akid) + + logging.debug(f"Certificate Authority Name: {certificate_authority_name_b64}") + logging.debug(f"Certificate AKID: {certificate_akid_hex}") + + return certificate_authority_name_b64, certificate_akid_hex + + +class DCLDClient: + ''' + A client for interacting with DCLD using either the REST API or command line interface (CLI). + + ''' + + def __init__(self, use_rest: bool, dcld_exe: str, production: bool, rest_node_url: str): + ''' + Initialize the client + + use_rest: bool + Use RESTful API with HTTPS against `rest_node_url` + dcld_exe: str + Path to `dcld` executable + production: bool + Use MainNet DCL URL with dcld executable + rest_node_url: str + RESTful API URL + ''' + + self.use_rest = use_rest + self.dcld_exe = dcld_exe + self.production = production + self.rest_node_url = rest_node_url + + def build_dcld_command_line(self, cmdlist: list[str]) -> list[str]: + ''' + Build command line for `dcld` executable. + + Parameters + ---------- + cmdlist: list[str] + List of command line arguments to append to some predefined arguments + + Returns + ------- + list[str] + The complete command list including the DCLD executable and node option if in production + ''' + + return [self.dcld_exe] + cmdlist + (['--node', PRODUCTION_NODE_URL] if self.production else []) + + def get_dcld_cmd_output_json(self, cmdlist: list[str]) -> dict: + ''' + Executes a DCLD CLI command and returns the JSON output. + + Parameters + ---------- + cmdlist: list[str] + List of command line arguments to append to some predefined arguments + + Returns + ------- + dict + The JSON output from the command + ''' + + # Set the output as JSON + subprocess.Popen([self.dcld_exe, 'config', 'output', 'json']) + + cmdpipe = subprocess.Popen(self.build_dcld_command_line(cmdlist), + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + return json.loads(cmdpipe.stdout.read()) + + def get_revocation_points(self) -> list[dict]: + ''' + Get revocation points from DCL + + Returns + ------- + list[dict] + List of revocation points + ''' + + if self.use_rest: + response = requests.get(f"{self.rest_node_url}/dcl/pki/revocation-points").json() + else: + response = self.get_dcld_cmd_output_json(['query', 'pki', 'all-revocation-points']) + + return response["PkiRevocationDistributionPoint"] + + def get_issuer_cert(self, cert: x509.Certificate) -> Optional[x509.Certificate]: + ''' + Get the issuer certificate for + + Parameters + ---------- + cert: x509.Certificate + Certificate + + Returns + ------- + str + Issuer certificate in PEM format + ''' + issuer_name_b64 = get_issuer_b64(cert) + akid = get_akid(cert) + if akid is None: + return + + # Convert CRL Signer AKID to colon separated hex + akid_hex = akid.hex().upper() + akid_hex = ':'.join([akid_hex[i:i+2] for i in range(0, len(akid_hex), 2)]) + + logging.debug( + f"Fetching issuer from:{self.rest_node_url}/dcl/pki/certificates/{issuer_name_b64}/{akid_hex}") + + if self.use_rest: + response = requests.get( + f"{self.rest_node_url}/dcl/pki/certificates/{issuer_name_b64}/{akid_hex}").json() + else: + response = self.get_dcld_cmd_output_json( + ['query', 'pki', 'x509-cert', '-u', issuer_name_b64, '-k', akid_hex]) + + issuer_certificate = response["approvedCertificates"]["certs"][0]["pemCert"] + + logging.debug(f"issuer: {issuer_certificate}") + + try: + issuer_certificate_object = x509.load_pem_x509_certificate(bytes(issuer_certificate, 'utf-8')) + except Exception: + logging.error('Failed to parse PAA certificate') + return + + return issuer_certificate_object + + def get_revocations_points_by_skid(self, issuer_subject_key_id: str) -> list[dict]: + ''' + Get revocation points by subject key ID + + Parameters + ---------- + issuer_subject_key_id: str + Subject key ID + + Returns + ------- + list[dict] + List of revocation points + ''' + + if self.use_rest: + response = requests.get(f"{self.rest_node_url}/dcl/pki/revocation-points/{issuer_subject_key_id}").json() + else: + response = self.get_dcld_cmd_output_json(['query', 'pki', 'revocation-points', + '--issuer-subject-key-id', issuer_subject_key_id]) + + return response["pkiRevocationDistributionPointsByIssuerSubjectKeyID"]["points"] + + +@click.group() +def cli(): + pass + + +@cli.command('from-dcl') +@click.help_option('-h', '--help') +@optgroup.group('Input data sources', cls=RequiredMutuallyExclusiveOptionGroup) +@optgroup.option('--use-main-net-dcld', type=str, default='', metavar='PATH', help="Location of `dcld` binary, to use `dcld` for mirroring MainNet.") +@optgroup.option('--use-test-net-dcld', type=str, default='', metavar='PATH', help="Location of `dcld` binary, to use `dcld` for mirroring TestNet.") +@optgroup.option('--use-main-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public MainNet observer.") +@optgroup.option('--use-test-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public TestNet observer.") +@optgroup.group('Optional arguments') +@optgroup.option('--output', default='sample_revocation_set_list.json', type=str, metavar='FILEPATH', + help="Output filename (default: sample_revocation_set_list.json)") +@optgroup.option('--log-level', default='INFO', show_default=True, type=click.Choice(__LOG_LEVELS__.keys(), + case_sensitive=False), callback=lambda c, p, v: __LOG_LEVELS__[v], + help='Determines the verbosity of script output') +def from_dcl(use_main_net_dcld, use_test_net_dcld, use_main_net_http, use_test_net_http, output, log_level): + """Generate revocation set from DCL""" + logging.basicConfig( + level=log_level, + format='%(asctime)s %(name)s %(levelname)-7s %(message)s', + datefmt='%Y-%m-%d %H:%M:%S' + ) + + production = False + dcld = use_test_net_dcld + + if len(use_main_net_dcld) > 0: + dcld = use_main_net_dcld + production = True + + use_rest = use_main_net_http or use_test_net_http + if use_main_net_http: + production = True + + rest_node_url = PRODUCTION_NODE_URL_REST if production else TEST_NODE_URL_REST + + dcld_client = DCLDClient(use_rest, dcld, production, rest_node_url) + + revocation_point_list = dcld_client.get_revocation_points() + + revocation_set = [] + + for revocation_point in revocation_point_list: + # 1. Validate Revocation Type + if revocation_point["revocationType"] != RevocationType.CRL.value: + logging.warning("Revocation Type is not CRL, continue...") + continue + + # 2. Parse the certificate + try: + crl_signer_certificate = x509.load_pem_x509_certificate(bytes(revocation_point["crlSignerCertificate"], 'utf-8')) + except Exception: + logging.warning("CRL Signer Certificate is not valid, continue...") + continue + + # Parse the crl signer delegator + crl_signer_delegator_cert = None + if "crlSignerDelegator" in revocation_point: + crl_signer_delegator_cert_pem = revocation_point["crlSignerDelegator"] + logging.debug(f"CRLSignerDelegator: {crl_signer_delegator_cert_pem}") + try: + crl_signer_delegator_cert = x509.load_pem_x509_certificate(bytes(crl_signer_delegator_cert_pem, 'utf-8')) + except Exception: + logging.warning("CRL Signer Delegator Certificate not found...") + + # 3. and 4. Validate VID/PID + if not validate_vid_pid(revocation_point, crl_signer_certificate, crl_signer_delegator_cert): + logging.warning("Failed to validate VID/PID, continue...") + continue + + # 5. Validate the certification path containing CRLSignerCertificate. + paa_certificate_object = dcld_client.get_issuer_cert(crl_signer_certificate) + if paa_certificate_object is None: + logging.warning("PAA Certificate not found, continue...") + continue + + if validate_cert_chain(crl_signer_certificate, crl_signer_delegator_cert, paa_certificate_object) is False: + logging.warning("Failed to validate CRL Signer Certificate chain, continue...") + continue + + # 6. Obtain the CRL + crl_file = fetch_crl_from_url(revocation_point["dataURL"], 5) # timeout in seconds + if crl_file is None: + continue + + # 7. Perform CRL File Validation + # a. + crl_signer_skid = get_skid(crl_signer_certificate) + crl_akid = get_akid(crl_file) + if crl_akid != crl_signer_skid: + logging.warning("CRL AKID is not CRL Signer SKID, continue...") + continue + + crl_akid_hex = ''.join('{:02X}'.format(x) for x in crl_akid) + + # b. + same_issuer_points = dcld_client.get_revocations_points_by_skid(crl_akid_hex) + count_with_matching_vid_issuer_skid = sum(item.get('vid') == revocation_point["vid"] for item in same_issuer_points) + + if count_with_matching_vid_issuer_skid > 1: + try: + issuing_distribution_point = crl_file.extensions.get_extension_for_oid( + x509.OID_ISSUING_DISTRIBUTION_POINT).value + except Exception: + logging.warning("CRL Issuing Distribution Point not found, continue...") + continue + + uri_list = issuing_distribution_point.full_name + if len(uri_list) == 1 and isinstance(uri_list[0], x509.UniformResourceIdentifier): + if uri_list[0].value != revocation_point["dataURL"]: + logging.warning("CRL Issuing Distribution Point URI is not CRL URL, continue...") + continue + else: + logging.warning("CRL Issuing Distribution Point URI is not CRL URL, continue...") + continue + + # TODO: 8. Validate CRL as per Section 6.3 of RFC 5280 + + # 9. decide on certificate authority name and AKID + certificate_authority_name_b64, certificate_akid_hex = get_certificate_authority_details( + crl_signer_certificate, crl_signer_delegator_cert, paa_certificate_object, revocation_point["isPAA"]) + + # validate issuer skid matchces with the one in revocation points + logging.debug(f"revocation_point['issuerSubjectKeyID']: {revocation_point['issuerSubjectKeyID']}") + + if revocation_point["issuerSubjectKeyID"] != certificate_akid_hex: + logging.warning("CRL Issuer Subject Key ID is not CRL Signer Subject Key ID, continue...") + continue + + # 10. Iterate through the Revoked Certificates List + entry = generate_revocation_set_from_crl(crl_file, crl_signer_certificate, + certificate_authority_name_b64, certificate_akid_hex, crl_signer_delegator_cert) + logging.debug(f"Entry to append: {entry}") + revocation_set.append(entry) + + with open(output, 'w+') as outfile: + json.dump(revocation_set, outfile, indent=4) + + +@cli.command('from-crl') +@click.option('--crl', required=True, type=click.File('rb'), help='Path to the CRL file') +@click.option('--crl-signer', required=True, type=click.File('rb'), help='Path to the signer certificate') +@click.option('--delegator', type=click.File('rb'), help='Path to the delegator certificate (optional)') +@click.option('--paa', type=click.File('rb'), help='Path to the PAA certificate (optional)') +@click.option('--output', default='revocation_set.json', type=click.File('w'), help='Output filename (default: revocation_set.json)') +@click.option('--is-paa', default=False, is_flag=True, help='Indicates if the CRL issuer is the PAA') +def from_crl(crl, crl_signer, delegator, paa, output, is_paa): + """Generate revocation set from a single CRL file""" + crl = x509.load_pem_x509_crl(crl.read()) + crl_signer = x509.load_pem_x509_certificate(crl_signer.read()) + delegator = x509.load_pem_x509_certificate(delegator.read()) if delegator else None + paa = x509.load_pem_x509_certificate(paa.read()) if paa else None + + ca_name_b64, ca_akid_hex = get_certificate_authority_details(crl_signer, delegator, paa, is_paa) + revocation_set = generate_revocation_set_from_crl(crl, crl_signer, ca_name_b64, ca_akid_hex, delegator) + output.write(json.dumps([revocation_set], indent=4)) + + +class TestRevocationSetGeneration(unittest.TestCase): + """Test class for revocation set generation""" + + def setUp(self): + # Get the directory containing this file + self.test_base_dir = os.path.dirname(os.path.abspath(__file__)) + + def get_test_file_path(self, filename): + return os.path.join(self.test_base_dir, 'test', filename) + + def compare_revocation_sets(self, generated_set, expected_file): + with open(os.path.join(self.test_base_dir, expected_file), 'r') as f: + expected_set = json.load(f) + + # Compare the contents + self.assertEqual(len([generated_set]), len(expected_set)) + expected = expected_set[0] + + # Compare required fields + self.assertEqual(generated_set['type'], expected['type']) + self.assertEqual(generated_set['issuer_subject_key_id'], expected['issuer_subject_key_id']) + self.assertEqual(generated_set['issuer_name'], expected['issuer_name']) + self.assertEqual(set(generated_set['revoked_serial_numbers']), set(expected['revoked_serial_numbers'])) + self.assertEqual(generated_set['crl_signer_cert'], expected['crl_signer_cert']) + + # Compare optional fields if present in either set + if 'crl_signer_delegator' in generated_set and 'crl_signer_delegator' in expected: + self.assertEqual(generated_set['crl_signer_delegator'], expected['crl_signer_delegator'], + "CRL signer delegator certificates do not match") + elif 'crl_signer_delegator' in generated_set or 'crl_signer_delegator' in expected: + self.fail("CRL signer delegator certificate is missing in one of the sets") + + def test_paa_revocation_set(self): + """Test generation of PAA revocation set""" + with open(self.get_test_file_path('revoked-attestation-certificates/Chip-Test-PAA-FFF1-CRL.pem'), 'rb') as f: + crl = x509.load_pem_x509_crl(f.read()) + with open(self.get_test_file_path('revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.pem'), 'rb') as f: + crl_signer = x509.load_pem_x509_certificate(f.read()) + + ca_name_b64, ca_akid_hex = get_certificate_authority_details( + crl_signer, None, None, True) + revocation_set = generate_revocation_set_from_crl( + crl, crl_signer, ca_name_b64, ca_akid_hex, None) + + self.compare_revocation_sets( + revocation_set, + 'test/revoked-attestation-certificates/revocation-sets/revocation-set-for-paa.json' + ) + + def test_pai_revocation_set(self): + """Test generation of PAI revocation set""" + with open(self.get_test_file_path('revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-CRL.pem'), 'rb') as f: + crl = x509.load_pem_x509_crl(f.read()) + with open(self.get_test_file_path('revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Cert.pem'), 'rb') as f: + crl_signer = x509.load_pem_x509_certificate(f.read()) + with open(self.get_test_file_path('revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.pem'), 'rb') as f: + paa = x509.load_pem_x509_certificate(f.read()) + + ca_name_b64, ca_akid_hex = get_certificate_authority_details( + crl_signer, None, paa, False) + revocation_set = generate_revocation_set_from_crl( + crl, crl_signer, ca_name_b64, ca_akid_hex, None) + + self.compare_revocation_sets( + revocation_set, + 'test/revoked-attestation-certificates/revocation-sets/revocation-set-for-pai.json' + ) + + +if __name__ == "__main__": + if len(sys.argv) > 1 and sys.argv[1] == 'test': + # Remove the 'test' argument and run tests + sys.argv.pop(1) + unittest.main() + elif len(sys.argv) == 1: + cli.main(['--help']) + else: + cli() diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Cert.der b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Cert.der new file mode 100644 index 00000000000..137e4925cbb Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Cert.der differ diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Cert.pem b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Cert.pem new file mode 100644 index 00000000000..430df7e3fa4 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB4zCCAYqgAwIBAgIIfxwXxgcMItIwCgYIKoZIzj0EAwIwRjEuMCwGA1UEAwwl +TWF0dGVyIFRlc3QgUEFJIDB4RkZGMSBubyBQSUQgUmV2b2tlZDEUMBIGCisGAQQB +gqJ8AgEMBEZGRjEwIBcNMjQxMjEzMDAwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMEYx +GDAWBgNVBAMMD01hdHRlciBUZXN0IERBQzEUMBIGCisGAQQBgqJ8AgEMBEZGRjEx +FDASBgorBgEEAYKifAICDAQ4MDAxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE +sNfyDFfIJAuXVFa6iG0ssJzU+dL1zxQG9GPJeYPzTtWjZ2H2ltiv9PPigoZbw3kU +3rUSquiOWhWnGaS1eiZkD6NgMF4wDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMC +B4AwHQYDVR0OBBYEFDgkjA4XsiI0fkKqua8/3B09YUkEMB8GA1UdIwQYMBaAFJEz +fFz+e7KTdv6IfTyU5/Wd2D0vMAoGCCqGSM49BAMCA0cAMEQCICv4s7VU7+W1P2YS +iRqanmy3JnpVJX7zQUkpslnRt6LhAiBtz9DYStWjLJvQXuxKGw/3pDX+7UvFQPCH +uB9uxQCbog== +-----END CERTIFICATE----- diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Key.der b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Key.der new file mode 100644 index 00000000000..8c90371c492 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Key.der differ diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Key.pem b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Key.pem new file mode 100644 index 00000000000..c73ea8c3b04 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-DAC-FFF1-8001-Signed-By-Revoked-PAI-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIJH6kWQP7l3MWrVt7LHLTS4AVsFrRSgxBMDISewT3M7voAoGCCqGSM49 +AwEHoUQDQgAEsNfyDFfIJAuXVFa6iG0ssJzU+dL1zxQG9GPJeYPzTtWjZ2H2ltiv +9PPigoZbw3kU3rUSquiOWhWnGaS1eiZkDw== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-CRL.der b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-CRL.der new file mode 100644 index 00000000000..e30dd74ac01 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-CRL.der differ diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-CRL.pem b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-CRL.pem new file mode 100644 index 00000000000..223eebea0cc --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-CRL.pem @@ -0,0 +1,8 @@ +-----BEGIN X509 CRL----- +MIIBCDCBrwIBATAKBggqhkjOPQQDAjAwMRgwFgYDVQQDDA9NYXR0ZXIgVGVzdCBQ +QUExFDASBgorBgEEAYKifAIBDARGRkYxFw0yNDEyMTYxMTA1MDNaGA8yMTI0MTIx +NzExMDUwM1owGzAZAggwJmQ5K4o/KhcNMjQxMjEzMDcyMDIxWqAvMC0wHwYDVR0j +BBgwFoAUav0idx9RH+y/FkGXZxDc3DGhcX4wCgYDVR0UBAMCAQIwCgYIKoZIzj0E +AwIDSAAwRQIhAMvFTDo37sY0StA/szyNb5FNtcy/YE6FTmxmsC9kwjpcAiABhqHW +yjWUkyWauRdFT1Uc5MgYADN0u8XcJy9e3Pzphw== +-----END X509 CRL----- diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.der b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.der new file mode 120000 index 00000000000..b5a77a2563a --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.der @@ -0,0 +1 @@ +../../test/attestation/Chip-Test-PAA-FFF1-Cert.der \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.pem b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.pem new file mode 120000 index 00000000000..6f8cddfe119 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Cert.pem @@ -0,0 +1 @@ +../../test/attestation/Chip-Test-PAA-FFF1-Cert.pem \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Key.der b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Key.der new file mode 120000 index 00000000000..cfd5b713a8c --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Key.der @@ -0,0 +1 @@ +../../test/attestation/Chip-Test-PAA-FFF1-Key.der \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Key.pem b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Key.pem new file mode 120000 index 00000000000..4a918d35029 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-PAA-FFF1-Key.pem @@ -0,0 +1 @@ +../../test/attestation/Chip-Test-PAA-FFF1-Key.pem \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Cert.der b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Cert.der new file mode 100644 index 00000000000..75938d29b92 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Cert.der differ diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Cert.pem b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Cert.pem new file mode 100644 index 00000000000..bd3f176a8ef --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB1DCCAXqgAwIBAgIIMCZkOSuKPyowCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDEyMTMw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEuMCwGA1UEAwwlTWF0dGVyIFRlc3Qg +UEFJIDB4RkZGMSBubyBQSUQgUmV2b2tlZDEUMBIGCisGAQQBgqJ8AgEMBEZGRjEw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9WKhPeGLgdRxOVigPFJaX33xRqtxa +T6OTyWJ3pZB53kCQereGDQad5lLqi8j3BTv+fDqO9HANdrnMINsxLK+Ro2YwZDAS +BgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUkTN8 +XP57spN2/oh9PJTn9Z3YPS8wHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGh +cX4wCgYIKoZIzj0EAwIDSAAwRQIhAJx09qhLOstaNp3pA5kRTr8KVRULq9PVKyiY +cIhHvJxuAiBlGIHIG3ogw0a5fGgxPEvhwKiPTzpAcu08fqEdxgmE/A== +-----END CERTIFICATE----- diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Key.der b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Key.der new file mode 100644 index 00000000000..f97a9f798b6 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Key.der differ diff --git a/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Key.pem b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Key.pem new file mode 100644 index 00000000000..38255a1f4c0 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Chip-Test-PAI-FFF1-noPID-Revoked-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIH/u0uB3zq1YnR1XR58XEUVgOnq8mLeBoJH1AYvyJW9joAoGCCqGSM49 +AwEHoUQDQgAEvVioT3hi4HUcTlYoDxSWl998UarcWk+jk8lid6WQed5AkHq3hg0G +neZS6ovI9wU7/nw6jvRwDXa5zCDbMSyvkQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Cert.der b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Cert.der new file mode 100644 index 00000000000..7bb9f34bb11 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Cert.der differ diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Cert.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Cert.pem new file mode 100644 index 00000000000..5ce40ca543d --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB5TCCAYugAwIBAgIIGTZ9l46sUzowCgYIKoZIzj0EAwIwPTElMCMGA1UEAwwc +TWF0dGVyIERldiBQQUkgMHhGRkYxIG5vIFBJRDEUMBIGCisGAQQBgqJ8AgEMBEZG +RjEwIBcNMjQxMjEzMDAwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMFAxIjAgBgNVBAMM +GU1hdHRlciBEZXYgREFDIFJldm9rZWQgMDExFDASBgorBgEEAYKifAIBDARGRkYx +MRQwEgYKKwYBBAGConwCAgwEODAwMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BCo9c3DyIJuxObQsptldvy9wGIi0cY4yxjrnEycUXgUYeGi1KPGpnSRvFHCwzNhV +7pQ4NSbuCQ3guy/eA4/uPgujYDBeMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQD +AgeAMB0GA1UdDgQWBBT1iulTpObPsMw95NxMM6/gl6oRgjAfBgNVHSMEGDAWgBRj +VA5H9kscONE4hKRi0WwZXY/7PDAKBggqhkjOPQQDAgNIADBFAiAYM2RESU1NGMeB +S287Dz9/pd0hJWUVAx2jH9f/jRsQ/QIhAOdcvxcaOJB6kyoWeeXVtCPmoWZynYI/ +7IRPIu85iRKk +-----END CERTIFICATE----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Key.der b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Key.der new file mode 100644 index 00000000000..3cf4d20bcca Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Key.der differ diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Key.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Key.pem new file mode 100644 index 00000000000..8d63c4345c7 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-01-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEICRu6mYqRMtt6T7/1hTpbTcV3oz7bU6XVkTuXmbst5x5oAoGCCqGSM49 +AwEHoUQDQgAEKj1zcPIgm7E5tCym2V2/L3AYiLRxjjLGOucTJxReBRh4aLUo8amd +JG8UcLDM2FXulDg1Ju4JDeC7L94Dj+4+Cw== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Cert.der b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Cert.der new file mode 100644 index 00000000000..34358f094f2 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Cert.der differ diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Cert.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Cert.pem new file mode 100644 index 00000000000..f4a87b41d56 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB5TCCAYugAwIBAgIIJWk4PSS7NuowCgYIKoZIzj0EAwIwPTElMCMGA1UEAwwc +TWF0dGVyIERldiBQQUkgMHhGRkYxIG5vIFBJRDEUMBIGCisGAQQBgqJ8AgEMBEZG +RjEwIBcNMjQxMjEzMDAwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMFAxIjAgBgNVBAMM +GU1hdHRlciBEZXYgREFDIFJldm9rZWQgMDIxFDASBgorBgEEAYKifAIBDARGRkYx +MRQwEgYKKwYBBAGConwCAgwEODAwMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BNlxPEillSfpPno+VJ6PsOAIKdSgLIzt8o39dGcrABmMfuQ/NeOs4dGrSXsy3eTN +1qhHYWIZHJUUrve/EV+2xHKjYDBeMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQD +AgeAMB0GA1UdDgQWBBTjr5GCszQP3IXHpYtLOISmVUsxTzAfBgNVHSMEGDAWgBRj +VA5H9kscONE4hKRi0WwZXY/7PDAKBggqhkjOPQQDAgNIADBFAiEAr76P8JYuh1ow +VO5aLfXEx4wFRltA0xA/mfflYoeA+QMCIBphV/DfeCMiOuJKo6j3phN7SRTGtvXk +Cil9erdx6cvG +-----END CERTIFICATE----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Key.der b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Key.der new file mode 100644 index 00000000000..1aad9d1d643 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Key.der differ diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Key.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Key.pem new file mode 100644 index 00000000000..c2ec7f75ce3 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-02-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEICL40ZprUkEw7MrV0YfOjrfqnX/9WGi04MqRvCtshDmcoAoGCCqGSM49 +AwEHoUQDQgAE2XE8SKWVJ+k+ej5Uno+w4Agp1KAsjO3yjf10ZysAGYx+5D8146zh +0atJezLd5M3WqEdhYhkclRSu978RX7bEcg== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Cert.der b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Cert.der new file mode 100644 index 00000000000..2c96e477f25 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Cert.der differ diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Cert.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Cert.pem new file mode 100644 index 00000000000..e7d91d792d4 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB5jCCAYugAwIBAgIICrBCSUMj/lQwCgYIKoZIzj0EAwIwPTElMCMGA1UEAwwc +TWF0dGVyIERldiBQQUkgMHhGRkYxIG5vIFBJRDEUMBIGCisGAQQBgqJ8AgEMBEZG +RjEwIBcNMjQxMjEzMDAwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMFAxIjAgBgNVBAMM +GU1hdHRlciBEZXYgREFDIFJldm9rZWQgMDMxFDASBgorBgEEAYKifAIBDARGRkYx +MRQwEgYKKwYBBAGConwCAgwEODAwMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA +BCLlc2XpiZD/dQbhHr7DP/g0o5mZ8tnWNe9YR+vgWNh9G/vh5eJBG7bcEfPyfoQs +wMyr4CpPJp1Q9coHKiY12wSjYDBeMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQD +AgeAMB0GA1UdDgQWBBQq0efT8UgAKTZu5MXwcQfySp2brTAfBgNVHSMEGDAWgBRj +VA5H9kscONE4hKRi0WwZXY/7PDAKBggqhkjOPQQDAgNJADBGAiEA5mlgzDtuph+I +ML94iDAWa1xqMY6DKEYEqVvCZVvYdOsCIQD1A4Bnl6USq1CTEugIL8goYiaW09dQ +H38+aLYav+W9uA== +-----END CERTIFICATE----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Key.der b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Key.der new file mode 100644 index 00000000000..6668555970c Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Key.der differ diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Key.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Key.pem new file mode 100644 index 00000000000..c3e74a51e8d --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-DAC-FFF1-8001-Revoked-03-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIJjC2LN18deS5XLHAbR0Dn+4Gp6cyTaqKg+HbOja5VeMoAoGCCqGSM49 +AwEHoUQDQgAEIuVzZemJkP91BuEevsM/+DSjmZny2dY171hH6+BY2H0b++Hl4kEb +ttwR8/J+hCzAzKvgKk8mnVD1ygcqJjXbBA== +-----END EC PRIVATE KEY----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-CRL.der b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-CRL.der new file mode 100644 index 00000000000..df0a65cf194 Binary files /dev/null and b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-CRL.der differ diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-CRL.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-CRL.pem new file mode 100644 index 00000000000..48ed82ad731 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-CRL.pem @@ -0,0 +1,9 @@ +-----BEGIN X509 CRL----- +MIIBSjCB8gIBATAKBggqhkjOPQQDAjA9MSUwIwYDVQQDDBxNYXR0ZXIgRGV2IFBB +SSAweEZGRjEgbm8gUElEMRQwEgYKKwYBBAGConwCAQwERkZGMRcNMjQxMjE2MTEx +NjA2WhgPMjEyNDEyMTcxMTE2MDZaMFEwGQIICrBCSUMj/lQXDTI0MTIxMzA3MTUz +MlowGQIIGTZ9l46sUzoXDTI0MTIxMzA3MTUyNFowGQIIJWk4PSS7NuoXDTI0MTIx +MzA3MTUyOFqgLzAtMB8GA1UdIwQYMBaAFGNUDkf2Sxw40TiEpGLRbBldj/s8MAoG +A1UdFAQDAgEEMAoGCCqGSM49BAMCA0cAMEQCIByf5LFJrnfa/5jA6PfQmaJcJ7Jl +gv6bezlfodLtO8CqAiBL1+I4+ETEN0h0+rvkM5CQWoLK76XNb92OV1Mn9E3DQw== +-----END X509 CRL----- diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Cert.der b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Cert.der new file mode 120000 index 00000000000..0da70a86140 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Cert.der @@ -0,0 +1 @@ +../../development/attestation/Matter-Development-PAI-FFF1-noPID-Cert.der \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Cert.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Cert.pem new file mode 120000 index 00000000000..c2bf83f9fc2 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Cert.pem @@ -0,0 +1 @@ +../../development/attestation/Matter-Development-PAI-FFF1-noPID-Cert.pem \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Key.der b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Key.der new file mode 120000 index 00000000000..4f62d20ae05 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Key.der @@ -0,0 +1 @@ +../../development/attestation/Matter-Development-PAI-FFF1-noPID-Key.der \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Key.pem b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Key.pem new file mode 120000 index 00000000000..1874a5a2b37 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/Matter-Development-PAI-FFF1-noPID-Key.pem @@ -0,0 +1 @@ +../../development/attestation/Matter-Development-PAI-FFF1-noPID-Key.pem \ No newline at end of file diff --git a/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-01.json b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-01.json new file mode 100644 index 00000000000..05dc6b0cc80 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-01.json @@ -0,0 +1,9 @@ +{ + "description": "Revoked DAC 01: use this with revocation-sets/revocation-set-for-pai.json", + "basic_info_pid": 32769, + "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304306092a864886f70d010701a0360434152400012501f1ff3602050180182403162c0413435341303030303053574330303030302d303124050024060024070124080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502204dc6be89beeb5a49adec51ee7f0e6d1263ffc9e6238f2044385a5e0c86751b83022100ed902842f7a5784368d63eba6a2fb90086dd65a0ce3c283d86b915a3536afdac", + "pai_cert": "308201cb30820171a003020102020856ad8222ad945b64300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303230353030303030305a180f39393939313233313233353935395a303d3125302306035504030c1c4d6174746572204465762050414920307846464631206e6f2050494431143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004419a9315c2173e0c8c876d03ccfc944852647f7fec5e5082f4059928eca894c594151309ac631e4cb03392af684b0bafb7e65b3b8162c2f52bf931b8e77aaa82a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041463540e47f64b1c38d13884a462d16c195d8ffb3c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100b2ef27f49ae9b50fb91eeac94c4d0bdbb8d7929c6cb88face529368d12054c0c0220655dc92b86bd909882a6c62177b825d7d05edbe7c22f9fea71220e7ea703f891", + "dac_cert": "308201e53082018ba003020102020819367d978eac533a300a06082a8648ce3d040302303d3125302306035504030c1c4d6174746572204465762050414920307846464631206e6f2050494431143012060a2b0601040182a27c02010c04464646313020170d3234313231333030303030305a180f39393939313233313233353935395a30503122302006035504030c194d61747465722044657620444143205265766f6b656420303131143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d030107034200042a3d7370f2209bb139b42ca6d95dbf2f701888b4718e32c63ae71327145e05187868b528f1a99d246f1470b0ccd855ee94383526ee090de0bb2fde038fee3e0ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f58ae953a4e6cfb0cc3de4dc4c33afe097aa1182301f0603551d2304183016801463540e47f64b1c38d13884a462d16c195d8ffb3c300a06082a8648ce3d0403020348003045022018336444494d4d18c7814b6f3b0f3f7fa5dd21256515031da31fd7ff8d1b10fd022100e75cbf171a38907a932a1679e5d5b423e6a166729d823fec844f22ef398912a4", + "dac_private_key": "246eea662a44cb6de93effd614e96d3715de8cfb6d4e975644ee5e66ecb79c79", + "dac_public_key": "042a3d7370f2209bb139b42ca6d95dbf2f701888b4718e32c63ae71327145e05187868b528f1a99d246f1470b0ccd855ee94383526ee090de0bb2fde038fee3e0b" +} diff --git a/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-02.json b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-02.json new file mode 100644 index 00000000000..ab3f927e8bd --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-02.json @@ -0,0 +1,9 @@ +{ + "description": "Revoked DAC 02: use this with revocation-sets/revocation-set-for-pai.json", + "basic_info_pid": 32769, + "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304306092a864886f70d010701a0360434152400012501f1ff3602050180182403162c0413435341303030303053574330303030302d303124050024060024070124080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502204dc6be89beeb5a49adec51ee7f0e6d1263ffc9e6238f2044385a5e0c86751b83022100ed902842f7a5784368d63eba6a2fb90086dd65a0ce3c283d86b915a3536afdac", + "pai_cert": "308201cb30820171a003020102020856ad8222ad945b64300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303230353030303030305a180f39393939313233313233353935395a303d3125302306035504030c1c4d6174746572204465762050414920307846464631206e6f2050494431143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004419a9315c2173e0c8c876d03ccfc944852647f7fec5e5082f4059928eca894c594151309ac631e4cb03392af684b0bafb7e65b3b8162c2f52bf931b8e77aaa82a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041463540e47f64b1c38d13884a462d16c195d8ffb3c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100b2ef27f49ae9b50fb91eeac94c4d0bdbb8d7929c6cb88face529368d12054c0c0220655dc92b86bd909882a6c62177b825d7d05edbe7c22f9fea71220e7ea703f891", + "dac_cert": "308201e53082018ba00302010202082569383d24bb36ea300a06082a8648ce3d040302303d3125302306035504030c1c4d6174746572204465762050414920307846464631206e6f2050494431143012060a2b0601040182a27c02010c04464646313020170d3234313231333030303030305a180f39393939313233313233353935395a30503122302006035504030c194d61747465722044657620444143205265766f6b656420303231143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d03010703420004d9713c48a59527e93e7a3e549e8fb0e00829d4a02c8cedf28dfd74672b00198c7ee43f35e3ace1d1ab497b32dde4cdd6a8476162191c9514aef7bf115fb6c472a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e3af9182b3340fdc85c7a58b4b3884a6554b314f301f0603551d2304183016801463540e47f64b1c38d13884a462d16c195d8ffb3c300a06082a8648ce3d0403020348003045022100afbe8ff0962e875a3054ee5a2df5c4c78c05465b40d3103f99f7e5628780f90302201a6157f0df7823223ae24aa3a8f7a6137b4914c6b6f5e40a297d7ab771e9cbc6", + "dac_private_key": "22f8d19a6b524130eccad5d187ce8eb7ea9d7ffd5868b4e0ca91bc2b6c84399c", + "dac_public_key": "04d9713c48a59527e93e7a3e549e8fb0e00829d4a02c8cedf28dfd74672b00198c7ee43f35e3ace1d1ab497b32dde4cdd6a8476162191c9514aef7bf115fb6c472" +} diff --git a/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-03.json b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-03.json new file mode 100644 index 00000000000..a629f86bd57 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-03.json @@ -0,0 +1,9 @@ +{ + "description": "Revoked DAC 03: use this with revocation-sets/revocation-set-for-pai.json", + "basic_info_pid": 32769, + "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304306092a864886f70d010701a0360434152400012501f1ff3602050180182403162c0413435341303030303053574330303030302d303124050024060024070124080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502204dc6be89beeb5a49adec51ee7f0e6d1263ffc9e6238f2044385a5e0c86751b83022100ed902842f7a5784368d63eba6a2fb90086dd65a0ce3c283d86b915a3536afdac", + "pai_cert": "308201cb30820171a003020102020856ad8222ad945b64300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303230353030303030305a180f39393939313233313233353935395a303d3125302306035504030c1c4d6174746572204465762050414920307846464631206e6f2050494431143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004419a9315c2173e0c8c876d03ccfc944852647f7fec5e5082f4059928eca894c594151309ac631e4cb03392af684b0bafb7e65b3b8162c2f52bf931b8e77aaa82a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041463540e47f64b1c38d13884a462d16c195d8ffb3c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100b2ef27f49ae9b50fb91eeac94c4d0bdbb8d7929c6cb88face529368d12054c0c0220655dc92b86bd909882a6c62177b825d7d05edbe7c22f9fea71220e7ea703f891", + "dac_cert": "308201e63082018ba00302010202080ab042494323fe54300a06082a8648ce3d040302303d3125302306035504030c1c4d6174746572204465762050414920307846464631206e6f2050494431143012060a2b0601040182a27c02010c04464646313020170d3234313231333030303030305a180f39393939313233313233353935395a30503122302006035504030c194d61747465722044657620444143205265766f6b656420303331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d0301070342000422e57365e98990ff7506e11ebec33ff834a39999f2d9d635ef5847ebe058d87d1bfbe1e5e2411bb6dc11f3f27e842cc0ccabe02a4f269d50f5ca072a2635db04a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604142ad1e7d3f1480029366ee4c5f07107f24a9d9bad301f0603551d2304183016801463540e47f64b1c38d13884a462d16c195d8ffb3c300a06082a8648ce3d0403020349003046022100e66960cc3b6ea61f8830bf788830166b5c6a318e83284604a95bc2655bd874eb022100f503806797a512ab509312e8082fc828622696d3d7501f7f3e68b61abfe5bdb8", + "dac_private_key": "98c2d8b375f1d792e572c701b4740e7fb81a9e9cc936aa2a0f876ce8dae5578c", + "dac_public_key": "0422e57365e98990ff7506e11ebec33ff834a39999f2d9d635ef5847ebe058d87d1bfbe1e5e2411bb6dc11f3f27e842cc0ccabe02a4f269d50f5ca072a2635db04" +} diff --git a/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-pai.json b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-pai.json new file mode 100644 index 00000000000..9f20a423330 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-pai.json @@ -0,0 +1,9 @@ +{ + "description": "Revoked PAI: use this with revocation-sets/revocation-set-for-paa.json", + "basic_info_pid": 32769, + "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304306092a864886f70d010701a0360434152400012501f1ff3602050180182403162c0413435341303030303053574330303030302d303124050024060024070124080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502204dc6be89beeb5a49adec51ee7f0e6d1263ffc9e6238f2044385a5e0c86751b83022100ed902842f7a5784368d63eba6a2fb90086dd65a0ce3c283d86b915a3536afdac", + "pai_cert": "308201d43082017aa0030201020208302664392b8a3f2a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234313231333030303030305a180f39393939313233313233353935395a3046312e302c06035504030c254d617474657220546573742050414920307846464631206e6f20504944205265766f6b656431143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004bd58a84f7862e0751c4e56280f149697df7c51aadc5a4fa393c96277a59079de40907ab7860d069de652ea8bc8f7053bfe7c3a8ef4700d76b9cc20db312caf91a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041491337c5cfe7bb29376fe887d3c94e7f59dd83d2f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009c74f6a84b3acb5a369de90399114ebf0a55150babd3d52b2898708847bc9c6e0220651881c81b7a20c346b97c68313c4be1c0a88f4f3a4072ed3c7ea11dc60984fc", + "dac_cert": "308201e33082018aa00302010202087f1c17c6070c22d2300a06082a8648ce3d0403023046312e302c06035504030c254d617474657220546573742050414920307846464631206e6f20504944205265766f6b656431143012060a2b0601040182a27c02010c04464646313020170d3234313231333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d03010703420004b0d7f20c57c8240b975456ba886d2cb09cd4f9d2f5cf1406f463c97983f34ed5a36761f696d8aff4f3e282865bc37914deb512aae88e5a15a719a4b57a26640fa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041438248c0e17b222347e42aab9af3fdc1d3d614904301f0603551d2304183016801491337c5cfe7bb29376fe887d3c94e7f59dd83d2f300a06082a8648ce3d040302034700304402202bf8b3b554efe5b53f6612891a9a9e6cb7267a55257ef3414929b259d1b7a2e102206dcfd0d84ad5a32c9bd05eec4a1b0ff7a435feed4bc540f087b81f6ec5009ba2", + "dac_private_key": "91fa91640fee5dcc5ab56decb1cb4d2e0056c16b45283104c0c849ec13dcceef", + "dac_public_key": "04b0d7f20c57c8240b975456ba886d2cb09cd4f9d2f5cf1406f463c97983f34ed5a36761f696d8aff4f3e282865bc37914deb512aae88e5a15a719a4b57a26640f" +} diff --git a/credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-paa.json b/credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-paa.json new file mode 100644 index 00000000000..93edb94c129 --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-paa.json @@ -0,0 +1,9 @@ +[ + { + "type": "revocation_set", + "issuer_subject_key_id": "6AFD22771F511FECBF1641976710DCDC31A1717E", + "issuer_name": "MDAxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQTEUMBIGCisGAQQBgqJ8AgEMBEZGRjE=", + "revoked_serial_numbers": ["302664392B8A3F2A"], + "crl_signer_cert": "MIIBvTCCAWSgAwIBAgIITqjoMYLUHBwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMTA2MjgxNDIzNDNaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLbLY3KIfyko9brIGqnZOuJDHK2p154kL2UXfvnO2TKijs0Duq9qj8oYShpQNUKWDUU/MD8fGUIddR6Pjxqam3WjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAfBgNVHSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBQqoAC9NkyqaAFOPZTaK0P/8jvu8m+t9pWmDXPmqdRDgIgI7rI/g8j51RFtlM5CBpHmUkpxyqvChVI1A0DTVFLJd4=" + } +] diff --git a/credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-pai.json b/credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-pai.json new file mode 100644 index 00000000000..46c3c1b66cd --- /dev/null +++ b/credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-pai.json @@ -0,0 +1,13 @@ +[ + { + "type": "revocation_set", + "issuer_subject_key_id": "63540E47F64B1C38D13884A462D16C195D8FFB3C", + "issuer_name": "MD0xJTAjBgNVBAMMHE1hdHRlciBEZXYgUEFJIDB4RkZGMSBubyBQSUQxFDASBgorBgEEAYKifAIBDARGRkYx", + "revoked_serial_numbers": [ + "0AB042494323FE54", + "19367D978EAC533A", + "2569383D24BB36EA" + ], + "crl_signer_cert": "MIIByzCCAXGgAwIBAgIIVq2CIq2UW2QwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjAyMDUwMDAwMDBaGA85OTk5MTIzMTIzNTk1OVowPTElMCMGA1UEAwwcTWF0dGVyIERldiBQQUkgMHhGRkYxIG5vIFBJRDEUMBIGCisGAQQBgqJ8AgEMBEZGRjEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARBmpMVwhc+DIyHbQPM/JRIUmR/f+xeUIL0BZko7KiUxZQVEwmsYx5MsDOSr2hLC6+35ls7gWLC9Sv5MbjneqqCo2YwZDASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUY1QOR/ZLHDjROISkYtFsGV2P+zwwHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGhcX4wCgYIKoZIzj0EAwIDSAAwRQIhALLvJ/Sa6bUPuR7qyUxNC9u415KcbLiPrOUpNo0SBUwMAiBlXckrhr2QmIKmxiF3uCXX0F7b58Ivn+pxIg5+pwP4kQ==" + } +] diff --git a/data_model/1.4/clusters/DemandResponseLoadControl.xml b/data_model/1.4/clusters/DemandResponseLoadControl.xml deleted file mode 100644 index 1acd1ea26c6..00000000000 --- a/data_model/1.4/clusters/DemandResponseLoadControl.xml +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/DeviceEnergyManagement.xml b/data_model/1.4/clusters/DeviceEnergyManagement.xml index 776a06f20b3..3b95a7b8d44 100644 --- a/data_model/1.4/clusters/DeviceEnergyManagement.xml +++ b/data_model/1.4/clusters/DeviceEnergyManagement.xml @@ -65,9 +65,7 @@ Davis, CA 95616, USA - - - + @@ -566,7 +564,6 @@ Davis, CA 95616, USA - @@ -580,7 +577,6 @@ Davis, CA 95616, USA - @@ -604,7 +600,6 @@ Davis, CA 95616, USA - @@ -619,7 +614,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.4/clusters/DiagnosticsGeneral.xml b/data_model/1.4/clusters/DiagnosticsGeneral.xml index 44b891fbcd6..1266705ba6d 100644 --- a/data_model/1.4/clusters/DiagnosticsGeneral.xml +++ b/data_model/1.4/clusters/DiagnosticsGeneral.xml @@ -263,7 +263,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.4/clusters/DiagnosticsThread.xml b/data_model/1.4/clusters/DiagnosticsThread.xml index a55412d7fd3..a712cebc8f1 100644 --- a/data_model/1.4/clusters/DiagnosticsThread.xml +++ b/data_model/1.4/clusters/DiagnosticsThread.xml @@ -669,12 +669,18 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/1.4/clusters/DoorLock.xml b/data_model/1.4/clusters/DoorLock.xml index 46d659da94a..932532c768d 100644 --- a/data_model/1.4/clusters/DoorLock.xml +++ b/data_model/1.4/clusters/DoorLock.xml @@ -66,7 +66,7 @@ Davis, CA 95616, USA - @@ -600,9 +600,6 @@ Davis, CA 95616, USA - - - diff --git a/data_model/1.4/clusters/EcosystemInformationCluster.xml b/data_model/1.4/clusters/EcosystemInformationCluster.xml new file mode 100644 index 00000000000..ddebe956793 --- /dev/null +++ b/data_model/1.4/clusters/EcosystemInformationCluster.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/1.4/clusters/EnergyCalendar.xml b/data_model/1.4/clusters/EnergyCalendar.xml deleted file mode 100644 index 2ba93203618..00000000000 --- a/data_model/1.4/clusters/EnergyCalendar.xml +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/EnergyEVSE.xml b/data_model/1.4/clusters/EnergyEVSE.xml index a4c865c3096..352ac7e24ad 100644 --- a/data_model/1.4/clusters/EnergyEVSE.xml +++ b/data_model/1.4/clusters/EnergyEVSE.xml @@ -69,10 +69,7 @@ Davis, CA 95616, USA - - - - + @@ -240,7 +237,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.4/clusters/Humidistat.xml b/data_model/1.4/clusters/Humidistat.xml deleted file mode 100644 index 1af54698489..00000000000 --- a/data_model/1.4/clusters/Humidistat.xml +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/ICDManagement.xml b/data_model/1.4/clusters/ICDManagement.xml index b6f76f48e2b..d9cb7397da7 100644 --- a/data_model/1.4/clusters/ICDManagement.xml +++ b/data_model/1.4/clusters/ICDManagement.xml @@ -70,7 +70,6 @@ Davis, CA 95616, USA - @@ -79,7 +78,6 @@ Davis, CA 95616, USA - @@ -87,18 +85,12 @@ Davis, CA 95616, USA - - - - + - - - - - - + + + @@ -227,12 +219,9 @@ Davis, CA 95616, USA - - - - - - + + + @@ -242,12 +231,9 @@ Davis, CA 95616, USA - - - - - - + + + diff --git a/data_model/1.4/clusters/LevelControl.xml b/data_model/1.4/clusters/LevelControl.xml index 404b1250e90..1a034d5802b 100644 --- a/data_model/1.4/clusters/LevelControl.xml +++ b/data_model/1.4/clusters/LevelControl.xml @@ -165,7 +165,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.4/clusters/Mode_DeviceEnergyManagement.xml b/data_model/1.4/clusters/Mode_DeviceEnergyManagement.xml index 48cf6df4955..9fca7f31ca0 100644 --- a/data_model/1.4/clusters/Mode_DeviceEnergyManagement.xml +++ b/data_model/1.4/clusters/Mode_DeviceEnergyManagement.xml @@ -63,9 +63,7 @@ Davis, CA 95616, USA - - - + diff --git a/data_model/1.4/clusters/Mode_Dishwasher.xml b/data_model/1.4/clusters/Mode_Dishwasher.xml index 1c3a99b9e3d..ca14d02672d 100644 --- a/data_model/1.4/clusters/Mode_Dishwasher.xml +++ b/data_model/1.4/clusters/Mode_Dishwasher.xml @@ -57,10 +57,11 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/1.4/clusters/Mode_EVSE.xml b/data_model/1.4/clusters/Mode_EVSE.xml index 025e9de9884..863a2b7d644 100644 --- a/data_model/1.4/clusters/Mode_EVSE.xml +++ b/data_model/1.4/clusters/Mode_EVSE.xml @@ -60,7 +60,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.4/clusters/Mode_LaundryWasher.xml b/data_model/1.4/clusters/Mode_LaundryWasher.xml index b5f557a4b46..a13253304d2 100644 --- a/data_model/1.4/clusters/Mode_LaundryWasher.xml +++ b/data_model/1.4/clusters/Mode_LaundryWasher.xml @@ -57,10 +57,11 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/1.4/clusters/Mode_MicrowaveOven.xml b/data_model/1.4/clusters/Mode_MicrowaveOven.xml index 24d682fecac..371b2948491 100644 --- a/data_model/1.4/clusters/Mode_MicrowaveOven.xml +++ b/data_model/1.4/clusters/Mode_MicrowaveOven.xml @@ -57,9 +57,10 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/1.4/clusters/Mode_Oven.xml b/data_model/1.4/clusters/Mode_Oven.xml index a3e3323fe98..071f70d277a 100644 --- a/data_model/1.4/clusters/Mode_Oven.xml +++ b/data_model/1.4/clusters/Mode_Oven.xml @@ -57,9 +57,10 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/1.4/clusters/Mode_Refrigerator.xml b/data_model/1.4/clusters/Mode_Refrigerator.xml index 2728ac0f42b..692740e090f 100644 --- a/data_model/1.4/clusters/Mode_Refrigerator.xml +++ b/data_model/1.4/clusters/Mode_Refrigerator.xml @@ -57,10 +57,11 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/1.4/clusters/OccupancySensing.xml b/data_model/1.4/clusters/OccupancySensing.xml index 7ca0d3631db..7400dde084f 100644 --- a/data_model/1.4/clusters/OccupancySensing.xml +++ b/data_model/1.4/clusters/OccupancySensing.xml @@ -173,7 +173,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.4/clusters/OperationalState.xml b/data_model/1.4/clusters/OperationalState.xml index 354efa2400b..d02635cf65f 100644 --- a/data_model/1.4/clusters/OperationalState.xml +++ b/data_model/1.4/clusters/OperationalState.xml @@ -203,10 +203,7 @@ Davis, CA 95616, USA - - - - + diff --git a/data_model/1.4/clusters/OperationalState_Oven.xml b/data_model/1.4/clusters/OperationalState_Oven.xml index 710dea9806b..e743fbf1d77 100644 --- a/data_model/1.4/clusters/OperationalState_Oven.xml +++ b/data_model/1.4/clusters/OperationalState_Oven.xml @@ -57,9 +57,10 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/1.4/clusters/OperationalState_RVC.xml b/data_model/1.4/clusters/OperationalState_RVC.xml index 9b83bc4dfde..fb9fea9d5d4 100644 --- a/data_model/1.4/clusters/OperationalState_RVC.xml +++ b/data_model/1.4/clusters/OperationalState_RVC.xml @@ -117,10 +117,7 @@ Davis, CA 95616, USA - - - - + \ No newline at end of file diff --git a/data_model/1.4/clusters/PumpConfigurationControl.xml b/data_model/1.4/clusters/PumpConfigurationControl.xml index 9b7e4ab56dc..2be5a443718 100644 --- a/data_model/1.4/clusters/PumpConfigurationControl.xml +++ b/data_model/1.4/clusters/PumpConfigurationControl.xml @@ -373,11 +373,8 @@ Davis, CA 95616, USA - - - + - diff --git a/data_model/1.4/clusters/Scenes.xml b/data_model/1.4/clusters/Scenes.xml index 1479d3ffd7d..3de80abbc56 100644 --- a/data_model/1.4/clusters/Scenes.xml +++ b/data_model/1.4/clusters/Scenes.xml @@ -373,14 +373,16 @@ Davis, CA 95616, USA - + + - + + diff --git a/data_model/1.4/clusters/ThermostatUserInterfaceConfiguration.xml b/data_model/1.4/clusters/ThermostatUserInterfaceConfiguration.xml index d6a52248282..8b33ccedbd2 100644 --- a/data_model/1.4/clusters/ThermostatUserInterfaceConfiguration.xml +++ b/data_model/1.4/clusters/ThermostatUserInterfaceConfiguration.xml @@ -106,17 +106,14 @@ Davis, CA 95616, USA - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/WaterHeaterManagement.xml b/data_model/1.4/clusters/WaterHeaterManagement.xml index 96dcc2b1124..49cdf1eeb25 100644 --- a/data_model/1.4/clusters/WaterHeaterManagement.xml +++ b/data_model/1.4/clusters/WaterHeaterManagement.xml @@ -168,7 +168,6 @@ Davis, CA 95616, USA - @@ -182,7 +181,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.4/clusters/bridge-clusters-EcosystemInformationCluster.xml b/data_model/1.4/clusters/bridge-clusters-EcosystemInformationCluster.xml deleted file mode 100644 index 67c2bbbd108..00000000000 --- a/data_model/1.4/clusters/bridge-clusters-EcosystemInformationCluster.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/clusters/cluster_ids.json b/data_model/1.4/clusters/cluster_ids.json index 9de2f243b37..687bbc32298 100644 --- a/data_model/1.4/clusters/cluster_ids.json +++ b/data_model/1.4/clusters/cluster_ids.json @@ -64,11 +64,9 @@ "144": "Electrical Power Measurement", "145": "Electrical Energy Measurement", "148": "Water Heater Management", - "150": "Demand Response Load Control", "151": "Messages", "152": "Device Energy Management", "153": "Energy EVSE", - "154": "Energy Calendar", "155": "Energy Preference", "156": "Power Topology", "157": "Energy EVSE Mode", @@ -81,7 +79,6 @@ "513": "Thermostat", "514": "Fan Control", "516": "Thermostat User Interface Configuration", - "517": "Humidistat", "768": "Color Control", "769": "Ballast Configuration", "1024": "Illuminance Measurement", diff --git a/data_model/1.4/device_types/DeviceEnergyManagement.xml b/data_model/1.4/device_types/DeviceEnergyManagement.xml index 86efccc02f6..0a90a21edb8 100644 --- a/data_model/1.4/device_types/DeviceEnergyManagement.xml +++ b/data_model/1.4/device_types/DeviceEnergyManagement.xml @@ -63,10 +63,7 @@ Davis, CA 95616, USA - - - - + @@ -77,7 +74,6 @@ Davis, CA 95616, USA - diff --git a/data_model/1.4/device_types/EnergyTariff.xml b/data_model/1.4/device_types/EnergyTariff.xml deleted file mode 100644 index 887bfa420d8..00000000000 --- a/data_model/1.4/device_types/EnergyTariff.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/device_types/EnergyTariffCalendar.xml b/data_model/1.4/device_types/EnergyTariffCalendar.xml deleted file mode 100644 index 70d74b7239f..00000000000 --- a/data_model/1.4/device_types/EnergyTariffCalendar.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/device_types/HeatPump.xml b/data_model/1.4/device_types/HeatPump.xml index 61f556c6ed2..012060e034b 100644 --- a/data_model/1.4/device_types/HeatPump.xml +++ b/data_model/1.4/device_types/HeatPump.xml @@ -65,7 +65,7 @@ Davis, CA 95616, USA - + diff --git a/data_model/1.4/device_types/HumidifierDehumidifier.xml b/data_model/1.4/device_types/HumidifierDehumidifier.xml deleted file mode 100644 index 973919635fb..00000000000 --- a/data_model/1.4/device_types/HumidifierDehumidifier.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/data_model/1.4/device_types/RootNodeDeviceType.xml b/data_model/1.4/device_types/RootNodeDeviceType.xml index 13473e44cac..99ce8fc319a 100644 --- a/data_model/1.4/device_types/RootNodeDeviceType.xml +++ b/data_model/1.4/device_types/RootNodeDeviceType.xml @@ -160,16 +160,16 @@ Davis, CA 95616, USA - + + + + - - - - - - + + + diff --git a/data_model/1.4/spec_sha b/data_model/1.4/spec_sha index 094141d3c09..6f7d9bd245a 100644 --- a/data_model/1.4/spec_sha +++ b/data_model/1.4/spec_sha @@ -1 +1 @@ -2760ea4338a4b612ac025bfa5677e6918041c1d4 +21812107312887c416632ed6dd2399af1f077548 diff --git a/docs/README.md b/docs/README.md index e5aad317e6d..e96ab29f042 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,6 +15,11 @@ [Visual Studio Code](https://code.visualstudio.com/) can be found in [the development guide](./VSCODE_DEVELOPMENT.md) +## Issue triage + +Project issues are triaged and maintained according to the +[issue triage](./issue_triage.md) guide. + ## Platform Guides - Various guides are available [here](./guides/README.md) that cover platform diff --git a/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md b/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md index e2460ff5a0a..ad509ea57a4 100644 --- a/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md +++ b/docs/cluster_and_device_type_dev/cluster_and_device_type_dev.md @@ -1,4 +1,4 @@ -# New Clusters & Device Types +# Implementing New Clusters & Device Types The goal of new cluster and device type development is to @@ -48,11 +48,11 @@ Note that the output should also be verified against the spec using the - Goal: get zap to understand the new cluster so it can be used on devices (XML and glue) -![](../getting_started/img/zap_compiler.png) +![](../zap_and_codegen/img/zap_compiler.png) ### Cluster definitions and ZAP -Please see [ZAP](../getting_started/zap.md) for an introduction to ZAP. +Please see [ZAP](../zap_and_codegen/zap_intro.md) for an introduction to ZAP. After implementing the changes outlined in the wiki article, your cluster and device type should show up in zap. you can check this by running zaptool with @@ -64,17 +64,17 @@ To ensure the cluster and device type are correctly implemented for ZAP, open the endpoint configuration and ensure the device type appears in the device type list. -![](../getting_started/img/zap3.png) +![](../zap_and_codegen/img/zap3.png) Next, check your cluster. The "domain" parameter in the XML controls which group the cluster is in. It should have all the expected attributes, commands and events. -![](../getting_started/img/zap4.png) +![](../zap_and_codegen/img/zap4.png) Last, ensure that your attributes have the storage option set appropriately. -![](../getting_started/img/zap5.png) +![](../zap_and_codegen/img/zap5.png) ### Cluster implementation - Ember and overrides diff --git a/docs/cluster_and_device_type_dev/how_to_add_new_dts_and_clusters.md b/docs/cluster_and_device_type_dev/how_to_add_new_dts_and_clusters.md index 90d82c60310..3e3704699d1 100644 --- a/docs/cluster_and_device_type_dev/how_to_add_new_dts_and_clusters.md +++ b/docs/cluster_and_device_type_dev/how_to_add_new_dts_and_clusters.md @@ -1,4 +1,4 @@ -# How to Add New Device Types & Clusters +# Adding new clusters and device types to the codegen This document outlines the process needed to add a new Matter device type and related clusters. Obviously, the steps below assume that the related Matter diff --git a/docs/cluster_and_device_type_dev/index.md b/docs/cluster_and_device_type_dev/index.md index cf43d026513..0ec65df347f 100644 --- a/docs/cluster_and_device_type_dev/index.md +++ b/docs/cluster_and_device_type_dev/index.md @@ -13,5 +13,5 @@ types in the SDK. ``` - [Cluster and device type development](./cluster_and_device_type_dev.md) -- [How To Add New Device Types & Clusters](how_to_add_new_dts_and_clusters.md) +- [How To Add New Device Types & Clusters](./how_to_add_new_dts_and_clusters.md) - [Cluster Server design](./unit_testing_clusters.md) diff --git a/docs/guides/repl/Matter_Access_Control.ipynb b/docs/development_controllers/chip-repl/Matter_Access_Control.ipynb similarity index 100% rename from docs/guides/repl/Matter_Access_Control.ipynb rename to docs/development_controllers/chip-repl/Matter_Access_Control.ipynb diff --git a/docs/guides/repl/Matter_Basic_Interactions.ipynb b/docs/development_controllers/chip-repl/Matter_Basic_Interactions.ipynb similarity index 100% rename from docs/guides/repl/Matter_Basic_Interactions.ipynb rename to docs/development_controllers/chip-repl/Matter_Basic_Interactions.ipynb diff --git a/docs/guides/repl/Matter_Multi_Fabric_Commissioning.ipynb b/docs/development_controllers/chip-repl/Matter_Multi_Fabric_Commissioning.ipynb similarity index 100% rename from docs/guides/repl/Matter_Multi_Fabric_Commissioning.ipynb rename to docs/development_controllers/chip-repl/Matter_Multi_Fabric_Commissioning.ipynb diff --git a/docs/guides/repl/Matter_REPL_Intro.ipynb b/docs/development_controllers/chip-repl/Matter_REPL_Intro.ipynb similarity index 100% rename from docs/guides/repl/Matter_REPL_Intro.ipynb rename to docs/development_controllers/chip-repl/Matter_REPL_Intro.ipynb diff --git a/docs/development_controllers/chip-repl/index.md b/docs/development_controllers/chip-repl/index.md new file mode 100644 index 00000000000..b17962ab667 --- /dev/null +++ b/docs/development_controllers/chip-repl/index.md @@ -0,0 +1,15 @@ +# chip-repl + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +- [Matter REPL](./matter-repl.md) +- [Intro](./Matter_REPL_Intro.ipynb) +- [Access Control](./Matter_Access_Control.ipynb) +- [Basic interactions](./Matter_Basic_Interactions.ipynb) +- [Fabric Commissioning](./Matter_Multi_Fabric_Commissioning.ipynb) diff --git a/docs/guides/matter-repl.md b/docs/development_controllers/chip-repl/matter-repl.md similarity index 97% rename from docs/guides/matter-repl.md rename to docs/development_controllers/chip-repl/matter-repl.md index e7ebba5b3e1..9bb3e609169 100644 --- a/docs/guides/matter-repl.md +++ b/docs/development_controllers/chip-repl/matter-repl.md @@ -244,8 +244,8 @@ Some tests provides the option to exclude them. For example, you can use It is recommended to use the test wrapper to run mobile-device-test.py, for example, you can run: -``` -./scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset +```shell +./scripts/tests/run_python_test.py --app chip-all-clusters-app --factory-reset ``` It provides some extra options, for example: @@ -254,7 +254,7 @@ It provides some extra options, for example: optional arguments: -h, --help show this help message and exit --app APP Path to local application to use, omit to use external apps. - --factoryreset Remove app config and repl configs (/tmp/chip* and /tmp/repl*) before running the tests. + --factory-reset Remove app config and repl configs (/tmp/chip* and /tmp/repl*) before running the tests. --app-args APP_ARGS The extra parameters passed to the device side app. --script SCRIPT Path to the test script to use, omit to use the default test script (mobile-device-test.py). --script-args SCRIPT_ARGS Arguments for the REPL test script @@ -263,8 +263,8 @@ optional arguments: You can pass your own flags for mobile-device-test.py by appending them to the command line with two dashes, for example: -``` -./scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factoryreset --script-args "-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout" +```shell +./scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factory-reset --script-args "-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout" ``` will pass `-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout` to diff --git a/docs/guides/python_chip_controller_advanced_usage.md b/docs/development_controllers/chip-repl/python_chip_controller_advanced_usage.md similarity index 100% rename from docs/guides/python_chip_controller_advanced_usage.md rename to docs/development_controllers/chip-repl/python_chip_controller_advanced_usage.md diff --git a/docs/guides/python_chip_controller_building.md b/docs/development_controllers/chip-repl/python_chip_controller_building.md similarity index 98% rename from docs/guides/python_chip_controller_building.md rename to docs/development_controllers/chip-repl/python_chip_controller_building.md index 8a7acc884ab..aa49adad246 100644 --- a/docs/guides/python_chip_controller_building.md +++ b/docs/development_controllers/chip-repl/python_chip_controller_building.md @@ -39,7 +39,7 @@ Linux (amd64 / aarch64) or macOS. To build and run the Python CHIP controller: 1. Install all necessary packages and prepare the build system. For more - details, see the [Building Matter](BUILDING.md) documentation: + details, see the [Building Matter](../../guides/BUILDING.md) documentation: ``` sudo apt-get update @@ -77,7 +77,8 @@ To build and run the Python CHIP controller: 5. Build and install the Python CHIP controller: ``` - scripts/build_python.sh -m platform -i separate + scripts/build_python.sh -m platform -i out/python_env + source out/python_env/bin/activate ``` > Note: This builds the Python CHIP Controller along with the CHIP REPL as diff --git a/docs/guides/chip_tool_guide.md b/docs/development_controllers/chip-tool/chip_tool_guide.md similarity index 96% rename from docs/guides/chip_tool_guide.md rename to docs/development_controllers/chip-tool/chip_tool_guide.md index 31aa29353c9..85b62dbc9da 100644 --- a/docs/guides/chip_tool_guide.md +++ b/docs/development_controllers/chip-tool/chip_tool_guide.md @@ -9,36 +9,53 @@ the setup payload or performing discovery actions.
-## Source files +## Table of Contents -You can find source files of the CHIP Tool in the `examples/chip-tool` -directory. +- [Installation](#installation) +- [Building from source](#building-from-source) +- [Running the CHIP Tool](#running-the-chip-tool) +- [CHIP Tool modes](#chip-tool-modes) + - [Single-command mode (default)](#single-command-mode-default) + - [Interactive mode](#interactive-mode) +- [Using CHIP Tool for Matter device testing](#using-chip-tool-for-matter-device-testing) +- [Supported commands and options](#supported-commands-and-options) + - [List all supported clusters](#printing-all-supported-clusters) + - [List all supported command for a cluster](#getting-the-list-of-commands-supported-for-a-specific-cluster) + - [List all supported attributes for a cluster](#getting-the-list-of-attributes-supported-for-a-specific-cluster) + - [Command options](#getting-the-list-of-command-options) +- [Testing and Interaction](#running-a-test-suite-against-a-paired-peer-device) +- [Multi-admin scenario](#multi-admin-scenario) +- [Subscribing to events or attributes](#subscribing-to-events-or-attributes) +- [Using wildcards](#using-wildcards) +- [Saving users and credentials for door lock device](#saving-users-and-credentials-on-door-lock-devices) -> **Note:** The CHIP Tool caches the configuration state in the -> `/tmp/chip_tool_config.ini` file. Deleting this and other `.ini` files in the -> `/tmp` directory can sometimes resolve issues related to stale configuration. +## Installation -> **Note:** To make the configuration persistent (since `/tmp` directory might -> be flushed at each reboot) you can change the directory where CHIP Tool caches -> its configuration by using the option `--storage-directory` +On Linux distributions +[running snapd](https://snapcraft.io/docs/installing-snapd), such as Ubuntu, the +CHIP Tool can be installed using the +[chip-tool snap](https://snapcraft.io/chip-tool). To do this, run: -
+``` +sudo snap install chip-tool +``` -## Building and running the CHIP Tool +## Building from source + +The source files of the CHIP Tool are available in the `examples/chip-tool` +directory. -Before you can use the CHIP Tool, you must compile it from source on Linux -(amd64/aarch64) or macOS. If you want to run it on Raspberry Pi, it must use a -64-bit OS. +The source can be compiled on Linux (amd64/aarch64) or macOS. If you want to run +it on Raspberry Pi, you must use a 64-bit OS. > **Note:** To ensure compatibility, always build the CHIP Tool and the Matter > device from the same revision of the `connectedhomeip` repository. -### Building the CHIP Tool - -To build and run the CHIP Tool: +To build the CHIP Tool: 1. Install all required packages for Matter and prepare the source code and the - build system. Read the [Building Matter](BUILDING.md) guide for instructions. + build system. Read the [Building Matter](../../guides/BUILDING.md) guide for + instructions. 2. Open a command prompt in the `connectedhomeip` directory. 3. Run the following command: @@ -49,10 +66,16 @@ To build and run the CHIP Tool: In this command, `BUILD_PATH` specifies where the target binaries are to be placed. -### Running the CHIP Tool +## Running the CHIP Tool + +If you installed the CHIP Tool as a snap, the command to run it would be: + +``` +$ chip-tool +``` -To check if the CHIP Tool runs correctly, execute the following command from the -`BUILD_PATH` directory: +If you compiled the CHIP Tool from source, it can be executed with the following +command from the `BUILD_PATH` directory: ``` $ ./chip-tool @@ -67,6 +90,13 @@ more complex command by appending it with sub-commands. Examples of specific commands and their use cases are described in the [Supported commands and options](#supported-commands-and-options) section. +> **Note:** The CHIP Tool caches the configuration state in the +> `/tmp/chip_tool_config.ini` file. Deleting this and other `.ini` files in the +> `/tmp` directory can sometimes resolve issues related to stale configuration. +> To make the configuration persistent you can change the directory where CHIP +> Tool caches its configuration by using the command line option +> `--storage-directory` +
## CHIP Tool modes diff --git a/docs/development_controllers/chip-tool/index.md b/docs/development_controllers/chip-tool/index.md new file mode 100644 index 00000000000..69dc7dcd68b --- /dev/null +++ b/docs/development_controllers/chip-tool/index.md @@ -0,0 +1,11 @@ +# chip-tool + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +- [chip-tool guide](./chip_tool_guide.md) diff --git a/docs/development_controllers/index.md b/docs/development_controllers/index.md new file mode 100644 index 00000000000..dfc6b330b17 --- /dev/null +++ b/docs/development_controllers/index.md @@ -0,0 +1,13 @@ +# Development Controllers + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +chip-repl/index +chip-tool/index +``` + +- [chip-tool](./chip-tool) +- [chip-repl](./chip-repl) diff --git a/docs/examples/air_purifier.md b/docs/examples/air_purifier.md new file mode 100644 index 00000000000..fbac74357fa --- /dev/null +++ b/docs/examples/air_purifier.md @@ -0,0 +1,8 @@ +## Air Purifier + +```{toctree} +:glob: +:maxdepth: 1 + +air-purifier-app/**/README +``` diff --git a/docs/examples/air_quality.md b/docs/examples/air_quality.md new file mode 100644 index 00000000000..2f6e43a7783 --- /dev/null +++ b/docs/examples/air_quality.md @@ -0,0 +1,8 @@ +## Air Quality + +```{toctree} +:glob: +:maxdepth: 1 + +air-quality-sensor-app/**/README +``` diff --git a/docs/examples/all_clusters.md b/docs/examples/all_clusters.md new file mode 100644 index 00000000000..f16a2723e88 --- /dev/null +++ b/docs/examples/all_clusters.md @@ -0,0 +1,8 @@ +## All clusters + +```{toctree} +:glob: +:maxdepth: 1 + +all-clusters-app/**/README +``` diff --git a/docs/examples/all_clusters_minimal.md b/docs/examples/all_clusters_minimal.md new file mode 100644 index 00000000000..0000772c763 --- /dev/null +++ b/docs/examples/all_clusters_minimal.md @@ -0,0 +1,8 @@ +## All clusters minimal + +```{toctree} +:glob: +:maxdepth: 1 + +all-clusters-minimal-app/**/README +``` diff --git a/docs/examples/bridge.md b/docs/examples/bridge.md new file mode 100644 index 00000000000..fe4655da580 --- /dev/null +++ b/docs/examples/bridge.md @@ -0,0 +1,8 @@ +## Bridge + +```{toctree} +:glob: +:maxdepth: 1 + +bridge-app/**/README +``` diff --git a/docs/examples/chef.md b/docs/examples/chef.md new file mode 100644 index 00000000000..e17ea88b64d --- /dev/null +++ b/docs/examples/chef.md @@ -0,0 +1,9 @@ +## CHEF + +```{toctree} +:glob: +:maxdepth: 1 + +chef/README* +chef/**/README +``` diff --git a/docs/examples/chip_tool.md b/docs/examples/chip_tool.md new file mode 100644 index 00000000000..8c9b74deabb --- /dev/null +++ b/docs/examples/chip_tool.md @@ -0,0 +1,8 @@ +## CHIP Tool example + +```{toctree} +:glob: +:maxdepth: 1 + +chip-tool/README +``` diff --git a/docs/examples/contact_sensor.md b/docs/examples/contact_sensor.md new file mode 100644 index 00000000000..1daca03f007 --- /dev/null +++ b/docs/examples/contact_sensor.md @@ -0,0 +1,8 @@ +## Contact Sensor + +```{toctree} +:glob: +:maxdepth: 1 + +contact-sensor-app/**/README +``` diff --git a/docs/examples/darwin.md b/docs/examples/darwin.md new file mode 100644 index 00000000000..f16fca866a5 --- /dev/null +++ b/docs/examples/darwin.md @@ -0,0 +1,8 @@ +## CHIP Tool Darwin + +```{toctree} +:glob: +:maxdepth: 1 + +darwin-framework-tool/README +``` diff --git a/docs/examples/dishwasher.md b/docs/examples/dishwasher.md new file mode 100644 index 00000000000..7ceaa98791c --- /dev/null +++ b/docs/examples/dishwasher.md @@ -0,0 +1,8 @@ +## Dishwasher + +```{toctree} +:glob: +:maxdepth: 1 + +dishwasher-app/**/README +``` diff --git a/docs/examples/energy_management.md b/docs/examples/energy_management.md new file mode 100644 index 00000000000..dfec14dd68c --- /dev/null +++ b/docs/examples/energy_management.md @@ -0,0 +1,8 @@ +## Energy Management + +```{toctree} +:glob: +:maxdepth: 1 + +energy-management-app/**/README +``` diff --git a/docs/examples/fabric_admin.md b/docs/examples/fabric_admin.md new file mode 100644 index 00000000000..fa47159c50a --- /dev/null +++ b/docs/examples/fabric_admin.md @@ -0,0 +1,8 @@ +## Fabric Admin + +```{toctree} +:glob: +:maxdepth: 1 + +fabric-admin/README +``` diff --git a/docs/examples/fabric_bridge.md b/docs/examples/fabric_bridge.md new file mode 100644 index 00000000000..de08b593186 --- /dev/null +++ b/docs/examples/fabric_bridge.md @@ -0,0 +1,8 @@ +## Fabric Bridge + +```{toctree} +:glob: +:maxdepth: 1 + +fabric-bridge-app/**/README +``` diff --git a/docs/examples/fabric_sync.md b/docs/examples/fabric_sync.md new file mode 100644 index 00000000000..269448f8cf6 --- /dev/null +++ b/docs/examples/fabric_sync.md @@ -0,0 +1,8 @@ +## Fabric Sync + +```{toctree} +:glob: +:maxdepth: 1 + +fabric-sync/README +``` diff --git a/docs/examples/index.md b/docs/examples/index.md index 67dcfcf36b0..75118fa9335 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -1,390 +1,11 @@ # Examples -The Matter SDK provides examples of Matter devices for different development -platforms. - -## Air Quality Sensor example - -```{toctree} -:glob: -:maxdepth: 1 - -air-quality-sensor-app/**/README -``` - -## All clusters example - -```{toctree} -:glob: -:maxdepth: 1 - -all-clusters-app/**/README -``` - -## All clusters minimal example - -```{toctree} -:glob: -:maxdepth: 1 - -all-clusters-minimal-app/**/README -``` - -## Bridge example - -```{toctree} -:glob: -:maxdepth: 1 - -bridge-app/**/README -``` - -## Contact Sensor Example - -```{toctree} -:glob: -:maxdepth: 1 - -contact-sensor-app/**/README -``` - -## CHEF example - -```{toctree} -:glob: -:maxdepth: 1 - -chef/README* -chef/**/README -``` - -## CHIP Tool example - -```{toctree} -:glob: -:maxdepth: 1 - -chip-tool/README -``` - -## CHIP Tool Darwin example - -```{toctree} -:glob: -:maxdepth: 1 - -darwin-framework-tool/README -``` - -## Energy Management example - -```{toctree} -:glob: -:maxdepth: 1 - -energy-management-app/**/README -``` - -## Fabric Admin example - -```{toctree} -:glob: -:maxdepth: 1 - -fabric-admin/README -``` - -## Fabric Bridge example - -```{toctree} -:glob: -:maxdepth: 1 - -fabric-bridge-app/**/README -``` - -## Java matter controller example - -```{toctree} -:glob: -:maxdepth: 1 - -java-matter-controller/README -``` - -## Kotlin matter controller example - -```{toctree} -:glob: -:maxdepth: 1 - -kotlin-matter-controller/README -``` - -## Virtual Device App example - -```{toctree} -:glob: -:maxdepth: 1 - -virtual-device-app/**/README -``` - -## Laundry washer example - -```{toctree} -:glob: -:maxdepth: 1 - -laundry-washer-app/**/README -``` - -## Lighting example - ```{toctree} :glob: -:maxdepth: 1 +:maxdepth: 2 -lighting-app/**/README -lighting-app/qpg/APPLICATION +* ``` -## Lighting example without unique id - -```{toctree} -:glob: -:maxdepth: 1 - -lighting-app-data-mode-no-unique-id/**/README -``` - -## Light switch example - -```{toctree} -:glob: -:maxdepth: 1 - -light-switch-app/**/README -light-switch-app/qpg/APPLICATION -``` - -## Lock example - -```{toctree} -:glob: -:maxdepth: 1 - -lock-app/**/README -lock-app/qpg/APPLICATION -``` - -## Log source example - -```{toctree} -:glob: -:maxdepth: 1 - -log-source-app/**/README -``` - -## Minimal MDNS example - -```{toctree} -:glob: -:maxdepth: 1 - -minimal-mdns/README -``` - -## OTA Provider example - -```{toctree} -:glob: -:maxdepth: 1 - -ota-provider-app/**/README -``` - -## OTA Requestor example - -```{toctree} -:glob: -:maxdepth: 1 - -ota-requestor-app/**/README -``` - -## Persistent storage example - -```{toctree} -:glob: -:maxdepth: 1 - -persistent-storage/**/README -persistent-storage/**/APPLICATION -``` - -## Pigweed example - -```{toctree} -:glob: -:maxdepth: 1 - -pigweed-app/**/README -``` - -## Pump example - -```{toctree} -:glob: -:maxdepth: 1 - -pump-app/**/README -``` - -## Pump controller example - -```{toctree} -:glob: -:maxdepth: 1 - -pump-controller-app/**/README -``` - -## Refrigerator example - -```{toctree} -:glob: -:maxdepth: 1 - -refrigerator-app/**/README -``` - -## Shell example - -```{toctree} -:glob: -:maxdepth: 1 - -shell/README* -shell/**/README -``` - -## Smoke CO Alarm example - -```{toctree} -:glob: -:maxdepth: 1 - -smoke-co-alarm-app/**/README -``` - -## Dishwasher example - -```{toctree} -:glob: -:maxdepth: 1 - -dishwasher-app/**/README -``` - -## Microwave oven example - -```{toctree} -:glob: -:maxdepth: 1 - -microwave-oven-app/**/README -``` - -## Temperature measurement example - -```{toctree} -:glob: -:maxdepth: 1 - -temperature-measurement-app/**/README -``` - -## Thermostat example - -```{toctree} -:glob: -:maxdepth: 1 - -thermostat/**/README -thermostat/qpg/APPLICATION -``` - -## TV example - -```{toctree} -:glob: -:maxdepth: 1 - -tv-app/**/README -``` - -## TV casting example - -```{toctree} -:glob: -:maxdepth: 1 - -tv-casting-app/**/README -tv-casting-app/APIs.md -``` - -## Window example - -```{toctree} -:glob: -:maxdepth: 1 - -window-app/**/README -``` - -## RVC example - -```{toctree} -:glob: -:maxdepth: 1 - -rvc-app/README -``` - -## Air Purifier Example - -```{toctree} -:glob: -:maxdepth: 1 - -air-purifier-app/**/README -``` - -## Network Infrastructure Manager example - -```{toctree} -:glob: -:maxdepth: 1 - -network-manager-app/README -``` - -## Lit ICD example - -```{toctree} -:glob: -:maxdepth: 1 - -lit-icd-app/**/README -``` - -## Thread Border Router example - -```{toctree} -:glob: -:maxdepth: 1 - -thread-br-app/**/README -``` +The Matter SDK provides examples of Matter devices for different development +platforms. diff --git a/docs/examples/java_matter_controller.md b/docs/examples/java_matter_controller.md new file mode 100644 index 00000000000..58af7cbf267 --- /dev/null +++ b/docs/examples/java_matter_controller.md @@ -0,0 +1,8 @@ +## Java matter controller + +```{toctree} +:glob: +:maxdepth: 1 + +java-matter-controller/README +``` diff --git a/docs/examples/kotlin_matter_controller.md b/docs/examples/kotlin_matter_controller.md new file mode 100644 index 00000000000..9241a1ef182 --- /dev/null +++ b/docs/examples/kotlin_matter_controller.md @@ -0,0 +1,8 @@ +## Kotlin matter controller + +```{toctree} +:glob: +:maxdepth: 1 + +kotlin-matter-controller/README +``` diff --git a/docs/examples/laundry_washer.md b/docs/examples/laundry_washer.md new file mode 100644 index 00000000000..3a522c8f821 --- /dev/null +++ b/docs/examples/laundry_washer.md @@ -0,0 +1,8 @@ +## Laundry washer + +```{toctree} +:glob: +:maxdepth: 1 + +laundry-washer-app/**/README +``` diff --git a/docs/examples/light_switch.md b/docs/examples/light_switch.md new file mode 100644 index 00000000000..1a887fc6b4e --- /dev/null +++ b/docs/examples/light_switch.md @@ -0,0 +1,9 @@ +## Light switch + +```{toctree} +:glob: +:maxdepth: 1 + +light-switch-app/**/README +light-switch-app/qpg/APPLICATION +``` diff --git a/docs/examples/lighting.md b/docs/examples/lighting.md new file mode 100644 index 00000000000..8870e50372c --- /dev/null +++ b/docs/examples/lighting.md @@ -0,0 +1,9 @@ +## Lighting + +```{toctree} +:glob: +:maxdepth: 1 + +lighting-app/**/README +lighting-app/qpg/APPLICATION +``` diff --git a/docs/examples/lighting_no_unique_id.md b/docs/examples/lighting_no_unique_id.md new file mode 100644 index 00000000000..a71f9df5225 --- /dev/null +++ b/docs/examples/lighting_no_unique_id.md @@ -0,0 +1,8 @@ +## Lighting without unique id + +```{toctree} +:glob: +:maxdepth: 1 + +lighting-app-data-mode-no-unique-id/**/README +``` diff --git a/docs/examples/lit_icd.md b/docs/examples/lit_icd.md new file mode 100644 index 00000000000..8678c44fcd7 --- /dev/null +++ b/docs/examples/lit_icd.md @@ -0,0 +1,8 @@ +## Lit ICD + +```{toctree} +:glob: +:maxdepth: 1 + +lit-icd-app/**/README +``` diff --git a/docs/examples/lock.md b/docs/examples/lock.md new file mode 100644 index 00000000000..16ab19dc64b --- /dev/null +++ b/docs/examples/lock.md @@ -0,0 +1,9 @@ +## Lock + +```{toctree} +:glob: +:maxdepth: 1 + +lock-app/**/README +lock-app/qpg/APPLICATION +``` diff --git a/docs/examples/log_source.md b/docs/examples/log_source.md new file mode 100644 index 00000000000..caec22654d0 --- /dev/null +++ b/docs/examples/log_source.md @@ -0,0 +1,8 @@ +## Log source + +```{toctree} +:glob: +:maxdepth: 1 + +log-source-app/**/README +``` diff --git a/docs/examples/microwave.md b/docs/examples/microwave.md new file mode 100644 index 00000000000..c5f659f8733 --- /dev/null +++ b/docs/examples/microwave.md @@ -0,0 +1,8 @@ +## Microwave ovens + +```{toctree} +:glob: +:maxdepth: 1 + +microwave-oven-app/**/README +``` diff --git a/docs/examples/minimal_mdns.md b/docs/examples/minimal_mdns.md new file mode 100644 index 00000000000..9d65b4dab23 --- /dev/null +++ b/docs/examples/minimal_mdns.md @@ -0,0 +1,8 @@ +## Minimal MDNS + +```{toctree} +:glob: +:maxdepth: 1 + +minimal-mdns/README +``` diff --git a/docs/examples/network_infrastructure_manager.md b/docs/examples/network_infrastructure_manager.md new file mode 100644 index 00000000000..bcc0591037e --- /dev/null +++ b/docs/examples/network_infrastructure_manager.md @@ -0,0 +1,8 @@ +## Network Infrastructure Manager + +```{toctree} +:glob: +:maxdepth: 1 + +network-manager-app/README +``` diff --git a/docs/examples/ota_provider.md b/docs/examples/ota_provider.md new file mode 100644 index 00000000000..3470d9fe078 --- /dev/null +++ b/docs/examples/ota_provider.md @@ -0,0 +1,8 @@ +## OTA Provider + +```{toctree} +:glob: +:maxdepth: 1 + +ota-provider-app/**/README +``` diff --git a/docs/examples/ota_requestor.md b/docs/examples/ota_requestor.md new file mode 100644 index 00000000000..9cf5a75feaf --- /dev/null +++ b/docs/examples/ota_requestor.md @@ -0,0 +1,8 @@ +## OTA Requestor + +```{toctree} +:glob: +:maxdepth: 1 + +ota-requestor-app/**/README +``` diff --git a/docs/examples/persistent_storage.md b/docs/examples/persistent_storage.md new file mode 100644 index 00000000000..5f5f5d17581 --- /dev/null +++ b/docs/examples/persistent_storage.md @@ -0,0 +1,9 @@ +## Persistent storage + +```{toctree} +:glob: +:maxdepth: 1 + +persistent-storage/**/README +persistent-storage/**/APPLICATION +``` diff --git a/docs/examples/pigweed.md b/docs/examples/pigweed.md new file mode 100644 index 00000000000..bf670bebd0c --- /dev/null +++ b/docs/examples/pigweed.md @@ -0,0 +1,8 @@ +## Pigweed + +```{toctree} +:glob: +:maxdepth: 1 + +pigweed-app/**/README +``` diff --git a/docs/examples/pump.md b/docs/examples/pump.md new file mode 100644 index 00000000000..001a7df3fcf --- /dev/null +++ b/docs/examples/pump.md @@ -0,0 +1,8 @@ +## Pump + +```{toctree} +:glob: +:maxdepth: 1 + +pump-app/**/README +``` diff --git a/docs/examples/pump_controler.md b/docs/examples/pump_controler.md new file mode 100644 index 00000000000..ff7f51f5ecb --- /dev/null +++ b/docs/examples/pump_controler.md @@ -0,0 +1,8 @@ +## Pump controller + +```{toctree} +:glob: +:maxdepth: 1 + +pump-controller-app/**/README +``` diff --git a/docs/examples/refrigerator.md b/docs/examples/refrigerator.md new file mode 100644 index 00000000000..455e8fe703b --- /dev/null +++ b/docs/examples/refrigerator.md @@ -0,0 +1,8 @@ +## Refrigerator + +```{toctree} +:glob: +:maxdepth: 1 + +refrigerator-app/**/README +``` diff --git a/docs/examples/rvc.md b/docs/examples/rvc.md new file mode 100644 index 00000000000..e0d033c4474 --- /dev/null +++ b/docs/examples/rvc.md @@ -0,0 +1,8 @@ +## RVC + +```{toctree} +:glob: +:maxdepth: 1 + +rvc-app/README +``` diff --git a/docs/examples/shell.md b/docs/examples/shell.md new file mode 100644 index 00000000000..3a0536a3dc8 --- /dev/null +++ b/docs/examples/shell.md @@ -0,0 +1,9 @@ +## Shell + +```{toctree} +:glob: +:maxdepth: 1 + +shell/README* +shell/**/README +``` diff --git a/docs/examples/smoke_co.md b/docs/examples/smoke_co.md new file mode 100644 index 00000000000..9144276c7ac --- /dev/null +++ b/docs/examples/smoke_co.md @@ -0,0 +1,8 @@ +## Smoke CO Alarm example + +```{toctree} +:glob: +:maxdepth: 1 + +smoke-co-alarm-app/**/README +``` diff --git a/docs/examples/tbr.md b/docs/examples/tbr.md new file mode 100644 index 00000000000..512a1132228 --- /dev/null +++ b/docs/examples/tbr.md @@ -0,0 +1,8 @@ +## Thread Border Router + +```{toctree} +:glob: +:maxdepth: 1 + +thread-br-app/**/README +``` diff --git a/docs/examples/temperature_measurement.md b/docs/examples/temperature_measurement.md new file mode 100644 index 00000000000..cf8235b1d49 --- /dev/null +++ b/docs/examples/temperature_measurement.md @@ -0,0 +1,8 @@ +## Temperature measurement + +```{toctree} +:glob: +:maxdepth: 1 + +temperature-measurement-app/**/README +``` diff --git a/docs/examples/thermostat.md b/docs/examples/thermostat.md new file mode 100644 index 00000000000..8eb87892be6 --- /dev/null +++ b/docs/examples/thermostat.md @@ -0,0 +1,9 @@ +## Thermostat + +```{toctree} +:glob: +:maxdepth: 1 + +thermostat/**/README +thermostat/qpg/APPLICATION +``` diff --git a/docs/examples/tv.md b/docs/examples/tv.md new file mode 100644 index 00000000000..ee97387402e --- /dev/null +++ b/docs/examples/tv.md @@ -0,0 +1,8 @@ +## TV + +```{toctree} +:glob: +:maxdepth: 1 + +tv-app/**/README +``` diff --git a/docs/examples/tv_casting.md b/docs/examples/tv_casting.md new file mode 100644 index 00000000000..caeedf9e6dc --- /dev/null +++ b/docs/examples/tv_casting.md @@ -0,0 +1,9 @@ +## TV casting + +```{toctree} +:glob: +:maxdepth: 1 + +tv-casting-app/**/README +tv-casting-app/APIs.md +``` diff --git a/docs/examples/virtual_device.md b/docs/examples/virtual_device.md new file mode 100644 index 00000000000..0b50f145033 --- /dev/null +++ b/docs/examples/virtual_device.md @@ -0,0 +1,8 @@ +## Virtual Device App + +```{toctree} +:glob: +:maxdepth: 1 + +virtual-device-app/**/README +``` diff --git a/docs/examples/window.md b/docs/examples/window.md new file mode 100644 index 00000000000..2b4993641c9 --- /dev/null +++ b/docs/examples/window.md @@ -0,0 +1,8 @@ +## Window + +```{toctree} +:glob: +:maxdepth: 1 + +window-app/**/README +``` diff --git a/docs/getting_started/SDKBasics.md b/docs/getting_started/SDKBasics.md index 7f2c81f285f..eaad3baac81 100644 --- a/docs/getting_started/SDKBasics.md +++ b/docs/getting_started/SDKBasics.md @@ -1,4 +1,4 @@ -# SDK Basics +# SDK Architecture Overview ## Getting Started diff --git a/docs/getting_started/changing_examples.md b/docs/getting_started/changing_examples.md new file mode 100644 index 00000000000..02ba357d861 --- /dev/null +++ b/docs/getting_started/changing_examples.md @@ -0,0 +1,78 @@ +# Changing Examples + +The composition of most examples in the SDK is static and code generated. + +The tool used to describe and change the composition of an example is called +ZAP. More information about ZAP and a walk-through of the tool can be found in +the [ZAP introduction](../zap_and_codegen/zap_intro.md). The composition of the +device is captured in a .zap file, which is readable by the ZAP tool. This is +then compiled into a human-readable .matter file, which is used to build the +static features of the example. + +To change the composition of a device example, you need to + +1. Change the zap file to implement your desired changes +2. Run the code generation tool to generate the .matter file +3. Re-build the example + +## Changing the zap file in an example + +Most examples in the SDK keep the .zap file in a sub-directory called +example-name-common (ex. lighting-common). To load an existing .zap file into +the ZAP tool, from the chip-root use + +``` +./scripts/tools/zap/run_zaptool.sh +``` + +For example, to make changes to the lighting app, use: + +``` +./scripts/tools/zap/run_zaptool.sh examples/lighting-app/lighting-common/lighting-app.zap +``` + +This will open the ZAP GUI tool, which can be used to change the endpoint +composition, clusters, features, attributes, commands and events exposed by the +device. + +Details of how to use the tool can be found in the +[ZAP Introduction](../zap_and_codegen/zap_intro.md). + +## Running code generation + +To compile the .matter file for use in building, use: + +``` +./scripts/tools/zap/generate.py +``` + +For example, for changes to the lighting app, use: + +``` +./scripts/tools/zap/generate.py examples/lighting-app/lighting-common/lighting-app.zap +``` + +If there are changes to many .zap files, the following script can be used to +recompile the .zap files for all the examples and the controller. + +``` + ./scripts/tools/zap_regen_all.py +``` + +## Rebuilding the example + +After generating the .matter file, re-build the example. Instructions for +building examples are given in [Building your first example](./first_example.md) + +## Ensuring device conformance + +After changing the examples, it is important to ensure they remain spec +compliant. Although there are numerous certification tests to check the various +parts of the device, the tests most likely to be affected by changes to ZAP are +the conformance tests, which ensure that the device included meets the +conformance requirements for clusters and device types. To run conformance tests +against the example app, see [Testing](../testing/index.md). The tests that +ensure the device composition is spec compliant are found in +[Device Basic Composition Test](../../src/python_testing/TC_DeviceBasicComposition.py) +and +[Device Conformance Tests](../../src/python_testing/TC_DeviceConformance.py). diff --git a/docs/getting_started/first_example.md b/docs/getting_started/first_example.md index 89ab7d493d6..7b005f3adc6 100644 --- a/docs/getting_started/first_example.md +++ b/docs/getting_started/first_example.md @@ -1,4 +1,4 @@ -# An SDK example +# Compiling, Running, and Controlling Matter examples The SDK provides a number of example devices and controllers that can be used to familiarize yourself with the SDK and the Matter ecosystem. @@ -26,7 +26,7 @@ for testing. [chip-tool](../../examples/chip-tool/) is a C++ command line controller with an interactive shell. More information on chip-tool can be found in the -[chip-tool guide](../guides/chip_tool_guide.md). +[chip-tool guide](../development_controllers/chip-tool/chip_tool_guide.md). [chip-repl](../../src/controller/python/chip-repl.py) is a shell for the python controller. The chip-repl is part of the python controller framework, often used @@ -37,7 +37,7 @@ for testing. More information about the python controller can be found in the The examples directory contains a set of apps using an example device composition \.zap file. For more information about device composition and zap, -see [ZAP documentation](./zap.md). +see [ZAP documentation](../zap_and_codegen/zap_intro.md). This quick start guide will walk you through diff --git a/docs/getting_started/index.md b/docs/getting_started/index.md index ea881141ff4..fc8b9bd1713 100644 --- a/docs/getting_started/index.md +++ b/docs/getting_started/index.md @@ -7,10 +7,12 @@ The following docs are a brief introduction to SDK development. :maxdepth: 1 :hidden: -* +first_example +changing_examples +SDKBasics ``` - [Running your first example](./first_example.md) -- [SDK Basics](./SDKBasics.md) -- [ZAP](./zap.md) +- [Changing examples](./changing_examples.md) +- [SDK Architecture Overview](./SDKBasics.md) diff --git a/docs/guides/darwin.md b/docs/guides/darwin.md index 00165e6fcac..4692c0b065d 100644 --- a/docs/guides/darwin.md +++ b/docs/guides/darwin.md @@ -292,17 +292,17 @@ Example: - [ESP32 Lighting](/examples/lighting-app/esp32/README.md) - [ESP32 Temperature Sensor](/examples/temperature-measurement-app/esp32/README.md) - [mbedOS](/examples/all-clusters-app/mbed/README.md) -- [nRF Connect All Clusters](./nrfconnect_examples_configuration.md) +- [nRF Connect All Clusters](../platforms/nrf/nrfconnect_examples_configuration.md) - [nRF Connect Pump](/examples/pump-app/nrfconnect/README.md) -- [NXP Examples](./nxp/nxp_imx8m_linux_examples.md) +- [NXP Examples](../platforms/nxp/nxp_imx8m_linux_examples.md) - [NXP](/examples/all-clusters-app/nxp/mw320/README.md) - [Infineon CYW30739 Lighting](/examples/lighting-app/infineon/cyw30739/README.md) - [Infineon PSoC6](/examples/all-clusters-app/infineon/psoc6/README.md) - [Qorvo](/examples/lighting-app/qpg/README.md) -- [Silicon Labs](./silabs_getting_started.md) +- [Silicon Labs](../platforms/silabs/silabs_getting_started.md) - [Simulated Linux](./simulated_device_linux.md) - [Telink](/examples/lighting-app/telink/README.md) -- [TI Platform](./ti/ti_matter_overview.md) +- [TI Platform](../platforms/ti/ti_matter_overview.md) - [Tizen](/examples/lighting-app/tizen/README.md) ## Providing Feedback to Apple diff --git a/docs/guides/device-attestation-revocation-guide.md b/docs/guides/device-attestation-revocation-guide.md new file mode 100644 index 00000000000..6ee4fee8461 --- /dev/null +++ b/docs/guides/device-attestation-revocation-guide.md @@ -0,0 +1,52 @@ +# Device Attestation Revocation Testing Guide + +## Overview + +The device attestation revocation tests help identify the devices with revoked +DACs (Device Attestation Certificates) and PAIs (Product Attestation +Intermediates) during commissioning. + +This guide demonstrates how to use a sample application and chip-tool to test +the device attestation revocation functionality. + +The sample application is injected with revoked DAC and/or PAI certificates. + +During commissioning, chip-tool is provided with a revocation set that is +pre-generated using the `generate_revocation_set.py` script. + +## Prerequisites + +- Matter application for Linux platform (e.g., examples/lighting-app/linux) +- DAC provider JSON file containing revoked DAC and/or PAI certificates +- chip-tool +- Device attestation revocation set for the respective DAC and/or PAI + +## Test Setup + +- Build the lighting-app/linux and chip-tool: + +``` +./scripts/examples/gn_build_example.sh examples/lighting-app/linux out/host +./scripts/examples/gn_build_example.sh examples/chip-tool out/host +``` + +- Run the lighting-app/linux: + +``` +./out/host/chip-lighting-app --dac_provider +``` + +- Run the chip-tool with the revocation set: + +``` +./out/host/chip-tool pairing onnetwork 11 20202021 --dac-revocation-set-path +``` + +### Test Vectors + +| Description | DAC Provider | Revocation Set | Expected Result | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | +| PAI revoked by PAA | [revoked-pai.json](../../credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-pai.json) | [revocation-set-for-paa.json](../../credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-paa.json) | Commissioning fails with `kPaiRevoked` (202) | +| DAC-01 revoked by PAI | [revoked-dac-01.json](../../credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-01.json) | [revocation-set-for-pai.json](../../credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-pai.json) | Commissioning fails with `kDacRevoked` (302) | +| DAC-02 revoked by PAI | [revoked-dac-02.json](../../credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-02.json) | [revocation-set-for-pai.json](../../credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-pai.json) | Commissioning fails with `kDacRevoked` (302) | +| DAC-03 revoked by PAI | [revoked-dac-03.json](../../credentials/test/revoked-attestation-certificates/dac-provider-test-vectors/revoked-dac-03.json) | [revocation-set-for-pai.json](../../credentials/test/revoked-attestation-certificates/revocation-sets/revocation-set-for-pai.json) | Commissioning fails with `kDacRevoked` (302) | diff --git a/docs/guides/index.md b/docs/guides/index.md index 14d9caf7e21..97167c84ae0 100644 --- a/docs/guides/index.md +++ b/docs/guides/index.md @@ -9,54 +9,13 @@ and features. :hidden: * -esp32/README -nxp/README -ti/ti_matter_overview ``` ## Build Guides - [Building](./BUILDING.md) -## Platform Guides - -- [Android - Building](./android_building.md) -- [Apple - Testing with iPhone, iPad, macOS, Apple TV, HomePod, Watch, etc](./darwin.md) -- [ASR - Getting Started Guide](./asr_getting_started_guide.md) -- [Espressif (ESP32) - Getting Started Guide](./esp32/README.md) -- [Infineon PSoC6 - Software Update](./infineon_psoc6_software_update.md) -- [Linux - Simulated Devices](./simulated_device_linux.md) -- [mbedOS - Adding a new target](./mbedos_add_new_target.md) -- [mbedOS - Commissioning](./mbedos_commissioning.md) -- [mbedOS - Platform Overview](./mbedos_platform_overview.md) -- [nRF Connect - Android Commissioning](./nrfconnect_android_commissioning.md) -- [nRF Connect - CLI Guide](./nrfconnect_examples_cli.md) -- [nRF Connect - Configuration](./nrfconnect_examples_configuration.md) -- [nRF Connect - Factory Data Configuration](./nrfconnect_factory_data_configuration.md) -- [nRF Connect - Platform Overview](./nrfconnect_platform_overview.md) -- [nRF Connect - Software Update](./nrfconnect_examples_software_update.md) -- [NXP - Getting Started Guide](./nxp/README.md) -- [Silicon Labs - Documentation](https://siliconlabs.github.io/matter/latest/index.html) -- [Silicon Labs - Getting Started](./silabs_getting_started.md) -- [Silicon Labs - Software Update](./silabs_efr32_software_update.md) -- [Silicon Labs - CLI Guide](./silabs_cli_guide.md) -- [TI - Platform Overview](./ti/ti_matter_overview.md) - -## Tool Guides - -- [CHIP Tool](./chip_tool_guide.md) -- [Python Matter-Repl](./matter-repl.md) -- [python-chip-controller - Advanced](./python_chip_controller_advanced_usage.md) -- [python-chip-controller - Building](./python_chip_controller_building.md) -- [CHEF test devices](../../examples/chef/README.md) - - [New device type adding](../../examples/chef/NEW_CHEF_DEVICES.md) - ## Development Guides - [Access Control](./access-control-guide.md) - [Matter IDL tooling and validation](./matter_idl_tooling.md) - -## Setup Guides - -- [Open Thread - Hardware suggestions](./openthread_rcp_nrf_dongle.md) -- [Open Thread - Setting up a Raspberry Pi as a Border Router](./openthread_border_router_pi.md) diff --git a/docs/guides/nxp/README.md b/docs/guides/nxp/README.md deleted file mode 100644 index be225ac938f..00000000000 --- a/docs/guides/nxp/README.md +++ /dev/null @@ -1,14 +0,0 @@ -```{toctree} -:glob: -:maxdepth: 1 - -* -``` - -# NXP Getting Started Guide - -- [NXP - Android Commissioning](nxp_k32w_android_commissioning.md) -- [NXP - Linux Examples](nxp_imx8m_linux_examples.md) -- [NXP - Manufacturing Data](nxp_manufacturing_flow.md) -- [NXP - RW61x OTA Software Update Guide](nxp_rw61x_ota_software_update.md) -- [NXP - Zephyr OTA Software Update Guide](nxp_zephyr_ota_software_update.md) diff --git a/docs/guides/nxp/nxp_rw61x_ota_software_update.md b/docs/guides/nxp/nxp_rw61x_ota_software_update.md deleted file mode 100644 index af67b1419d0..00000000000 --- a/docs/guides/nxp/nxp_rw61x_ota_software_update.md +++ /dev/null @@ -1,281 +0,0 @@ -# Matter Over-The-Air Software Update with NXP RW61x example applications - -## Overview - -The OTA Requestor feature enables the device to be informed of, download and -apply a software update from an OTA Provider. - -This section explains how to perform an OTA Software Update with NXP RW61x -example applications. Throughout this guide, the all-clusters application is -used as an example. - -In general, the Over-The-Air Software Update process consists of the following -steps : - -- The OTA Requestor queries an update image from the OTA Provider which - responds according to its availability. -- The update image is received in blocks and stored in the external flash of - the device. -- Once the update image is fully downloaded, the bootloader is notified and - the device resets applying the update in test-mode. -- If the test is successful, the update is applied permanently. Otherwise, the - bootloader reverts back to the primary application, preventing any - downgrade. - -### Flash Memory Layout - -The RW61x Flash is divided into different regions as follow : - -- Bootloader : MCUBoot resides at the base of the flash and occupies 0x20000 - (128 kB). -- Primary application partition : The example application which would be run - by the bootloader (active application). The size reserved for this partition - is 4.4 MB. -- Secondary application partition : Update image received with the OTA - (candidate application). The size reserved for the partition is 4.4 MB. - -Notes : - -- The CPU1/CPU2 firmware are embedded in the CPU3 example application. -- The sizes of the primary and secondary applications are provided as an - example (currently 4.4 MB is reserved for each partition). The size can be - changed by modifying the `m_app_max_sectors` value in the linker script of - the application (`RW610_flash.ld`). - -### MCUBoot Bootloader - -MCUBoot is an open-source secure bootloader used by RW61x to apply the -self-upgrade. For more details, please refer to the -[MCUBoot documentation](https://github.com/mcu-tools/mcuboot/blob/main/docs/design.md). - -For RW61x platform, the bootloader is configured to use the flash remapping -mechanism by default, in order to perform the image upgrade. This is achieved by -using the `MCUBoot DIRECT-XIP` upgrade mode. - -## OTA Software Update process for RW61x example application - -### Flashing the bootloader - -In order for the device to perform the software update, the MCUBoot bootloader -must be flashed first at the base of the flash. A step-by-step guide is given -below. - -- It is recommended to start with erasing the external flash of the device, - for this JLink from Segger can be used. It can be downloaded and installed - from https://www.segger.com/products/debug-probes/j-link. Once installed, - JLink can be run using the command line : - -``` -$ JLink -``` - -Run the following commands : - -``` -J-Link > connect -Device> ? # you will be presented with a dialog -> select `RW612` -Please specify target interface: -J) JTAG (Default) -S) SWD -T) cJTAG -TIF> S -Specify target interface speed [kHz]. : 4000 kHz -Speed> # -J-Link > exec EnableEraseAllFlashBanks -J-Link > erase 0x8000000, 0x88a0000 -``` - -- MCUBoot application can be built with SDK installed, using instructions - - below. - -- Retrieve the mcuboot directory with : - -``` -user@ubuntu: cd ~/Desktop/connectedhomeip/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/armgcc -``` - -``: Supported rw612 boards are: `rdrw612bga` or `frdmrw612` - -- Build the mcuboot application : - -``` -user@ubuntu: chmod +x build_flash_release.sh -user@ubuntu: export ARMGCC_DIR=/opt/gcc-arm-none-eabi-10.3-2021.10 # with ARMGCC_DIR referencing the compiler path -user@ubuntu: ./build_flash_release.sh -``` - -- Program the generated binary to the target board. - -``` -J-Link > loadbin ~/Desktop/connectedhomeip/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/armgcc/flash_release/mcuboot_opensource.elf -``` - -- If it runs successfully, the following logs will be displayed on the - terminal : - -``` -hello sbl. -Disabling flash remapping function -Bootloader Version 2.0.0 -Image 0 Primary slot: Image not found -Image 0 Secondary slot: Image not found -No slot to load for image 0 -Unable to find bootable image -``` - -Note : By default, mcuboot application considers the primary and secondary -partitions to be the size of 4.4 MB. If the size is to be changed, the partition -addresses should be modified in the flash_partitioning.h accordingly. For more -information about the flash partitioning with mcuboot, please refer to the -dedicated readme.txt located in -"`/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/`". - -### Generating and flashing the signed application image - -After flashing the bootloader, the application can be programmed to the board. -The image must have the following format : - -- Header : contains general information about the image (version, size, - magic...) -- Code of the application : generated binary -- Trailer : contains metadata needed by the bootloader such as the image - signature, the upgrade type, the swap status... - -The all-clusters application can be generated using the instructions from the -[README.md 'Building'](../../../examples/all-clusters-app/nxp/rt/rw61x/README.md#building) -section. The application is automatically linked to be executed from the primary -image partition, taking into consideration the offset imposed by mcuboot. - -The resulting executable file found in out/debug/chip-rw61x-all-cluster-example -needs to be converted into raw binary format as shown below. - -``` -arm-none-eabi-objcopy -R .flash_config -R .NVM -O binary chip-rw61x-all-cluster-example chip-rw61x-all-cluster-example.bin -``` - -To sign the image and wrap the raw binary of the application with the header and -trailer, "`imgtool`" is provided in the SDK and can be found in -"`/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/middleware/mcuboot_opensource/scripts/`". - -The following commands can be run (make sure to replace the /path/to/file/binary -with the adequate files): - -``` -user@ubuntu: cd ~/Desktop//third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/middleware/mcuboot_opensource/scripts/ - -user@ubuntu: python3 imgtool.py sign --key ~/Desktop//third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/keys/sign-rsa2048-priv.pem --align 4 --header-size 0x1000 --pad-header --pad --confirm --slot-size 0x440000 --max-sectors 1088 --version "1.0" ~/Desktop/connectedhomeip/examples/all-clusters-app/nxp/rt/rw61x/out/debug/chip-rw61x-all-cluster-example.bin ~/Desktop/connectedhomeip/examples/all-clusters-app/nxp/rt/rw61x/out/debug/chip-rw61x-all-cluster-example_SIGNED.bin -``` - -Notes : - -- The arguments `slot-size` and `max-sectors` are aligned with the size of the - partitions reserved for the primary and the secondary applications. (By - default the size considered is 4.4 MB for each application). If the size of - these partitions are modified, the `slot-size` and `max-sectors` should be - adjusted accordingly. -- In this example, the image is signed with the private key provided by the - SDK as an example - (`/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/keys/sign-rsa2048-priv.pem`), - MCUBoot is built with its corresponding public key which would be used to - verify the integrity of the image. It is possible to generate a new pair of - keys using the following commands. This procedure should be done prior to - building the mcuboot application. - -- To generate the private key : - -``` -user@ubuntu: python3 imgtool.py keygen -k priv_key.pem -t rsa-2048 -``` - -- To extract the public key : - -``` -user@ubuntu: python3 imgtool.py getpub -k priv_key.pem -``` - -- The extracted public key can then be copied to the - `/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/keys/sign-rsa2048-pub.c`, - given as a value to the rsa_pub_key[] array. - -The resulting output is the signed binary of the application version "1.0". - -JLink can be used to flash the application at the address 0x8020000, using the -command : - -``` -J-Link > loadbin chip-rw61x-all-cluster-example_SIGNED.bin 0x8020000 -``` - -The bootloader should then be able to jump directly to the start of the -application and run it. - -### Generating the OTA Update Image - -To generate the OTA update image the same procedure can be followed from the -[Generating and flashing the signed application image](#generating-and-flashing-the-signed-application-image) -sub-section, replacing the "--version "1.0"" argument with "--version "2.0"" -(recent version of the update), without arguments "--pad" "--confirm" when -running `imgtool` script during OTA Update Image generation. - -Note : When building the update image, the build arguments -nxp_software_version=2 nxp_software_version_string=\"2.0\" can be added to the -gn gen command in order to specify the upgraded version. - -When the signed binary of the update is generated, the file should be converted -into OTA format. To do so, the ota_image_tool is provided in the repo and can be -used to convert a binary file into an .ota file. - -``` -user@ubuntu:~/connectedhomeip$ : ./src/app/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 2 -vs "2.0" -da sha256 chip-rw61x-all-cluster-example_SIGNED.bin chip-rw61x-all-cluster-example.ota -``` - -The generated OTA file can be used to perform the OTA Software Update. The -instructions below describe the procedure step-by-step. - -### Performing the OTA Software Update - -Setup example : - -- [Chip-tool](../../../examples/chip-tool/README.md) application running on - the RPi. -- OTA Provider application built on the same RPi (as explained below). -- RW61x board programmed with the example application (with the instructions - above). - -Before starting the OTA process, the Linux OTA Provider application can be built -on the RPi (if not already present in the pre-installed apps) : - -``` -user@ubuntu:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota-provider-app chip_config_network_layer_ble=false - -user@ubuntu:~/connectedhomeip$ : rm -rf /tmp/chip_* -user@ubuntu:~/connectedhomeip$ : ./out/ota-provider-app/chip-ota-provider-app -f chip-rw61x-all-cluster-example.ota -``` - -The OTA Provider should first be provisioned with chip-tool by assigning it the -node id 1, and then granted the ACL entries : - -``` -user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing onnetwork 1 20202021 -user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0 -``` - -The second step is to provision the device with the node id 2 using ble-wifi or -ble-thread commissioning. For example : - -``` -user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing ble-wifi 2 WIFI_SSID WIFI_PASSWORD 20202021 3840 -``` - -Once commissioned, the OTA process can be initiated with the -"announce-ota-provider" command using chip-tool (the given numbers refer -respectively to [ProviderNodeId][vendorid] [AnnouncementReason][endpoint] -[node-id][endpoint-id]) : - -``` -user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool otasoftwareupdaterequestor announce-otaprovider 1 0 0 0 2 0 -``` - -When the full update image is downloaded and stored, the bootloader will be -notified and the device will reboot with the update image. diff --git a/docs/guides/simulated_device_linux.md b/docs/guides/simulated_device_linux.md index db7e6bc4ef5..eb4d6d7564c 100644 --- a/docs/guides/simulated_device_linux.md +++ b/docs/guides/simulated_device_linux.md @@ -19,8 +19,8 @@ is defined by a ZAP config file and tests can be added with a - [Building Prerequisites](./BUILDING.md#prerequisites) - [Prepare For Building](./BUILDING.md#prepare-for-building) -- [Code Generate](../code_generation.md) -- [ZAP Installed](../code_generation.md#installing-zap-and-environment-variables) +- [Code Generate](../zap_and_codegen/code_generation.md) +- [ZAP Installed](../zap_and_codegen/code_generation.md#installing-zap-and-environment-variables) ## Building the default Simulated App with Script diff --git a/docs/ERROR_CODES.md b/docs/ids_and_codes/ERROR_CODES.md similarity index 100% rename from docs/ERROR_CODES.md rename to docs/ids_and_codes/ERROR_CODES.md diff --git a/docs/ids_and_codes/index.md b/docs/ids_and_codes/index.md new file mode 100644 index 00000000000..ef87b9ca01c --- /dev/null +++ b/docs/ids_and_codes/index.md @@ -0,0 +1,10 @@ +# IDs and Codes + + +```{toctree} +:glob: +:maxdepth: 1 + +* + +``` diff --git a/docs/spec_clusters.md b/docs/ids_and_codes/spec_clusters.md similarity index 98% rename from docs/spec_clusters.md rename to docs/ids_and_codes/spec_clusters.md index 43db0725793..2500e7de00e 100644 --- a/docs/spec_clusters.md +++ b/docs/ids_and_codes/spec_clusters.md @@ -1,5 +1,5 @@ # List of currently defined spec clusters -This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.py`. DO NOT EDIT BY HAND! +This file was **AUTOMATICALLY** generated. Refer to this page: [data_model](/data_model/README.md). DO NOT EDIT BY HAND! | ID (Decimal) | ID (hex) | Name | |--------------|----------|----------------------------------------------------------| diff --git a/docs/zap_clusters.md b/docs/ids_and_codes/zap_clusters.md similarity index 95% rename from docs/zap_clusters.md rename to docs/ids_and_codes/zap_clusters.md index 1250a60b713..e5cd002d72c 100644 --- a/docs/zap_clusters.md +++ b/docs/ids_and_codes/zap_clusters.md @@ -129,10 +129,16 @@ Generally regenerate using one of: | 1294 | 0x50E | AccountLogin | | 1295 | 0x50F | ContentControl | | 1296 | 0x510 | ContentAppObserver | +| 1360 | 0x550 | ZoneManagement | +| 1361 | 0x551 | CameraAvStreamManagement | +| 1362 | 0x552 | CameraAvSettingsUserLevelManagement | | 1363 | 0x553 | WebRTCTransportProvider | +| 1364 | 0x554 | WebRTCTransportRequestor | +| 1365 | 0x555 | PushAvStreamTransport | | 1366 | 0x556 | Chime | | 1872 | 0x750 | EcosystemInformation | | 1873 | 0x751 | CommissionerControl | +| 2049 | 0x801 | TlsCertificateManagement | | 4294048773 | 0xFFF1FC05 | UnitTesting | | 4294048774 | 0xFFF1FC06 | FaultInjection | | 4294048800 | 0xFFF1FC20 | SampleMei | diff --git a/docs/index.md b/docs/index.md index f4b40622714..cd5fe17d102 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ -# Welcome to Matter's documentation! +# Welcome to Matter's documentation ```{toctree} :maxdepth: 2 @@ -8,22 +8,22 @@ PROJECT_FLOW VSCODE_DEVELOPMENT ci-cd/index +development_controllers/index getting_started/index +ids_and_codes/index cluster_and_device_type_dev/index guides/index +platforms/index style/index examples/index product_considerations/index testing/index tips_and_troubleshooting/index tools/index +zap_and_codegen/index BUG_REPORT -code_generation -zap_clusters -spec_clusters upgrading -ERROR_CODES - +issue_triage ``` ```{include} README.md diff --git a/docs/issue_triage.md b/docs/issue_triage.md new file mode 100644 index 00000000000..9cffd9cd0c0 --- /dev/null +++ b/docs/issue_triage.md @@ -0,0 +1,147 @@ +# Project issues + +General issues are listed at + . + +In order to be able to effectively follow up on these issues, they are separated +into groups for further review and fixing based on current maintainers on +specific areas of the code. The separation is done via `labels`. + +Issues that still need triaging are labeled as `needs triage`: + + + +## Non-SDK issues + +In some cases the issue is integrating with ecosystems or environments are not +supported. In these cases, issues can be re-directed to specific support pages +rather than the SDK GitHub issues. + +### Google Integration + +- General integration link: +- Support via the communities areas: + - Stack overflow: + + - Google Nest Community: + + +### Apple Integration + +This applies if there is an issue with Home interacting with a device (as +opposed to an issue with Matter.framework or the SDK that is encountered by code +actually running on darwin). + +General instructions available at [here](./guides/darwin.md) in the +`Providing feedback to Apple` section. + +Once a Feedback Assistant ticket is filed, the ticket ID can be sent to Boris +Zbkarsky to ensure it is noticed by the right people + +### Environments not currently supported / not maintained + +Some items are explicitly not maintained currently + +- Windows integration: no official maintainer for this so currently not + supported +- Old compiler support: CHIP requires a C++17 or higher compiler. + +## Platform maintainers + +This level of separation is generally for platform-specific issues (e.g. failure +to commission for one specific platform, failure to run on some specific +operating system). + +Contact is generally done on slack. E-mail addresses are not added here on +purpose in order to avoid spam. + +| Platform | Contact | Label | Note(s) | +| ------------ | --------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------- | +| Android | Andrei Litvin, Yunhan Wang, Yufeng Wang | [android](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Aandroid) | | +| Darwin | Boris Zbarsky, Justin Wood | [darwin](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Adarwin) | | +| Espressif | Hrishikesh Dhayagude | [esp32](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Aesp32) | | +| Linux | Andrei Litvin | [linux](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Alinux) | | +| Nordic | Lucasz Duda | [nrf](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Anrf) | | +| NXP | Doru Gucea | [nxp](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Anxp) | | +| Silabs/EFR32 | Jean Francois Penven, Junior Martinez | [efr32](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Aefr32) | | + +## Code areas + +The following people can be contacted about issues in specific area of code are +affected that are not platform-specific. + +| Code area | Contact | Label | Note(s) | +| ------------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| ARM cross-compile | Andrei Litvin | N/A | Some support for cross-compiling on x64 linux for arm64 linux (like Raspberry PI) | +| Build system (darwin, xcode) | Boris Zbarsky, Justin Wood | N/A | darwin specific builds, xcode connector | +| Build system (gn, ninja) | Andrei Litvin | N/A | General build system questions and gn support, generally on Linux | +| MatterIDL | Andrei Litvin | N/A | General .matter files and code generation based on it | +| Minimal MDNS | Andrei Litvin | N/A | mdns specfic. Note that platformdns also exists and issues are often "DNSSD" rather than minmdns specific | +| Python testing infrastructure/helpers | Cecille Freeman | N/A | Writing tests cases in python. **NOTE** this is for test infrastrure and NOT for individual test issues. Test case failures are associated with test applications or the test case script. | +| ZAP Code Generation | Boris Zbarsky, Bharat Raju Dandu | [zap](https://github.com/project-chip/connectedhomeip/issues?q=is%3Aopen+is%3Aissue+label%3Azap) | Some issues may be in the zap project itself. This is for generic code generation issues and help, often regarding `.zapt` templates | +| src/crypto, src/credentials | Tennessee Carmel-Veilleux | N/A | | + +## Example maintenance + +Examples often correspond to specific device types. We have split the contact +per device type regardless of example (e.g. all-clusters will contain all device +types or functionality) as well as individual examples. + +### Per device type + +| Device Type(s) | Contact | Label | Note(s) | +| -------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------ | ------- | +| Fabric Bridge, Fabric Sync | Yufeng Wang, Terence Hampson | [fabric-sync](https://github.com/project-chip/connectedhomeip/pulls?q=is%3Aopen+is%3Apr+label%3Afabric-sync) | | + +### Per example + +| Example path | Contact | Note(s) | +| ---------------------------------------------- | ---------------------------- | ------------ | +| `examples/air-purifier-app` | | UNMAINTAINED | +| `examples/air-quality-sensor-app` | | UNMAINTAINED | +| `examples/all-clusters-app` | | UNMAINTAINED | +| `examples/all-clusters-minimal-app` | | UNMAINTAINED | +| `examples/android` | Yunhan Wang | | +| `examples/bridge-app` | | UNMAINTAINED | +| `examples/build_overrides` | | UNMAINTAINED | +| `examples/chef` | Andrei Litvin | | +| `examples/chip-tool` | | UNMAINTAINED | +| `examples/contact-sensor-app` | | UNMAINTAINED | +| `examples/darwin-framework-tool` | Boris Zbarsky | | +| `examples/dishwasher-app` | | UNMAINTAINED | +| `examples/energy-management-app` | James Harrow | | +| `examples/fabric-admin` | Yufeng Wang, Terence Hampson | | +| `examples/fabric-bridge-app` | Yufeng Wang, Terence Hampson | | +| `examples/java-matter-controller` | Yunhan Wang, Yufeng Wang | | +| `examples/kotlin-matter-controller` | Yunhan Wang, Yufeng Wang | | +| `examples/laundry-washer-app` | | UNMAINTAINED | +| `examples/lighting-app` | Junior Martinez | | +| `examples/lighting-app-data-mode-no-unique-id` | | UNMAINTAINED | +| `examples/light-switch-app` | | UNMAINTAINED | +| `examples/lit-icd-app` | Yunhan Wang | | +| `examples/lock-app` | | UNMAINTAINED | +| `examples/log-source-app` | | UNMAINTAINED | +| `examples/microwave-oven-app` | Rob Bultman | | +| `examples/minimal-mdns` | Andrei Litvin | | +| `examples/network-manager-app` | Thomas Lea | | +| `examples/ota-provider-app` | | UNMAINTAINED | +| `examples/ota-requestor-app` | | UNMAINTAINED | +| `examples/persistent-storage` | | UNMAINTAINED | +| `examples/pigweed-app` | | UNMAINTAINED | +| `examples/placeholder` | | UNMAINTAINED | +| `examples/providers` | | UNMAINTAINED | +| `examples/pump-app` | | UNMAINTAINED | +| `examples/pump-controller-app` | | UNMAINTAINED | +| `examples/refrigerator-app` | | UNMAINTAINED | +| `examples/resource-monitoring-app` | | UNMAINTAINED | +| `examples/rvc-app` | | UNMAINTAINED | +| `examples/smoke-co-alarm-app` | | UNMAINTAINED | +| `examples/temperature-measurement-app` | | UNMAINTAINED | +| `examples/terms-and-conditions-app` | James Swan | | +| `examples/thermostat` | | UNMAINTAINED | +| `examples/thread-br-app` | | UNMAINTAINED | +| `examples/tv-app` | Chris DeCenzo, Lazar Kovacic | | +| `examples/tv-casting-app` | Chris DeCenzo, Lazar Kovacic | | +| `examples/virtual-device-app` | | UNMAINTAINED | +| `examples/water-leak-detector-app` | | UNMAINTAINED | +| `examples/window-app` | | UNMAINTAINED | diff --git a/docs/guides/android_building.md b/docs/platforms/android/android_building.md similarity index 100% rename from docs/guides/android_building.md rename to docs/platforms/android/android_building.md diff --git a/docs/platforms/android/index.md b/docs/platforms/android/index.md new file mode 100644 index 00000000000..a8bdd372909 --- /dev/null +++ b/docs/platforms/android/index.md @@ -0,0 +1,11 @@ +# Android + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Android - Building](./android_building.md) diff --git a/docs/guides/asr_getting_started_guide.md b/docs/platforms/asr/asr_getting_started_guide.md similarity index 97% rename from docs/guides/asr_getting_started_guide.md rename to docs/platforms/asr/asr_getting_started_guide.md index e47cc554ef2..e5a4bac6e2e 100644 --- a/docs/guides/asr_getting_started_guide.md +++ b/docs/platforms/asr/asr_getting_started_guide.md @@ -33,7 +33,7 @@ to speed up development. You can find them in the samples with `/asr` subfolder. ## Building the Example Application -- [Setup Matter Environment](./BUILDING.md) +- [Setup Matter Environment](../../guides/BUILDING.md) - Setup toolchain - for ASR582X and ASR550X @@ -140,7 +140,7 @@ There are two commissioning modes supported by ASR platform: `build_examples.py` script. For example: `./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting-ota build` 2. For more usage details, please refer to the - [OTA example](../../examples/ota-requestor-app/asr/README.md) + [OTA example](../../../examples/ota-requestor-app/asr/README.md) ## Factory diff --git a/docs/platforms/asr/index.md b/docs/platforms/asr/index.md new file mode 100644 index 00000000000..f4748a4c704 --- /dev/null +++ b/docs/platforms/asr/index.md @@ -0,0 +1,11 @@ +# ASR + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[ASR - Getting Started Guide](./asr_getting_started_guide.md) diff --git a/docs/platforms/bouffalolab/getting_started.md b/docs/platforms/bouffalolab/getting_started.md new file mode 100644 index 00000000000..eb96bc8da04 --- /dev/null +++ b/docs/platforms/bouffalolab/getting_started.md @@ -0,0 +1,286 @@ +# Checking out the Matter code + +## Checking out all Platforms + +To check out the Matter repository with all platforms, run the following +command: + +``` +git clone --recurse-submodules https://github.com/project-chip/connectedhomeip.git +``` + +## Checking out `Bouffalo Lab` Platform + +- Checking out matter top level repo with command below: + + ``` + git clone --depth=1 https://github.com/project-chip/connectedhomeip.git + ``` + +- check out `Bouffalo Lab` platform support repos as follows: + + ``` + scripts/checkout_submodules.py --shallow --recursive --platform bouffalolab + ``` + + If you want to checkout Matter Linux example and development tools, please + try as follows: + + ``` + scripts/checkout_submodules.py --shallow --recursive --platform linux bouffalolab + ``` + + Or if you want to checkout Matter Darwin example and development tools, + please try as follows: + + ``` + scripts/checkout_submodules.py --shallow --recursive --platform darwin bouffalolab + ``` + +# Setup build environment + +Please refer to section `Prerequisites` in +[BUILDING.md](../../guides/BUILDING.md) to install build software. + +## Install toolchains for `Bouffalo Lab` SoC + +- Enter to cloned Matter project in terminal and run the following script + + ``` + ./integrations/docker/images/stage-2/chip-build-bouffalolab/setup.sh + ``` + + Script `setup.sh` requires to select install path, and please execute + following command to export `BOUFFALOLAB_SDK_ROOT` before building. + + ``` + export BOUFFALOLAB_SDK_ROOT="Your install path" + ``` + +## Setup Matter build environment + +- Enter to cloned Matter project in terminal and run the following script + + ``` + source scripts/activate.sh -p bouffalolab + ``` + + > Please refer to `scripts/bootstrap.sh` and `scripts/activate.sh` for more + > detail. + +# Build examples + +## Build options for `Bouffalo Lab` SoC + +With `source scripts/activate.sh -p bouffalolab` under terminal, please try the +following command to list supports options. + +``` +./scripts/build/build_examples.py targets +``` + +The output with `bouffalolab` started likes below: + +``` +bouffalolab-{bl602dk,bl704ldk,bl706dk,bl602-night-light,bl706-night-light,bl602-iot-matter-v1,xt-zb6-devkit}-{light,contact-sensor}-{ethernet,wifi,thread,thread-ftd,thread-mtd}-{easyflash,littlefs}[-shell][-mfd][-rotating_device_id][-rpc][-cdc] +``` + +- supported board options, select one of the following options to build + + - `-bl602dk` + - `-bl616dk` + - `-bl704ldk` + - `-bl706dk` + + - `-bl602-night-light` + - `-bl706-night-light` + - `-bl602-iot-matter-v1` + - `-xt-zb6-devkit` + +- supported example options, select one of the following options to build + + - `-light` + - `-contact-sensor`, currently, only BL704L with Thread MTD and low power + supported + +- connectivity options, select one of the following options to build + + - `-wifi`, specifies to use Wi-Fi for Matter application. + + - `-ethernet`, specifies to use Ethernet for Matter application. + + - `-thread`, specifies to use Thread FTD for Matter application. + + - `-thread-ftd`, specifies to use Thread FTD for Matter application. + + - `-thread-mtd`, specifies to use Thread MTD for Matter application. + +- storage options, select one of the following options to build + + - `-littlefs`, specifies to use `littlefs` for flash access. + + - `-easyflash`, specifies to use `easyflash` for flash access. + + > `littlefs` has different format with `easyflash`, please uses + > `-easyflash` for your in-field production + +- `-rotating_device_id`, enable rotating device id + +- `-mfd`, enable Matter factory data feature, which load factory data from + `MFD` partition + + - Please refer to + [Bouffalo Lab Matter factory data guide](./matter_factory_data.md) or + contact to `Bouffalo Lab` for support. + +- `-shell`, enable command line + +- `-rpc`, enable Pigweed RPC feature, which will use `baudrate` 115200 for PRC + +- `-cdc`, enable USB CDC feature, only support for BL706, and can't work with + Ethernet Board + +> `Bouffalo Lab` Matter project uses UART `baudrate` 2000000 for logging output +> by default. If you want other `baudrate` for your test station, please change +> variable `baudrate` in `BUILD.gn` under example project. + +## Build an example + +Taking lighting app with `littlefs` supported as example : + +- BL602DK with Wi-Fi + + ``` + ./scripts/build/build_examples.py --target bouffalolab-bl602dk-light-wifi-littlefs build + ``` + +- BL616DK with Wi-Fi + + ```shell + ./scripts/build/build_examples.py --target bouffalolab-bl616dk-light-wifi-littlefs build + ``` + +- BL616 with Thread + + ``` + ./scripts/build/build_examples.py --target bouffalolab-bl616dk-light-thread-littlefs build + ``` + +- BL704L with Thread + + ``` + ./scripts/build/build_examples.py --target bouffalolab-bl704ldk-light-thread-littlefs build + ``` + +- BL706 with Thread + + ``` + ./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-thread-littlefs build + ``` + +- BL706 with Ethernet + + ``` + ./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-ethernet-littlefs build + ``` + +- BL706 with Wi-Fi + + ``` + ./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-ethernet-littlefs build + ``` + + > This BL706 + BL602 Wi-Fi solution: BL602 runs WLAN part and BL706 runs + > TCP/IP stack which uses SPI for communication between these two parts. + +# Download image + +Take build target `bouffalolab-bl602dk-light-wifi-littlefs` as example to +introduce image downloading steps. + +After example compiled, a python script `chip-bl602-lighting-example.flash.py` +will be generated out under `./out/bouffalolab-bl602dk-light-wifi-littlefs/` and +is used to download image to `Bouffalo Lab` SoC. + +And download image as following steps: + +- Connect the board to your build machine with USB cable + +- Put the SoC to the download mode: + + - Press and hold the **BOOT** button. + - Click the **RESET** or **EN** button. + - Release the **BOOT** button. + +- Type following command for image download. Please set serial port + accordingly, here we use /dev/ttyACM0 as a serial port example. + + ```shell + ./out/bouffalolab-bl602dk-light-wifi-littlefs/chip-bl602-lighting-example.flash.py --port /dev/ttyACM0 + ``` + + If needs to download image with the whole flash erased, please append + `--erase` option. + + ```shell + ./out/bouffalolab-bl602dk-light-wifi-littlefs/chip-bl602-lighting-example.flash.py --port /dev/ttyACM0 --erase + ``` + + > Note, better to append --erase option to download image for BL602 develop + > board at first time. + +- Then, open serial console `/dev/ttyACM0` with `baudrate` 2000000. The log + will output if the **RESET** or **EN** button clicked. + +# Test Commission and Control with chip-tool + +Please follow +[chip_tool_guide](../../development_controllers/chip-tool/chip_tool_guide.md) to +build and [guide](../../../examples/chip-tool/README.md) use chip-tool for test. + +## Prerequisite for Thread Protocol + +Thread wireless protocol could runs on BL704L/BL706/BL616, which needs a Thread +border router to connect Thread network to Wi-Fi/Ethernet network. Please follow +this [guide](../openthread/openthread_border_router_pi.md) to setup a raspberry +Pi border router. + +After Thread border router setup, please type following command on Thread border +router to get Thread network credential. + +```shell +sudo ot-ctl dataset active -x +``` + +## Commissioning over BLE + +- Reset the board or factory reset the board + +- Enter build out folder of chip-tool and running the following command to do + BLE commission + + - Wi-Fi + + ```shell + ./out/linux-x64-chip-tool/chip-tool pairing ble-wifi 20202021 3840 + ``` + + - Thread + + ```shell + ./out/linux-x64-chip-tool/chip-tool pairing ble-thread hex: 20202021 3840 + ``` + + - Ethernet + `./out/linux-x64-chip-tool/chip-tool pairing onnetwork 20202021` + > ``, which is node ID assigned to device with + > chip-tool;
``, Wi-Fi network SSID;
``, + > Wi-FI network password;
``, Thread + > network credential which running `sudo ot-ctl dataset active -x` + > command on border router to get. + +## Read a cluster attribute + +``` +./out/linux-x64-chip-tool/chip-tool basicinformation read vendor-name 0 +``` diff --git a/docs/platforms/bouffalolab/index.md b/docs/platforms/bouffalolab/index.md new file mode 100644 index 00000000000..c3cc8f3db84 --- /dev/null +++ b/docs/platforms/bouffalolab/index.md @@ -0,0 +1,15 @@ +# Bouffalolab + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Bouffalo Lab - Platform overview](./platform_overview.md) +[Bouffalo Lab - Getting Started](./getting_started.md) +[Bouffalo Lab - OTA upgrade](./ota_upgrade.md) +[Bouffalo Lab - Matter factory data generation](./matter_factory_data.md) +[Bouffalo Lab - RPC console](./rpc_console.md) diff --git a/docs/platforms/bouffalolab/matter_factory_data.md b/docs/platforms/bouffalolab/matter_factory_data.md new file mode 100644 index 00000000000..9021cd80f61 --- /dev/null +++ b/docs/platforms/bouffalolab/matter_factory_data.md @@ -0,0 +1,249 @@ +# Introduction to Matter factory data + +Each Matter device should have it own unique factory data manufactured. + +This guide demonstrates what `Bouffalo Lab` provides to support factory data: + +- credential factory data protected by hardware security engine +- reference tool to generate factory data +- tool/method to program factory data + +# Matter factory data + +## How to enable + +One dedicate flash region allocates for factory data as below which is read-only +for firmware. + +```toml +name = "MFD" +address0 = 0x3FE000 +size0 = 0x1000 +``` + +To enable matter factory data feature, please append `-mfd` option at end of +target name. Take BL602 Wi-Fi Matter Light as example. + +``` +./scripts/build/build_examples.py --target bouffalolab-bl602dk-light-littlefs-mfd build +``` + +## Factory data + +This flash region is divided to two parts: + +- One is plain text data, such as Vendor ID, Product ID, Serial number and so + on. + + > For development/test purpose, all data can put in plain text data. + +- Other is cipher text data, such as private key for device attestation data. + + `Bouffalo Lab` provides hardware security engine to decrypt this part data + with **only hardware access** efuse key. + +Current supported data + +- DAC certificate and private key +- PAI certificate +- Certificate declaration + +- Discriminator ID +- Pass Code +- Spake2p iteration count, salt and verifier +- Vendor ID and name +- Product ID and name +- Product part number and product label +- Manufacturing date +- Hardware version and version string +- Serial Number +- Unique identifier + +> Note, it is available to add customer/product own information in factory data, +> please reference to `bl_mfd.h`/`bl_mfd.c` in SDK and reference generation +> script +> [generate_factory_data.py](../../../scripts/tools/bouffalolab/generate_factory_data.py) + +# Generate Matter factory data + +Script tool +[generate_factory_data.py](../../../scripts/tools/bouffalolab/generate_factory_data.py) +call `chip-cert` to generate test certificates and verify certificates. + +Please run below command to compile `chip-cert` tool under `connnectedhomeip` +repo. + +```shell +./scripts/build/build_examples.py --target linux-x64-chip-cert build +``` + +## Command options + +- `--cd`, certificate declare + + If not specified, `Chip-Test-CD-Signing-Cert.pem` and + `Chip-Test-CD-Signing-Key.pem` will sign a test certificate declare for + development and test purpose + +- `--pai_cert` and `--pai-key`, PAI certificate and PAI private key + + If not specified, `Chip-Test-PAI-FFF1-8000-Cert.pem` and + `Chip-Test-PAI-FFF1-8000-Key.pem` will be used for development and test + purpose. + +- `--dac_cert` and `--dac_key`, DAC certificate and DAC private key. + + If not specified, script will use PAI certificate and key specified + by`--pai_cert` and `--pai-key` to generate DAC certificate and private key + for development and test purpose. + +- `--discriminator`, discriminator ID + + If not specified, script will generate for user. + +- `--passcode`, passcode + + If not specified, script will generate for user. + +- `--spake2p_it` and `--spake2p_salt` + + If not specified, script will generate and calculate verifier for user. + +Please reference to `--help` for more detail. + +## Generate with default test certificates + +- Run following command to generate all plain text factory data + + Please create output folder first. Here takes `out/test-cert` as example. + + ```shell + ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert + ``` + +- Run following command to generate factory data which encrypt private of + device attestation data + + ```shell + ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --key + ``` + + > An example of hex string of 16 bytes: 12345678123456781234567812345678 + +After command executes successfully, the output folder will has files as below: + +- Test certificate declare file which file name ends with `cd.der` + + If user wants to reuse CD generated before, please specify CD with option + `--cd` as below. + + ```shell + ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --cd + ``` + +- Test DAC certificate and DAC certificate key which file names ends with + `dac_cert.pem` and `dac_key.pem` separately. + +- QR code picture which file name ends with `onboard.png` +- On board information which file name ends with `onboard.txt` +- Matter factory data which file name ends with `mfd.bin`. + +## Generate with self-defined PAA/PAI certificates + +Self-defined PAA/PAI certificates may use in development and test scenario. But, +user should know it has limit to work with real ecosystem. + +- Export environment variables in terminal for easy operations + + ``` + export TEST_CERT_VENDOR_ID=130D # Vendor ID hex string + export TEST_CERT_CN=BFLB # Common Name + ``` + +- Generate PAA certificate and key to `out/cert` folder. + + ```shell + mkdir out/test-cert + ./out/linux-x64-chip-cert/chip-cert gen-att-cert --type a --subject-cn "${TEST_CERT_CN} PAA 01" --valid-from "2020-10-15 14:23:43" --lifetime 7305 --out-key out/test-cert/Chip-PAA-Key-${TEST_CERT_VENDOR_ID}.pem --out out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID}.pem --subject-vid ${TEST_CERT_VENDOR_ID} + ``` + +- Convert PAA PEM format file to PAA DER format file + + ```shell + ./out/linux-x64-chip-cert/chip-cert convert-cert -d out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID}.pem out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID}.der + ``` + + > Please save this PAA DER format file which will be used by `chip-tool` + > during commissioning. + +- Generate PAI certificate and key: + + ```shell + ./out/linux-x64-chip-cert/chip-cert gen-att-cert --type i --subject-cn "${TEST_CERT_CN} PAI 01" --subject-vid ${TEST_CERT_VENDOR_ID} --valid-from "2020-10-15 14:23:43" --lifetime 7305 --ca-key out/test-cert/Chip-PAA-Key-${TEST_CERT_VENDOR_ID}.pem --ca-cert out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID}.pem --out-key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID}.pem --out out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID}.pem + ``` + +- Generate `MFD` in plain text data + + ```shell + ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --paa_cert out/test-cert/Chip-PAA-Cert-${TEST_CERT_VENDOR_ID}.pem --paa_key out/test-cert/Chip-PAA-Key-${TEST_CERT_VENDOR_ID}.pem --pai_cert out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID}.pem --pai_key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID}.pem + ``` + + > Appending `--key ` option to enable encrypt + > private key of attestation device data. + +## Generate with self-defined DAC certificate and key + +Self-defined DAC certificates may use in development and test scenario. But, +user should know it has limit to work with real ecosystem. + +- Export environment variables in terminal for easy operations + + ``` + export TEST_CERT_VENDOR_ID=130D # Vendor ID hex string + export TEST_CERT_PRODUCT_ID=1001 # Vendor ID hex string + export TEST_CERT_CN=BFLB # Common Name + ``` + +- Generate DAC certificate and key + + ```shell + out/linux-x64-chip-cert/chip-cert gen-att-cert --type d --subject-cn "${TEST_CERT_CN} PAI 01" --subject-vid ${TEST_CERT_VENDOR_ID} --subject-pid ${TEST_CERT_VENDOR_ID} --valid-from "2020-10-16 14:23:43" --lifetime 5946 --ca-key out/test-cert/Chip-PAI-Key-${TEST_CERT_VENDOR_ID}.pem --ca-cert out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID}.pem --out-key out/test-cert/Chip-DAC-Key-${TEST_CERT_VENDOR_ID}-${TEST_CERT_PRODUCT_ID}.pem --out out/test-cert/Chip-DAC-Cert-${TEST_CERT_VENDOR_ID}-${TEST_CERT_PRODUCT_ID}.pem + ``` + + > **Note**, `--valid-from` and `--lifetime` should be in `--valid-from` and + > `--lifetime` of PAI certificate. + +- Generate `MFD` in plain text data + + ```shell + ./scripts/tools/bouffalolab/generate_factory_data.py --output out/test-cert --pai_cert out/test-cert/Chip-PAI-Cert-${TEST_CERT_VENDOR_ID}.pem --dac_cert out/test-cert/Chip-DAC-Cert-${TEST_CERT_VENDOR_ID}-${TEST_CERT_PRODUCT_ID}.pem --dac_key out/test-cert/Chip-DAC-Key-${TEST_CERT_VENDOR_ID}-${TEST_CERT_PRODUCT_ID}.pem + ``` + + > Appending `--key ` option to enable encrypt + > private key of attestation device data. + +# Program factory data + +After each target built successfully, a flash programming python script will be +generated under out folder. + +Take BL616 Wi-Fi Matter Light as example, `chip-bl616-lighting-example.flash.py` +is using to program firmware, and also for factory data and factory decryption +key. + +```shell +/out/bouffalolab-bl616dk-light-wifi-mfd/chip-bl616-lighting-example.flash.py --port --mfd out/test-cert/ +``` + +> If `MFD` file has cipher text data, please append +> `--key ` option to program to this key to efuse. + +- Limits on BL IOT SDK + + If developer would like to program `MFD` with all plain text data, option + `--key ` needs pass to script, otherwise, flash tool + will raise an error. And SoC BL602, BL702 and BL702L use BL IOT SDK for + Matter Application. + +Please free contact to `Bouffalo Lab` for DAC provider service and higher +security solution, such as SoC inside certificate requesting. diff --git a/docs/platforms/bouffalolab/ota_upgrade.md b/docs/platforms/bouffalolab/ota_upgrade.md new file mode 100644 index 00000000000..2a50f073e8d --- /dev/null +++ b/docs/platforms/bouffalolab/ota_upgrade.md @@ -0,0 +1,108 @@ +# Build OTA image + +Take build target `bouffalolab-bl602dk-light-wifi-littlefs` as example to +introduce OTA image building. + +After example compiled, a python script `chip-bl602-lighting-example.flash.py` +will be generated out under `./out/bouffalolab-bl602dk-light-wifi-littlefs/` and +is used to download image to `Bouffalo Lab` SoC. + +Type following command to generated OTA images: + +```shell +./out/bouffalolab-bl602dk-light-wifi-littlefs/chip-bl602-lighting-example.flash.py --build-ota --vendor-id --product-id --version --version-str --digest-algorithm +``` + +Please find `./src/app/ota_image_tool.py` for information on `vendor id`, +`product id`, `version number`, `version number string` and `digest algorithm`. + +Here is an example command to generate an OTA image, + +> Please change `CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION` and +> `CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING`in CHIPProjectConfig.h +> under example folder before to build a test OTA image. + +```shell +./out/bouffalolab-bl602dk-light-wifi-littlefs/chip-bl602-lighting-example.flash.py --build-ota --vendor-id 0xFFF1 --product-id 0x8005 --version 10 --version-str "1.0" --digest-algorithm sha256 +``` + +OTA images will generated under +`out/bouffalolab-bl602dk-light-wifi-littlefs/ota_images`: + +> BL702 and BL702L have same OTA image format with BL602 + +- `chip-bl602dk-lighting-example.bin.hash.matter`, OTA image packed with raw + firmware image. +- `chip-bl602dk-lighting-example.bin.xz.hash.matter`, OTA image packed with + compressed firmware image. + +BL616 SoC platform uses different OTA image format. Take BL616D lighting app +with Wi-Fi and `littlefs` supported as example: + +- `chip-bl616-lighting-example.bin.ota.matter`, OTA image packed with raw + firmware image. +- `chip-bl616-lighting-example.xz.ota.matter`, OTA image packed with + compressed firmware image. + +> Please contact `Bouffalo Lab` for more security requirements on firmware and +> OTA images. + +## Test OTA software upgrade with chip-tool and ota-provider-app + +Please follow +[chip_tool_guide](../../development_controllers/chip-tool/chip_tool_guide.md) +and [chip-tool guide](../../../examples/chip-tool/README.md) for chip-tool build +and usage and follow +[ota-provider-app guide](../../../examples/ota-provider-app/linux/README.md) for +ota-provider-app build and usage. + +### Start ota-provider-app + +- Start ota-provider-app with OTA compressed image. + + ```shell + $ rm -r /tmp/chip_* + $ out/linux-x64-ota-provider/chip-ota-provider-app -f out/bouffalolab-bl602dk-light-wifi-littlefs/ota_images/chip-bl602-lighting-example.bin.xz.hash.matter + ``` + +- Provision ota-provider-app with node id assigned + ```shell + $ ./out/linux-x64-chip-tool/chip-tool pairing onnetwork 20202021 + $ ./out/linux-x64-chip-tool/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 0 + ``` + +### Start ota software upgrade + +- BLE commission with node id assigned + + - Wi-Fi + + ```shell + ./out/linux-x64-chip-tool/chip-tool pairing ble-wifi 20202021 3840 + ``` + + - Thread + + ```shell + ./out/linux-x64-chip-tool/chip-tool pairing ble-thread hex: 20202021 3840 + ``` + + - Ethernet + ``` + ./out/linux-x64-chip-tool/chip-tool pairing onnetwork 20202021 + ``` + +- Start OTA software upgrade process + + ```shell + ./out/linux-x64-chip-tool/chip-tool otasoftwareupdaterequestor announce-otaprovider 0 0 0 0 + ``` + +- After the OTA software upgrade completes, the device will reboot + automatically. Once rebooted, execute the following commands to verify if + the new firmware is applied: + + ``` + ./out/linux-x64-chip-tool/chip-tool basicinformation read software-version 0 + ./out/linux-x64-chip-tool/chip-tool basicinformation read software-version-string 0 + ``` diff --git a/docs/platforms/bouffalolab/platform_overview.md b/docs/platforms/bouffalolab/platform_overview.md new file mode 100644 index 00000000000..d6a0fe96181 --- /dev/null +++ b/docs/platforms/bouffalolab/platform_overview.md @@ -0,0 +1,75 @@ +# `Bouffalo Lab` SoCs + +- BL602 + + BL602/BL604 is combo chip-set for Wi-Fi 4 and BLE 5.0. + +- BL61X + + BL61X is combo chip-set for Wi-Fi 6, Classic Bluetooth, Bluetooth low energy + 5.3 and IEEE 802.15.4/ZigBee/Thread. + + BL61X has fully certified with all Thread 1.3 features, included Thread + `SSED` and Thread Border Router. + +- BL70X + + BL70X is combo chip-set for BLE and IEEE 802.15.4/ZigBee/Thread. + + BL70X has fully certified with all Thread 1.3 features, included Thread + `SSED` and Thread Border Router. + + - BL702/BL706 has 14dbm tx power and is recommended for routing devices. + SDK uses BL702 as a general name. + - BL702L/BL704L is designed for low power application. SDK uses BL702L as + a general name. + +# Solutions introduction + +`Bouffalo Lab` has full connectivity supports for Matter Applications. + +- Wi-Fi 4/6 application, we have + - BL602, Wi-Fi 4 application. + - BL706 + BL602, Wi-Fi 4 application. + - BL616, Wi-Fi 6 application +- Thread application, we have + - BL70X/BL616 + - BL704L, Thread low power application. +- Ethernet application, we have + - BL706/BL618 +- Openthread Border Router application based on FreeRTOS + - BL706 + BL602, Wi-Fi 4 as infrastructure network + - BL616, Wi-Fi 6 as infrastructure network + - BL706/BL616, Ethernet as as infrastructure network +- Matter ZigBee Bridge application based on FreeRTOS - BL706 + BL602, Wi-Fi 4 + as infrastructure network - BL616, Wi-Fi 6 as infrastructure network - + BL706/BL616, Ethernet as as infrastructure network + > Please contact `Bouffalo Lab` for supports on OTBR and Matter ZigBee + > Bridge application + +# Current supported + +- Current supported boards: + + - `BL602DK` + + - `BL616DK` + + > Please contact `Bouffalo Lab` for BL616 SDK. + + - `BL704LDK` + + - `BL706DK` + +- Legacy supported boards: + + - `BL602-IoT-Matter-V1` + - `BL602-NIGHT-LIGHT` + - `XT-ZB6-DevKit` + - `BL706-NIGHT-LIGHT` + +- Supported examples: + + - [Lighting app](../../../examples/lighting-app/bouffalolab/README.md) + + - [Contact sensor app](../../../examples/contact-sensor-app/bouffalolab/README.md) diff --git a/docs/platforms/bouffalolab/rpc_console.md b/docs/platforms/bouffalolab/rpc_console.md new file mode 100644 index 00000000000..6a506d69d32 --- /dev/null +++ b/docs/platforms/bouffalolab/rpc_console.md @@ -0,0 +1,38 @@ +# `Bouffalo Lab` with RPC console + +## Build image + +- `BL602DK` + + ```shell + ./scripts/build/build_examples.py --target bouffalolab-bl602dk-light-wifi-littlefs-rpc build + ``` + +- `BL704LDK` + + ```shell + ./scripts/build/build_examples.py --target bouffalolab-bl704ldk-light-thread-littlefs-rpc build + ``` + +- `BL706DK` + + ```shell + ./scripts/build/build_examples.py --target bouffalolab-bl706dk-light-thread-littlefs-rpc build + ``` + +## Run RPC Console + +- Build chip-console following this + [guide](../../../examples/common/pigweed/rpc_console/README.md) + +- Start the console + + ``` + $ chip-console -d /dev/ttyACM0 -b 115200 + ``` + +- Get or Set the light state + + `rpcs.chip.rpc.Lighting.Get()` + + `rpcs.chip.rpc.Lighting.Set(on=True, level=128)` diff --git a/docs/guides/esp32/ble_settings.md b/docs/platforms/esp32/ble_settings.md similarity index 75% rename from docs/guides/esp32/ble_settings.md rename to docs/platforms/esp32/ble_settings.md index 36178ebece5..af6ba325d16 100644 --- a/docs/guides/esp32/ble_settings.md +++ b/docs/platforms/esp32/ble_settings.md @@ -13,13 +13,14 @@ advertising packets. ``` { - uint8_t scanResponse[31]; // 0x05, 0x09, a, b, c, d - scanResponse[0] = 0x05; - scanResponse[1] = 0x09; - scanResponse[2] = 0x61; - scanResponse[3] = 0x62; - scanResponse[4] = 0x63; - scanResponse[5] = 0x64; + + // Max length is 31 bytes + // Enter data in (length, type, value) format + // 0x05 - length of data + // 0x09 - Type (Complete Local Name) + // 0x61, 0x62, 0x63, 0x64 - Data (a,b,c,d) + uint8_t scanResponse[] = { 0x05, 0x09, 0x61, 0x62, 0x63, 0x64}; + chip::ByteSpan data(scanResponse); CHIP_ERROR err = chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureScanResponseData(data); if (err != CHIP_NO_ERROR) @@ -27,6 +28,8 @@ advertising packets. ESP_LOGE(TAG, "Failed to configure scan response, err:%" CHIP_ERROR_FORMAT, err.Format()); } } + + ``` Note: Scan response should be configure before `InitServer`. diff --git a/docs/guides/esp32/build_app_and_commission.md b/docs/platforms/esp32/build_app_and_commission.md similarity index 98% rename from docs/guides/esp32/build_app_and_commission.md rename to docs/platforms/esp32/build_app_and_commission.md index 942cb6add83..df295cc4937 100644 --- a/docs/guides/esp32/build_app_and_commission.md +++ b/docs/platforms/esp32/build_app_and_commission.md @@ -168,7 +168,7 @@ $ out/debug/chip-tool pairing ble-wifi 12345 MY_SSID MY_PASSWORD 20202021 3840 #### Commissioning the Thread device (ESP32H2) - For ESP32-H2, firstly start OpenThread Border Router, you can either use - [Raspberry Pi OpenThread Border Router](../openthread_border_router_pi.md) + [Raspberry Pi OpenThread Border Router](../openthread/openthread_border_router_pi.md) OR [ESP32 OpenThread Border Router](../../../examples/thread-br-app/esp32/README.md) diff --git a/docs/guides/esp32/config_options.md b/docs/platforms/esp32/config_options.md similarity index 100% rename from docs/guides/esp32/config_options.md rename to docs/platforms/esp32/config_options.md diff --git a/docs/guides/esp32/factory_data.md b/docs/platforms/esp32/factory_data.md similarity index 100% rename from docs/guides/esp32/factory_data.md rename to docs/platforms/esp32/factory_data.md diff --git a/docs/guides/esp32/flash_nvs_encryption.md b/docs/platforms/esp32/flash_nvs_encryption.md similarity index 100% rename from docs/guides/esp32/flash_nvs_encryption.md rename to docs/platforms/esp32/flash_nvs_encryption.md diff --git a/docs/guides/esp32/README.md b/docs/platforms/esp32/index.md similarity index 100% rename from docs/guides/esp32/README.md rename to docs/platforms/esp32/index.md diff --git a/docs/guides/esp32/ota.md b/docs/platforms/esp32/ota.md similarity index 100% rename from docs/guides/esp32/ota.md rename to docs/platforms/esp32/ota.md diff --git a/docs/guides/esp32/providers.md b/docs/platforms/esp32/providers.md similarity index 100% rename from docs/guides/esp32/providers.md rename to docs/platforms/esp32/providers.md diff --git a/docs/guides/esp32/rpc_console.md b/docs/platforms/esp32/rpc_console.md similarity index 100% rename from docs/guides/esp32/rpc_console.md rename to docs/platforms/esp32/rpc_console.md diff --git a/docs/guides/esp32/secure_cert_partition.md b/docs/platforms/esp32/secure_cert_partition.md similarity index 100% rename from docs/guides/esp32/secure_cert_partition.md rename to docs/platforms/esp32/secure_cert_partition.md diff --git a/docs/guides/esp32/setup_idf_chip.md b/docs/platforms/esp32/setup_idf_chip.md similarity index 100% rename from docs/guides/esp32/setup_idf_chip.md rename to docs/platforms/esp32/setup_idf_chip.md diff --git a/docs/guides/esp32/vs_code_development.md b/docs/platforms/esp32/vs_code_development.md similarity index 100% rename from docs/guides/esp32/vs_code_development.md rename to docs/platforms/esp32/vs_code_development.md diff --git a/docs/platforms/index.md b/docs/platforms/index.md new file mode 100644 index 00000000000..4011f2e4c26 --- /dev/null +++ b/docs/platforms/index.md @@ -0,0 +1,35 @@ +# Platform Guides + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +android/index +asr/index +bouffalolab/index +esp32/index +infineon/index +mbedos/index +nrf/index +nxp/index +openiotsdk/index +openthread/index +silabs/index +stm32/index +ti/index +``` + +- [Android](./android/) +- [ASR](./asr/) +- [Bouffalo Lab](./bouffalolab) +- [ESP32](./esp32/) +- [Infineon](./infineon/) +- [MbedOS](./mbedos/) +- [NRF](./nrf/) +- [NXP](./nxp/) +- [OpenIoTSDK](./openiotsdk/) +- [OpenThread](./openthread/) +- [Silabs](./silabs/) +- [STM32](./stm32/) +- [TI](./ti/) diff --git a/docs/platforms/infineon/index.md b/docs/platforms/infineon/index.md new file mode 100644 index 00000000000..7784db777f1 --- /dev/null +++ b/docs/platforms/infineon/index.md @@ -0,0 +1,12 @@ +# Infineon + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Provisioning](./infineon_psoc6_software_update.md) +[Software update](./infineon_psoc6_software_update.md) diff --git a/docs/guides/infineon_psoc6_software_update.md b/docs/platforms/infineon/infineon_psoc6_software_update.md similarity index 100% rename from docs/guides/infineon_psoc6_software_update.md rename to docs/platforms/infineon/infineon_psoc6_software_update.md diff --git a/docs/guides/infineon_trustm_provisioning.md b/docs/platforms/infineon/infineon_trustm_provisioning.md similarity index 100% rename from docs/guides/infineon_trustm_provisioning.md rename to docs/platforms/infineon/infineon_trustm_provisioning.md diff --git a/docs/guides/images/matter_mbedos_overview_simplified.png b/docs/platforms/mbedos/images/matter_mbedos_overview_simplified.png similarity index 100% rename from docs/guides/images/matter_mbedos_overview_simplified.png rename to docs/platforms/mbedos/images/matter_mbedos_overview_simplified.png diff --git a/docs/platforms/mbedos/index.md b/docs/platforms/mbedos/index.md new file mode 100644 index 00000000000..5c29ab774de --- /dev/null +++ b/docs/platforms/mbedos/index.md @@ -0,0 +1,13 @@ +# MbedOS + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Add new target](./mbedos_add_new_target.md) +[Commissioning](./mbedos_commissioning.md) +[Platform overview](./mbedos_platform_overview.md) diff --git a/docs/guides/mbedos_add_new_target.md b/docs/platforms/mbedos/mbedos_add_new_target.md similarity index 100% rename from docs/guides/mbedos_add_new_target.md rename to docs/platforms/mbedos/mbedos_add_new_target.md diff --git a/docs/guides/mbedos_commissioning.md b/docs/platforms/mbedos/mbedos_commissioning.md similarity index 96% rename from docs/guides/mbedos_commissioning.md rename to docs/platforms/mbedos/mbedos_commissioning.md index 8b6987878aa..1d6dc7243c0 100644 --- a/docs/guides/mbedos_commissioning.md +++ b/docs/platforms/mbedos/mbedos_commissioning.md @@ -58,7 +58,7 @@ To make provisioning possible and to control the Matter device from your Android based smartphone, you must first build and install the CHIPTool application. To build the CHIPTool application for your smartphone, read -[Android building guide](android_building.md). +[Android building guide](../android/android_building.md). After building, install the application by completing the following steps: @@ -154,7 +154,7 @@ brightness between 0-255. If **Lighting LED** is available then brightness change can be observed. > For more details about Android CHIPTool please visit -> [CHIPTool](../../examples/android/CHIPTool/README.md) +> [CHIPTool](../../../examples/android/CHIPTool/README.md) ## POSIX CLI CHIPTool @@ -164,7 +164,7 @@ To make provisioning possible and to control the Matter device from Linux-based device, you can build and run the Matter Client example application on it. To build the POSIX CLI CHIPTool application check the guide -[POSIX CLI guide](../../examples/chip-tool/README.md). +[POSIX CLI guide](../../../examples/chip-tool/README.md). ### Device commissioning for CLI @@ -196,7 +196,7 @@ For example: The client will send a single command packet and then exit. > For more details about POSIX CLI CHIPTool please visit -> [POSIX CLI CHIPTool](../../examples/chip-tool/README.md) +> [POSIX CLI CHIPTool](../../../examples/chip-tool/README.md) ## Python Device Controller @@ -206,7 +206,7 @@ To make provisioning possible and to control the Matter device with Python application, you can build and run the Python CHIP controller. To build and install the Python Device Controller application check the guide -[Python Device Controller guide](python_chip_controller_building.md). +[Python Device Controller guide](../../development_controllers/chip-repl/python_chip_controller_building.md). ### Device commissioning for Python Device Controller diff --git a/docs/guides/mbedos_platform_overview.md b/docs/platforms/mbedos/mbedos_platform_overview.md similarity index 95% rename from docs/guides/mbedos_platform_overview.md rename to docs/platforms/mbedos/mbedos_platform_overview.md index b70d5ed89cc..8cdce2c20c2 100644 --- a/docs/guides/mbedos_platform_overview.md +++ b/docs/platforms/mbedos/mbedos_platform_overview.md @@ -85,11 +85,11 @@ needed to perform communication through the Matter stack. Sample Matter applications are provided for the Mbed OS platform. They can be used to speed up development: -- [shell](../../examples/shell/mbed/README.md) -- [all-clusters-app](../../examples/all-clusters-app/mbed/README.md) -- [lock-app](../../examples/lock-app/mbed/README.md) -- [lighting-app](../../examples/lighting-app/mbed/README.md) -- [pigweed-app](../../examples/pigweed-app/mbed/README.md) +- [shell](../../../examples/shell/mbed/README.md) +- [all-clusters-app](../../../examples/all-clusters-app/mbed/README.md) +- [lock-app](../../../examples/lock-app/mbed/README.md) +- [lighting-app](../../../examples/lighting-app/mbed/README.md) +- [pigweed-app](../../../examples/pigweed-app/mbed/README.md) ### Example configuration diff --git a/docs/guides/images/CHIPTool_device_commissioned.png b/docs/platforms/nrf/images/CHIPTool_device_commissioned.png similarity index 100% rename from docs/guides/images/CHIPTool_device_commissioned.png rename to docs/platforms/nrf/images/CHIPTool_device_commissioned.png diff --git a/docs/guides/images/matter_nrfconnect_overview_simplified_ncs.svg b/docs/platforms/nrf/images/matter_nrfconnect_overview_simplified_ncs.svg similarity index 100% rename from docs/guides/images/matter_nrfconnect_overview_simplified_ncs.svg rename to docs/platforms/nrf/images/matter_nrfconnect_overview_simplified_ncs.svg diff --git a/docs/guides/images/nrfconnect_android_connectivity.png b/docs/platforms/nrf/images/nrfconnect_android_connectivity.png similarity index 100% rename from docs/guides/images/nrfconnect_android_connectivity.png rename to docs/platforms/nrf/images/nrfconnect_android_connectivity.png diff --git a/docs/platforms/nrf/index.md b/docs/platforms/nrf/index.md new file mode 100644 index 00000000000..bf74c43fcc9 --- /dev/null +++ b/docs/platforms/nrf/index.md @@ -0,0 +1,16 @@ +# NRF + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Android Commissioning](./nrfconnect_android_commissioning.md) +[Examples CLI](./nrfconnect_examples_cli.md) +[Examples configuration](./nrfconnect_examples_configuration.md) +[Examples Software update](./nrfconnect_examples_software_update.md) +[Factory data](./nrfconnect_factory_data_configuration.md) +[Platform overview](./nrfconnect_platform_overview.md) diff --git a/docs/guides/nrfconnect_android_commissioning.md b/docs/platforms/nrf/nrfconnect_android_commissioning.md similarity index 94% rename from docs/guides/nrfconnect_android_commissioning.md rename to docs/platforms/nrf/nrfconnect_android_commissioning.md index 0c93f457929..9c6358d501a 100644 --- a/docs/guides/nrfconnect_android_commissioning.md +++ b/docs/platforms/nrf/nrfconnect_android_commissioning.md @@ -1,7 +1,7 @@ # Commissioning nRF Connect Accessory using Android CHIPTool -You can use [CHIPTool](android_building.md) for Android smartphones to -commission a Nordic Semiconductor's development kit programmed with a Matter +You can use [CHIPTool](../android/android_building.md) for Android smartphones +to commission a Nordic Semiconductor's development kit programmed with a Matter example for the nRF Connect platform into a Matter fabric. This guide references the nRF52840 DK and Matter nRF Connect Lighting Example @@ -86,9 +86,10 @@ accessory using Android CHIPTool: > _Note:_ This step is only needed if you're testing a Thread device. Skip it if > the tested device operates in a Wi-Fi network. -Follow the [OpenThread Border Router](openthread_border_router_pi.md) article to -set up OpenThread Border Router on the Raspberry Pi, with either the nRF52840 DK -or the nRF52840 Dongle acting as the +Follow the +[OpenThread Border Router](../openthread/openthread_border_router_pi.md) article +to set up OpenThread Border Router on the Raspberry Pi, with either the nRF52840 +DK or the nRF52840 Dongle acting as the [OpenThread Radio Co-Processor](https://openthread.io/platforms/co-processor). During the setup, make sure that the Raspberry Pi is connected to your Wi-Fi Access Point. @@ -107,7 +108,7 @@ Application to learn how to build and program the example onto an nRF52840 DK. ## Building and installing Android CHIPTool To build the CHIPTool application for your smartphone, read the -[Building Android](android_building.md) guide. +[Building Android](../android/android_building.md) guide. After building, install the application by completing the following steps: diff --git a/docs/guides/nrfconnect_examples_cli.md b/docs/platforms/nrf/nrfconnect_examples_cli.md similarity index 100% rename from docs/guides/nrfconnect_examples_cli.md rename to docs/platforms/nrf/nrfconnect_examples_cli.md diff --git a/docs/guides/nrfconnect_examples_configuration.md b/docs/platforms/nrf/nrfconnect_examples_configuration.md similarity index 97% rename from docs/guides/nrfconnect_examples_configuration.md rename to docs/platforms/nrf/nrfconnect_examples_configuration.md index d2a135ebdf6..9116f6518cd 100644 --- a/docs/guides/nrfconnect_examples_configuration.md +++ b/docs/platforms/nrf/nrfconnect_examples_configuration.md @@ -194,13 +194,14 @@ intervals: - `CONFIG_CHIP_ICD_SLOW_POLL_INTERVAL` - `CONFIG_CHIP_ICD_FAST_POLLING_INTERVAL` -#### Commissioning with NFC support +#### Onboarding payload delivered over NFC -You can configure the Matter protocol to use an NFC tag for commissioning, -instead of using a QR code, which is the default configuration. +You can configure the Matter protocol to use an NFC tag for delivering the +onboarding payload, instead of using a QR code, which is the default +configuration. -To enable NFC for commissioning and share the onboarding payload in an NFC tag, -set the `CONFIG_CHIP_NFC_COMMISSIONING` option. +To enable sharing the onboarding payload in an NFC tag, set the +`CONFIG_CHIP_NFC_ONBOARDING_PAYLOAD` option. #### Factory reset behavior diff --git a/docs/guides/nrfconnect_examples_software_update.md b/docs/platforms/nrf/nrfconnect_examples_software_update.md similarity index 99% rename from docs/guides/nrfconnect_examples_software_update.md rename to docs/platforms/nrf/nrfconnect_examples_software_update.md index d295bae4766..5f3ab2055d7 100644 --- a/docs/guides/nrfconnect_examples_software_update.md +++ b/docs/platforms/nrf/nrfconnect_examples_software_update.md @@ -17,7 +17,7 @@ protocols: > **_NOTE:_** The procedure presented below requires that you have OpenThread > Border Router (OTBR) set up either in Docker or on a Raspberry Pi. Read -> [Setup OpenThread Border Router on Raspberry Pi](openthread_border_router_pi.md) +> [Setup OpenThread Border Router on Raspberry Pi](../openthread/openthread_border_router_pi.md) > to learn how to install the OTBR on a Raspberry Pi. The DFU over Matter involves two kinds of nodes: @@ -94,7 +94,6 @@ To test the DFU over Matter, you need to complete the following steps: 10. Initiate the DFU procedure in one of the following ways: - - If you have built the device firmware with `-DCONFIG_CHIP_LIB_SHELL=y` option, which enables Matter shell commands, run the following command on the device shell: diff --git a/docs/guides/nrfconnect_factory_data_configuration.md b/docs/platforms/nrf/nrfconnect_factory_data_configuration.md similarity index 99% rename from docs/guides/nrfconnect_factory_data_configuration.md rename to docs/platforms/nrf/nrfconnect_factory_data_configuration.md index 886acc9b304..0c3f6c1d47c 100644 --- a/docs/guides/nrfconnect_factory_data_configuration.md +++ b/docs/platforms/nrf/nrfconnect_factory_data_configuration.md @@ -813,8 +813,8 @@ Alternatively, you can add the relevant Kconfig option lines to the example's You can edit all configuration options using the interactive Kconfig interface. See the -[Configuring nRF Connect examples](../guides/nrfconnect_examples_configuration.md) -page for information about how to configure Kconfig options. +[Configuring nRF Connect examples](./nrfconnect_examples_configuration.md) page +for information about how to configure Kconfig options. In the configuration window, expand the items `Modules -> connectedhomeip (/home/arbl/matter/connectedhomeip/config/nrfconnect/chip-module) -> Connected Home over IP protocol stack`. diff --git a/docs/guides/nrfconnect_platform_overview.md b/docs/platforms/nrf/nrfconnect_platform_overview.md similarity index 100% rename from docs/guides/nrfconnect_platform_overview.md rename to docs/platforms/nrf/nrfconnect_platform_overview.md diff --git a/docs/platforms/nxp/index.md b/docs/platforms/nxp/index.md new file mode 100644 index 00000000000..844dc40194c --- /dev/null +++ b/docs/platforms/nxp/index.md @@ -0,0 +1,15 @@ +# NXP + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +- [NXP - Android Commissioning](./nxp_k32w_android_commissioning.md) +- [NXP - Linux Examples](./nxp_imx8m_linux_examples.md) +- [NXP - Manufacturing Data](./nxp_manufacturing_flow.md) +- [NXP - RTs OTA Software Update Guide](./nxp_RTs_ota_software_update.md) +- [NXP - Zephyr OTA Software Update Guide](./nxp_zephyr_ota_software_update.md diff --git a/docs/platforms/nxp/nxp_RTs_ota_software_update.md b/docs/platforms/nxp/nxp_RTs_ota_software_update.md new file mode 100644 index 00000000000..696f5078c19 --- /dev/null +++ b/docs/platforms/nxp/nxp_RTs_ota_software_update.md @@ -0,0 +1,341 @@ +# Matter Over-The-Air Software Update with NXP RTs example applications + +## Overview + +This document describes OTA feature on NXP devices: + +- RW61x +- RT1060_EVK-C +- RT1170_EVK-B + +The OTA Requestor feature enables the device to be informed of, download and +apply a software update from an OTA Provider. + +This section explains how to perform an OTA Software Update with NXP RTs example +applications. Throughout this guide, the all-clusters application is used as an +example. + +In general, the Over-The-Air Software Update process consists of the following +steps : + +- The OTA Requestor queries an update image from the OTA Provider which + responds according to its availability. +- The update image is received in blocks and stored in the external flash of + the device. +- Once the update image is fully downloaded, the bootloader is notified and + the device resets applying the update in test-mode. +- If the test is successful, the update is applied permanently. Otherwise, the + bootloader reverts back to the primary application, preventing any + downgrade. + +### Flash Memory Layout + +The RTs Flash is divided into different regions as follow : + +- Bootloader : MCUBoot resides at the base of the flash. +- Primary application partition : The example application which would be run + by the bootloader (active application). The size reserved for this partition + is 4.4 MB. +- Secondary application partition : Update image received with the OTA + (candidate application). The size reserved for the partition is 4.4 MB. + +Notes : + +- For RW61x: The CPU1/CPU2 firmware are embedded in the CPU3 example + application. +- The sizes of the primary and secondary applications are provided as an + example (currently 4.4 MB is reserved for each partition). The size can be + changed by modifying the `m_app_max_sectors` value in the linker script of + the application . + +### MCUBoot Bootloader + +MCUBoot is an open-source secure bootloader used by RW61x to apply the +self-upgrade. For more details, please refer to the +[MCUBoot documentation](https://github.com/mcu-tools/mcuboot/blob/main/docs/design.md). + +For RTs platform, the bootloader is configured to use the flash remapping +mechanism by default, in order to perform the image upgrade. This is achieved by +using the `MCUBoot DIRECT-XIP` upgrade mode. + +## OTA Software Update process for RTs example application + +### Flashing the bootloader + +In order for the device to perform the software update, the MCUBoot bootloader +must be flashed first at the base of the flash. A step-by-step guide is given +below. + +- It is recommended to start with erasing the external flash of the device, + for this JLink from Segger can be used. It can be downloaded and installed + from https://www.segger.com/products/debug-probes/j-link. Once installed, + JLink can be run using the command line : + +``` +$ JLink +``` + +Run the following commands : + +Connect J-Link debugger to device: + +```sh +J-Link > connect +Device> ? # you will be presented with a dialog -> select `RW612` for RW61x, `MIMXRT1062XXX6B` for RT1060, `MIMXRT1176xxxA_M7` for RT1170 +Please specify target interface: +J) JTAG (Default) +S) SWD +T) cJTAG +TIF> S +Specify target interface speed [kHz]. : 4000 kHz +Speed> # +``` + +Erase flash: + +``` +J-Link > exec EnableEraseAllFlashBanks +``` + +For RW61x + +``` +J-Link > erase 0x8000000, 0x88a0000 +``` + +For RT1060-EVK-C + +``` +J-Link > erase 0x60000000, 0x61000000 +``` + +For RT1170-EVK-B + +``` +J-Link > erase 0x30000000, 0x34000000 +``` + +- MCUBoot application can be built with SDK installed, using instructions + below. +- Retrieve the mcuboot directory located at + _'/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples/`RTboard`1/ota_examples/`mcuboot_opensource/armgcc`'_ + +_1 `rdrw612bga` or `frdmrw612` for RW61x, +`evkcmimxrt1060` for RT1060-EVK-C, `evkbmimxrt1170` for RT1170-EVK-B_ + +``` +user@ubuntu: cd ~/Desktop/connectedhomeip/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/armgcc +``` + +- Build the mcuboot application with running + `build_script`2 + +``` +user@ubuntu: chmod +x +user@ubuntu: export ARMGCC_DIR=/opt/gcc-arm-none-eabi-10.3-2021.10 # with ARMGCC_DIR referencing the compiler path +user@ubuntu: ./ +``` + +_2 `build_flash_release.sh` for RW61x, +`build_flexspi_nor_release.sh` for RT1060 and RT1170_ + +- Program the generated binary to the target board. + +``` +J-Link > loadbin /mcuboot_opensource.elf +``` + +- If it runs successfully, the following logs will be displayed on the + terminal : + +``` +hello sbl. +Disabling flash remapping function +Bootloader Version 2.0.0 +Image 0 Primary slot: Image not found +Image 0 Secondary slot: Image not found +No slot to load for image 0 +Unable to find bootable image +``` + +Note : By default, mcuboot application considers the primary and secondary +partitions to be the size of 4.4 MB. If the size is to be changed, the partition +addresses should be modified in the `flash_partitioning.h` accordingly. For more +information about the flash partitioning with mcuboot, please refer to the +dedicated `readme.txt` located in + +> _/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples/`RTboard`1/ota_examples/`mcuboot_opensource`/._ + +### Generating and flashing the signed application image + +After flashing the bootloader, the application can be programmed to the board. +The image must have the following format : + +- Header : contains general information about the image (version, size, + magic...) +- Code of the application : generated binary +- Trailer : contains metadata needed by the bootloader such as the image + signature, the upgrade type, the swap status... + +The all-clusters application can be generated using the instructions from the + +README.md3'Building' section. The +application is automatically linked to be executed from the primary image +partition, taking into consideration the offset imposed by mcuboot. + +_3 +[RW61x README.md 'Building'](../../../examples/all-clusters-app/nxp/rt/rw61x/README.md#building), +[RT1060 README.md 'Building'](../../../examples/all-clusters-app/nxp/rt/rt1060/README.md#building), +[RT1170 README.md 'Building'](../../../examples/all-clusters-app/nxp/rt/rt1170/README.md#building)_ + +The resulting executable file found in +out/release/chip-`board`4-all-cluster-example +needs to be converted into raw binary format as shown below. + +_4 `rw61x` for RW61x, `rt1060` for +RT1060-EVK-C, `rt1170` for RT1170-EVK-B_ + +```sh +arm-none-eabi-objcopy -R .flash_config -R .NVM -O binary chip-<"board">-all-cluster-example chip-<"board">-all-cluster-example.bin +``` + +To sign the image and wrap the raw binary of the application with the header and +trailer, "`imgtool`" is provided in the SDK and can be found in +"`/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/middleware/mcuboot_opensource/scripts/`". + +The following commands can be run (make sure to replace the /path/to/file/binary +with the adequate files): + +```sh +user@ubuntu: cd ~/Desktop//third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/middleware/mcuboot_opensource/scripts/ + +user@ubuntu: python3 imgtool.py sign --key ~/Desktop//third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/keys/sign-rsa2048-priv.pem --align 4 --header-size 0x1000 --pad-header --pad --confirm --slot-size 0x440000 --max-sectors 1088 --version "1.0" ~/Desktop/connectedhomeip/examples/all-clusters-app/nxp/rt/<"rt_board">/out/debug/chip-<"rt_board">-all-cluster-example.bin ~/Desktop/connectedhomeip/examples/all-clusters-app/nxp/rt/<"rt_board">/out/debug/chip-<"rt_board">-all-cluster-example_SIGNED.bin +``` + +Notes : + +- The arguments `slot-size` and `max-sectors` are aligned with the size of the + partitions reserved for the primary and the secondary applications. (By + default the size considered is 4.4 MB for each application). If the size of + these partitions are modified, the `slot-size` and `max-sectors` should be + adjusted accordingly. +- In this example, the image is signed with the private key provided by the + SDK as an example + (`/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/keys/sign-rsa2048-priv.pem`), + MCUBoot is built with its corresponding public key which would be used to + verify the integrity of the image. It is possible to generate a new pair of + keys using the following commands. This procedure should be done prior to + building the mcuboot application. + +- To generate the private key : + +``` +user@ubuntu: python3 imgtool.py keygen -k priv_key.pem -t rsa-2048 +``` + +- To extract the public key : + +``` +user@ubuntu: python3 imgtool.py getpub -k priv_key.pem +``` + +- The extracted public key can then be copied to the + `/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/examples//ota_examples/mcuboot_opensource/keys/sign-rsa2048-pub.c`, + given as a value to the rsa_pub_key[] array. + +The resulting output is the signed binary of the application version "1.0". + +JLink can be used to flash the application using the command : + +For RW61x + +``` +J-Link > loadbin chip-rw61x-all-cluster-example_SIGNED.bin 0x8020000 +``` + +For RT1060-EVK-C + +``` +J-Link > loadbin chip-rt1060-all-cluster-example_SIGNED.bin 0x60040000 +``` + +For RT1170-EVK-B + +``` +J-Link > loadbin chip-rt1170-all-cluster-example_SIGNED.bin 0x30040000 +``` + +The bootloader should then be able to jump directly to the start of the +application and run it. + +### Generating the OTA Update Image + +To generate the OTA update image the same procedure can be followed from the +[Generating and flashing the signed application image](#generating-and-flashing-the-signed-application-image) +sub-section, replacing the "--version "1.0"" argument with "--version "2.0"" +(recent version of the update), without arguments "--pad" "--confirm" when +running `imgtool` script during OTA Update Image generation. + +Note : When building the update image, the build arguments +nxp_software_version=2 nxp_software_version_string=\"2.0\" can be added to the +gn gen command in order to specify the upgraded version. + +When the signed binary of the update is generated, the file should be converted +into OTA format. To do so, the ota_image_tool is provided in the repo and can be +used to convert a binary file into an .ota file. + +```sh +user@ubuntu:~/connectedhomeip$ : ./src/app/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 2 -vs "2.0" -da sha256 chip-<"rt_board">-all-cluster-example_SIGNED.bin chip-rw61x-all-cluster-example.ota +``` + +The generated OTA file can be used to perform the OTA Software Update. The +instructions below describe the procedure step-by-step. + +### Performing the OTA Software Update + +Setup example : + +- [Chip-tool](../../../examples/chip-tool/README.md) application running on + the RPi. +- OTA Provider application built on the same RPi (as explained below). +- RT board programmed with the example application (with the instructions + above). + +Before starting the OTA process, the Linux OTA Provider application can be built +on the RPi (if not already present in the pre-installed apps) : + +``` +user@ubuntu:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota-provider-app chip_config_network_layer_ble=false +user@ubuntu:~/connectedhomeip$ : rm -rf /tmp/chip_* +``` + +```sh +user@ubuntu:~/connectedhomeip$ : ./out/ota-provider-app/chip-ota-provider-app -f chip-<"rt_board">-all-cluster-example.ota +``` + +The OTA Provider should first be provisioned with chip-tool by assigning it the +node id 1, and then granted the ACL entries : + +``` +user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing onnetwork 1 20202021 +user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0 +``` + +The second step is to provision the device with the node id 2 using ble-wifi or +ble-thread commissioning. For example : + +``` +user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing ble-wifi 2 WIFI_SSID WIFI_PASSWORD 20202021 3840 +``` + +Once commissioned, the OTA process can be initiated with the +"announce-ota-provider" command using chip-tool (the given numbers refer +respectively to [ProviderNodeId][vendorid] [AnnouncementReason][endpoint] +[node-id][endpoint-id]) : + +``` +user@ubuntu:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool otasoftwareupdaterequestor announce-otaprovider 1 0 0 0 2 0 +``` + +When the full update image is downloaded and stored, the bootloader will be +notified and the device will reboot with the update image. diff --git a/docs/guides/nxp/nxp_imx8m_linux_examples.md b/docs/platforms/nxp/nxp_imx8m_linux_examples.md similarity index 100% rename from docs/guides/nxp/nxp_imx8m_linux_examples.md rename to docs/platforms/nxp/nxp_imx8m_linux_examples.md diff --git a/docs/guides/nxp/nxp_k32w0_ota_guide.md b/docs/platforms/nxp/nxp_k32w0_ota_guide.md similarity index 100% rename from docs/guides/nxp/nxp_k32w0_ota_guide.md rename to docs/platforms/nxp/nxp_k32w0_ota_guide.md diff --git a/docs/guides/nxp/nxp_k32w_android_commissioning.md b/docs/platforms/nxp/nxp_k32w_android_commissioning.md similarity index 100% rename from docs/guides/nxp/nxp_k32w_android_commissioning.md rename to docs/platforms/nxp/nxp_k32w_android_commissioning.md diff --git a/docs/guides/nxp/nxp_manufacturing_flow.md b/docs/platforms/nxp/nxp_manufacturing_flow.md similarity index 80% rename from docs/guides/nxp/nxp_manufacturing_flow.md rename to docs/platforms/nxp/nxp_manufacturing_flow.md index 08e09c86638..0f30d0612b1 100644 --- a/docs/guides/nxp/nxp_manufacturing_flow.md +++ b/docs/platforms/nxp/nxp_manufacturing_flow.md @@ -103,8 +103,6 @@ Here is the interpretation of the **required** parameters: --hw_version -> Hardware Version as number --hw_version_str -> Hardware Version as string --cert_declaration -> path to the Certification Declaration (der format) location ---dac_cert -> path to the DAC (der format) location ---dac_key -> path to the DAC key (der format) location --pai_cert -> path to the PAI (der format) location --spake2p_path -> path to the spake2p tool --out -> name of the binary that will be used for storing all the generated data @@ -113,6 +111,11 @@ Here is the interpretation of the **required** parameters: Here is the interpretation of the **optional** parameters: ```shell +--dac_cert -> path to the DAC certificate (der format) location +--dac_key -> path to the DAC key (der format) location +--EL2GO_bin -> path to the EdgeLock 2Go binary (bin format) location +--EL2GO_DAC_KEY_ID -> DAC key ID configured into EdgeLock 2Go as hex value +--EL2GO_DAC_CERT_ID -> DAC certificate ID configured into EdgeLock 2Go as hex value --dac_key_password -> Password to decode DAC key --dac_key_use_sss_blob -> Used when --dac_key contains a path to an encrypted blob, instead of the actual DAC private key. The blob metadata size is 24, so the total length @@ -148,7 +151,7 @@ Here is the interpretation of the **optional** parameters: ## 4. Build app and usage -Use `chip_with_factory_data=1` when compiling to enable factory data usage. +Use `nxp_use_factory_data=true` when compiling to enable factory data usage. Run chip-tool with a new PAA: @@ -177,22 +180,61 @@ Implementation of manufacturing data provisioning has been validated using test certificates generated by `OpenSSL 1.1.1l`. Also, demo **DAC**, **PAI** and **PAA** certificates needed in case -`chip_with_factory_data=1` is used can be found in +`nxp_use_factory_data=true` is used can be found in `./scripts/tools/nxp/demo_generated_certs`. ## 6. Increased security for DAC private key -### 6.1 SSS-based platforms +### 6.1 SSS-based with EdgeLock2go support + +EdgeLock2go services could be used to securely provisioned DAC key/cert during +manufacturing. + +Prior to the generation of the factory data binary. `EL2GO` data needs to be +generated following `EL2GO` process. + +For the factory data generation following option need to be added: + +`--EL2GO_bin ~/secure_objects.bin` containing `EL2GO` information including +encrypted DAC private key and certificate. `--EL2GO_DAC_KEY_ID 1234` containing +corresponding to the ID of the DAC key chosen during `EL2GO` key generation. +`--EL2GO_DAC_CERT_ID 4321` containing corresponding to the ID of the DAC +certification chosen during `EL2GO` key generation. + +Reference factory data generation command: + +```shell +python3 ./scripts/tools/nxp/factory_data_generator/generate.py -i 10000 -s UXKLzwHdN3DZZLBaL2iVGhQi/OoQwIwJRQV4rpEalbA= -p ${passcode} -d ${discriminator} --vid "0x$VID" --pid "0x$PID" --vendor_name "NXP Semiconductors" --product_name "Thermostat" --serial_num "12345678" --date "$DATE" --hw_version 1 --hw_version_str "1.0" --cert_declaration $FACTORY_DATA_DEST/Chip-Test-CD-$VID-$PID.der --EL2GO_bin ~/secure_objects.bin --EL2GO_DAC_KEY_ID 1234 --EL2GO_DAC_CERT_ID 4321 --pai_cert $FACTORY_DATA_DEST/Chip-PAI-NXP-$VID-$PID-Cert.der --spake2p_path ./out/spake2p --unique_id "00112233445566778899aabbccddeeff" --out $FACTORY_DATA_DEST/factory_data.bin +``` + +Supported platforms: + +- `rw61x` + +In addition to the GN flag `nxp_use_factory_data=true`, a Matter application +needs to be built with `nxp_enable_secure_EL2GO_factory_data=true` to allow +loading of EdgeLock2go data to the secure element. + +In this mode EdgeLock2go keys will always remain encrypted and only usable by +the `SSS`. In this case, all operations that requires DAC private access will be +transferred to the `SSS`. + +### 6.2 SSS-based without EdgeLock2go support for DAC private key secure storage Supported platforms: - `k32w1` - `mcxw71` +- `rw61x` For platforms that have a secure subsystem (`SSS`), the DAC private key can be converted to an encrypted blob. This blob will overwrite the DAC private key in -factory data and will be imported in the `SSS` at initialization, by the factory -data provider instance. +factory data and will be imported in the `SSS` by the factory data provider +instance. + +In this architecture, outside of the manufacturing flow, the DAC private will +always remain usable only by the `SSS`. In this case, all operations that +requires DAC private access will be transferred to the `SSS`. The application will check at initialization whether the DAC private key has been converted or not and convert it if needed. However, the conversion process @@ -207,7 +249,7 @@ python3 ./scripts/tools/nxp/factory_data_generator/generate.py -i 10000 -s UXKLz There is no need for an extra binary. - Write factory data binary. -- Build the application with `chip_with_factory_data=1` set. +- Build the application with `nxp_use_factory_data=true` set. - Write the application to the board and use it as usual. Factory data should now contain a corresponding encrypted blob instead of the @@ -226,64 +268,5 @@ Please note that `--dac_key` now points to a binary file that contains the encrypted blob. The user can use the DAC private in plain text instead of using the `SSS` by -adding the following gn argument `chip_use_plain_dac_key=true`. - -### 6.2 RW61X - -Supported platforms: - -- RW61X - -there are three implementations for factory data protection - -- whole factory data protection with AES encryption ( chip_with_factory_data=1 - chip_enable_secure_whole_factory_data=true ) - `examples/platform/nxp/rt/rw61x/factory_data/source/AppFactoryDataExample.cpp`\ - `src/platform/nxp/rt/rw61x/FactoryDataProviderEncImpl.cpp` - -- only dac private key protection ( chip_with_factory_data=1 - chip_enable_secure_dac_private_key_storage=true ) - `examples/platform/nxp/rt/rw61x/factory_data/source/AppFactoryDataExample.cpp` - \ - `src/platform/nxp/rt/rw61x/FactoryDataProviderImpl.cpp` - -- whole factory data protection with hard-coded AES key ( - chip_with_factory_data=1 ) - `examples/platform/nxp/common/factory_data/source/AppFactoryDataDefaultImpl.cpp` - \ - `src/platform/nxp/common/factory_data/FactoryDataProviderFwkImpl.cpp` - -for the first one, the whole factory data is encrypted by an AES-256 key, the -AES key can be passed through serial link when in factory production mode, and -will be provisioned into Edge Lock, and the returned AES Key blob (wrapped key) -can be stored in the end of factory data region in TLV format. for the -decryption process, the blob is retrieved and provisioned into Edge Lock and the -whole factory data can be decrypted using the returned key index in Edge Lock. -Compared with only dac private key protection solution, this solution can avoid -tampering with the original factory data. - -the factory data should be encrypted by an AES-256 key using "--aes256_key" -option in "generate.py" script file. - -it will check whether there is AES key blob in factory data region when in each -initialization, if not, the default AES key is converted and the result is -stored into flash, it run only once. - -for the second one, it only protect the dac private key inside the factory data, -the dac private key is retrieved and provisioned into Edge Lock, the returned -key blob replace the previous dac private key, and also update the overall size -and hash, and re-write the factory data. when device is doing matter -commissioning, the blob is retrieved and provisioned into Edge Lock and the -signing can be done using the returned key index in Edge Lock. - -the factory data should be plain text for the first programming. it will check -whether there is dac private key blob (base on the size of blob, should be 48) -in factory data when in each initialization, if not, the dac private key is -converted and the result is stored into flash, it run only once. - -for the third one, it is a little similar to the first one, the whole factory -data is encrypted by an AES key, but there are two differences: - -- the AES key is hard-coded and not provisioned into Edge Lock -- the factory data should be encrypted by AES-128 key using "--aes128_key" - option in "generate.py" script file. +adding the following gn argument `chip_use_plain_dac_key=true` (not supported on +rw61x). diff --git a/docs/guides/nxp/nxp_mcxw71_ota_guide.md b/docs/platforms/nxp/nxp_mcxw71_ota_guide.md similarity index 98% rename from docs/guides/nxp/nxp_mcxw71_ota_guide.md rename to docs/platforms/nxp/nxp_mcxw71_ota_guide.md index b21bf933d7e..c8d97b7ade4 100644 --- a/docs/guides/nxp/nxp_mcxw71_ota_guide.md +++ b/docs/platforms/nxp/nxp_mcxw71_ota_guide.md @@ -61,7 +61,7 @@ version. A user can update the factory data through OTA, at the same time the application firmware is updated by enabling the following processor in the `gn args`: -- `chip_enable_ota_factory_data_processor=1` to enable default factory data +- `nxp_enable_ota_factory_data_processor=true` to enable default factory data update processor (disabled by default). The OTA image used must be updated to include the new factory data. diff --git a/docs/guides/nxp/nxp_otbr_guide.md b/docs/platforms/nxp/nxp_otbr_guide.md similarity index 100% rename from docs/guides/nxp/nxp_otbr_guide.md rename to docs/platforms/nxp/nxp_otbr_guide.md diff --git a/docs/guides/nxp/nxp_zephyr_ota_software_update.md b/docs/platforms/nxp/nxp_zephyr_ota_software_update.md similarity index 100% rename from docs/guides/nxp/nxp_zephyr_ota_software_update.md rename to docs/platforms/nxp/nxp_zephyr_ota_software_update.md diff --git a/docs/platforms/openiotsdk/index.md b/docs/platforms/openiotsdk/index.md new file mode 100644 index 00000000000..8bd73c46e19 --- /dev/null +++ b/docs/platforms/openiotsdk/index.md @@ -0,0 +1,15 @@ +# OpenIoTSDK + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Commissioning](./openiotsdk_commissioning.md) +[Examples software update](./openiotsdk_examples_software_update.md) +[Examples](./openiotsdk_examples.md) +[Platform overview](./openiotsdk_platform_overview.md) +[Unit tests](./openiotsdk_unit_tests.md) diff --git a/docs/guides/openiotsdk_commissioning.md b/docs/platforms/openiotsdk/openiotsdk_commissioning.md similarity index 90% rename from docs/guides/openiotsdk_commissioning.md rename to docs/platforms/openiotsdk/openiotsdk_commissioning.md index 520cff033d6..969b304228b 100644 --- a/docs/guides/openiotsdk_commissioning.md +++ b/docs/platforms/openiotsdk/openiotsdk_commissioning.md @@ -9,11 +9,11 @@ connected to the IP network and do not require credentials provisioning. ## Building Matter controller -The [Matter controller](../../src/controller/README.md) is a client application -that allows commission and control of the Matter node. +The [Matter controller](../../../src/controller/README.md) is a client +application that allows commission and control of the Matter node. -The [POSIX CLI chip-tool](../../examples/chip-tool/README.md) is the recommended -Matter controller to use with Open IoT SDK devices. +The [POSIX CLI chip-tool](../../../examples/chip-tool/README.md) is the +recommended Matter controller to use with Open IoT SDK devices. To build `chip-tool` execute command: diff --git a/docs/guides/openiotsdk_examples.md b/docs/platforms/openiotsdk/openiotsdk_examples.md similarity index 98% rename from docs/guides/openiotsdk_examples.md rename to docs/platforms/openiotsdk/openiotsdk_examples.md index b80ce6304f9..c91863a1b76 100644 --- a/docs/guides/openiotsdk_examples.md +++ b/docs/platforms/openiotsdk/openiotsdk_examples.md @@ -22,7 +22,7 @@ You can use these examples as a reference for creating your own applications. The VSCode devcontainer has all the dependencies pre-installed. It is the recommended way to build, run and develop with the Open IoT SDK port of the Matter Project. Please read this -[VSCode development guide](../VSCODE_DEVELOPMENT.md) for more information. +[VSCode development guide](../../VSCODE_DEVELOPMENT.md) for more information. Before building the examples, check out the Matter repository and sync Open IoT SDK submodules using the following command: @@ -347,11 +347,11 @@ provides the `-K,--kvsfile` option to use the persistence options listed above. Open IoT SDK port supports two crypto backend implementations: -- [Mbed TLS](../guides/openiotsdk_platform_overview.md#mbed-tls) - it's the - default option +- [Mbed TLS](./openiotsdk_platform_overview.md#mbed-tls) - it's the default + option - [PSA crypto service](https://tf-m-user-guide.trustedfirmware.org/integration_guide/services/tfm_crypto_integration_guide.html) from the - [TrustedFirmware-M (TF-M)](../guides/openiotsdk_platform_overview.md#trusted-firmware-m) + [TrustedFirmware-M (TF-M)](./openiotsdk_platform_overview.md#trusted-firmware-m) component The CMake variable `CONFIG_CHIP_CRYPTO` controls how cryptographic operations diff --git a/docs/guides/openiotsdk_examples_software_update.md b/docs/platforms/openiotsdk/openiotsdk_examples_software_update.md similarity index 95% rename from docs/guides/openiotsdk_examples_software_update.md rename to docs/platforms/openiotsdk/openiotsdk_examples_software_update.md index 73129b84e50..686d95b8b7a 100644 --- a/docs/guides/openiotsdk_examples_software_update.md +++ b/docs/platforms/openiotsdk/openiotsdk_examples_software_update.md @@ -19,12 +19,12 @@ The last required element is a Matter controller. This application controls both nodes and manages the entire software update process. In the procedure described below, the `OTA Provider` will be a -[Linux application](../../examples/ota-provider-app/linux/README.md) and the +[Linux application](../../../examples/ota-provider-app/linux/README.md) and the Open IoT SDK example with [DFU support](./openiotsdk_examples.md#device-firmware-update) will work as the -OTA Requestor. The [chip-tool](../../examples/chip-tool/README.md) application -used as the Matter controller. Each application should be launched in a separate -terminal. +OTA Requestor. The [chip-tool](../../../examples/chip-tool/README.md) +application used as the Matter controller. Each application should be launched +in a separate terminal. List of `OIS` examples that currently support the `DFU` over Matter: @@ -41,7 +41,7 @@ List of `OIS` examples that currently support the `DFU` over Matter: ``` More details about the `OTA provider` application can be found - [here](../../examples/ota-provider-app/linux/README.md). + [here](../../../examples/ota-provider-app/linux/README.md). 3. Build `chip-tool`: @@ -50,7 +50,7 @@ List of `OIS` examples that currently support the `DFU` over Matter: ``` More details about the `chip-tool` application can be found - [here](../../examples/chip-tool/README.md). + [here](../../../examples/chip-tool/README.md). 4. Build `OIS` example application diff --git a/docs/guides/openiotsdk_platform_overview.md b/docs/platforms/openiotsdk/openiotsdk_platform_overview.md similarity index 100% rename from docs/guides/openiotsdk_platform_overview.md rename to docs/platforms/openiotsdk/openiotsdk_platform_overview.md diff --git a/docs/guides/openiotsdk_unit_tests.md b/docs/platforms/openiotsdk/openiotsdk_unit_tests.md similarity index 100% rename from docs/guides/openiotsdk_unit_tests.md rename to docs/platforms/openiotsdk/openiotsdk_unit_tests.md diff --git a/docs/platforms/openthread/index.md b/docs/platforms/openthread/index.md new file mode 100644 index 00000000000..a4926817e2f --- /dev/null +++ b/docs/platforms/openthread/index.md @@ -0,0 +1,12 @@ +# OpenThread + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Border Router](./openthread_border_router_pi.md) +[NRF dongle](./openthread_rcp_nrf_dongle.md) diff --git a/docs/guides/openthread_border_router_pi.md b/docs/platforms/openthread/openthread_border_router_pi.md similarity index 100% rename from docs/guides/openthread_border_router_pi.md rename to docs/platforms/openthread/openthread_border_router_pi.md diff --git a/docs/guides/openthread_rcp_nrf_dongle.md b/docs/platforms/openthread/openthread_rcp_nrf_dongle.md similarity index 100% rename from docs/guides/openthread_rcp_nrf_dongle.md rename to docs/platforms/openthread/openthread_rcp_nrf_dongle.md diff --git a/docs/guides/images/silabs_logo.png b/docs/platforms/silabs/images/silabs_logo.png similarity index 100% rename from docs/guides/images/silabs_logo.png rename to docs/platforms/silabs/images/silabs_logo.png diff --git a/docs/platforms/silabs/index.md b/docs/platforms/silabs/index.md new file mode 100644 index 00000000000..3e743df0cbb --- /dev/null +++ b/docs/platforms/silabs/index.md @@ -0,0 +1,14 @@ +# Silabs + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[CLI guide](./silabs_cli_guide.md) +[Common app behavior](./silabs_common_app_behavior.md) +[EFR32 software update](./silabs_efr32_software_update.md) +[Getting Started](./silabs_getting_started.md) diff --git a/docs/guides/silabs_cli_guide.md b/docs/platforms/silabs/silabs_cli_guide.md similarity index 100% rename from docs/guides/silabs_cli_guide.md rename to docs/platforms/silabs/silabs_cli_guide.md diff --git a/docs/guides/silabs_common_app_behavior.md b/docs/platforms/silabs/silabs_common_app_behavior.md similarity index 100% rename from docs/guides/silabs_common_app_behavior.md rename to docs/platforms/silabs/silabs_common_app_behavior.md diff --git a/docs/guides/silabs_efr32_software_update.md b/docs/platforms/silabs/silabs_efr32_software_update.md similarity index 98% rename from docs/guides/silabs_efr32_software_update.md rename to docs/platforms/silabs/silabs_efr32_software_update.md index 9f94753aa7d..6bdce3d40d2 100644 --- a/docs/guides/silabs_efr32_software_update.md +++ b/docs/platforms/silabs/silabs_efr32_software_update.md @@ -118,7 +118,7 @@ to 2). Starting the ota-provider-app with the --otaImageList command line option allows the user to supply a JSON file specifying the Software Version, Vendor and Product ID that identify the image served by the Provider, see -[ota-provider-app](../../examples/ota-provider-app/linux/README.md) +[ota-provider-app](../../../examples/ota-provider-app/linux/README.md) Example provider configuration file: diff --git a/docs/guides/silabs_getting_started.md b/docs/platforms/silabs/silabs_getting_started.md similarity index 100% rename from docs/guides/silabs_getting_started.md rename to docs/platforms/silabs/silabs_getting_started.md diff --git a/docs/platforms/stm32/index.md b/docs/platforms/stm32/index.md new file mode 100644 index 00000000000..dbe427e82eb --- /dev/null +++ b/docs/platforms/stm32/index.md @@ -0,0 +1,11 @@ +# STM32 + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +``` + +[Getting Started Guide](./stm32_getting_started_guide.md) diff --git a/docs/guides/stm32_getting_started_guide.md b/docs/platforms/stm32/stm32_getting_started_guide.md similarity index 98% rename from docs/guides/stm32_getting_started_guide.md rename to docs/platforms/stm32/stm32_getting_started_guide.md index 55f856cbc0e..954dde35c00 100644 --- a/docs/guides/stm32_getting_started_guide.md +++ b/docs/platforms/stm32/stm32_getting_started_guide.md @@ -28,7 +28,7 @@ subfolder. ## Building the Example Application -- [Set Up Matter Environment](./BUILDING.md) +- [Set Up Matter Environment](../../guides/BUILDING.md) - Set up STLINK tools diff --git a/docs/guides/images/matter_ti_overview_simplified.png b/docs/platforms/ti/images/matter_ti_overview_simplified.png similarity index 100% rename from docs/guides/images/matter_ti_overview_simplified.png rename to docs/platforms/ti/images/matter_ti_overview_simplified.png diff --git a/docs/guides/images/matter_ti_overview_wifi.png b/docs/platforms/ti/images/matter_ti_overview_wifi.png similarity index 100% rename from docs/guides/images/matter_ti_overview_wifi.png rename to docs/platforms/ti/images/matter_ti_overview_wifi.png diff --git a/docs/platforms/ti/index.md b/docs/platforms/ti/index.md new file mode 100644 index 00000000000..aa49ab94d1c --- /dev/null +++ b/docs/platforms/ti/index.md @@ -0,0 +1,17 @@ +# TI + +```{toctree} +:glob: +:maxdepth: 1 +:hidden: + +* +matter-migration-guide/* +matter-syscfg/* +matter-users-guide/* +``` + +- [Overview](./ti_matter_overview.md) +- [Matter migration guide](./matter-migration-guide/) +- [Syscfg](./matter-syscfg/) +- [User guide](./matter-users-guide/) diff --git a/docs/guides/ti/matter-migration-guide/matter_cc2674_migration.md b/docs/platforms/ti/matter-migration-guide/matter_cc2674_migration.md similarity index 100% rename from docs/guides/ti/matter-migration-guide/matter_cc2674_migration.md rename to docs/platforms/ti/matter-migration-guide/matter_cc2674_migration.md diff --git a/docs/guides/ti/matter-syscfg/getting-started.md b/docs/platforms/ti/matter-syscfg/getting-started.md similarity index 100% rename from docs/guides/ti/matter-syscfg/getting-started.md rename to docs/platforms/ti/matter-syscfg/getting-started.md diff --git a/docs/guides/ti/matter-syscfg/images/board_view.png b/docs/platforms/ti/matter-syscfg/images/board_view.png similarity index 100% rename from docs/guides/ti/matter-syscfg/images/board_view.png rename to docs/platforms/ti/matter-syscfg/images/board_view.png diff --git a/docs/guides/ti/matter-syscfg/images/generated_files_ble.png b/docs/platforms/ti/matter-syscfg/images/generated_files_ble.png similarity index 100% rename from docs/guides/ti/matter-syscfg/images/generated_files_ble.png rename to docs/platforms/ti/matter-syscfg/images/generated_files_ble.png diff --git a/docs/guides/ti/matter-syscfg/images/hardware_view.png b/docs/platforms/ti/matter-syscfg/images/hardware_view.png similarity index 100% rename from docs/guides/ti/matter-syscfg/images/hardware_view.png rename to docs/platforms/ti/matter-syscfg/images/hardware_view.png diff --git a/docs/guides/ti/matter-syscfg/images/reserve-gpio.png b/docs/platforms/ti/matter-syscfg/images/reserve-gpio.png similarity index 100% rename from docs/guides/ti/matter-syscfg/images/reserve-gpio.png rename to docs/platforms/ti/matter-syscfg/images/reserve-gpio.png diff --git a/docs/guides/ti/matter-syscfg/images/reserve-peripheral-panel.png b/docs/platforms/ti/matter-syscfg/images/reserve-peripheral-panel.png similarity index 100% rename from docs/guides/ti/matter-syscfg/images/reserve-peripheral-panel.png rename to docs/platforms/ti/matter-syscfg/images/reserve-peripheral-panel.png diff --git a/docs/guides/ti/matter-syscfg/images/show_generated_files_tab.png b/docs/platforms/ti/matter-syscfg/images/show_generated_files_tab.png similarity index 100% rename from docs/guides/ti/matter-syscfg/images/show_generated_files_tab.png rename to docs/platforms/ti/matter-syscfg/images/show_generated_files_tab.png diff --git a/docs/guides/ti/matter-syscfg/sysconfig-board.md b/docs/platforms/ti/matter-syscfg/sysconfig-board.md similarity index 100% rename from docs/guides/ti/matter-syscfg/sysconfig-board.md rename to docs/platforms/ti/matter-syscfg/sysconfig-board.md diff --git a/docs/guides/ti/matter-users-guide/enabling_icd_on_ti_devices.md b/docs/platforms/ti/matter-users-guide/enabling_icd_on_ti_devices.md similarity index 94% rename from docs/guides/ti/matter-users-guide/enabling_icd_on_ti_devices.md rename to docs/platforms/ti/matter-users-guide/enabling_icd_on_ti_devices.md index 50495a601e3..b024b90b40d 100644 --- a/docs/guides/ti/matter-users-guide/enabling_icd_on_ti_devices.md +++ b/docs/platforms/ti/matter-users-guide/enabling_icd_on_ti_devices.md @@ -24,9 +24,6 @@ Trigger Support, set the following parameter to true: chip_enable_icd_lit = true ``` -TI examples have only been tested with the ICD Server configuration. To enable -the client configuration, set `chip_enable_icd_client` to true. - Persistent subscriptions allow devices to attempt resuming existing subscriptions following a device reset. To enable persistent subscriptions, set the following parameter to true: diff --git a/docs/guides/ti/matter-users-guide/images/cc13x4_memmap.png b/docs/platforms/ti/matter-users-guide/images/cc13x4_memmap.png similarity index 100% rename from docs/guides/ti/matter-users-guide/images/cc13x4_memmap.png rename to docs/platforms/ti/matter-users-guide/images/cc13x4_memmap.png diff --git a/docs/guides/ti/matter-users-guide/images/factory_data_overview.png b/docs/platforms/ti/matter-users-guide/images/factory_data_overview.png similarity index 100% rename from docs/guides/ti/matter-users-guide/images/factory_data_overview.png rename to docs/platforms/ti/matter-users-guide/images/factory_data_overview.png diff --git a/docs/guides/ti/matter-users-guide/ti_factory_data_user_guide.md b/docs/platforms/ti/matter-users-guide/ti_factory_data_user_guide.md similarity index 100% rename from docs/guides/ti/matter-users-guide/ti_factory_data_user_guide.md rename to docs/platforms/ti/matter-users-guide/ti_factory_data_user_guide.md diff --git a/docs/guides/ti/matter-users-guide/ti_openthread_library_usage.md b/docs/platforms/ti/matter-users-guide/ti_openthread_library_usage.md similarity index 100% rename from docs/guides/ti/matter-users-guide/ti_openthread_library_usage.md rename to docs/platforms/ti/matter-users-guide/ti_openthread_library_usage.md diff --git a/docs/guides/ti/ti_matter_overview.md b/docs/platforms/ti/ti_matter_overview.md similarity index 99% rename from docs/guides/ti/ti_matter_overview.md rename to docs/platforms/ti/ti_matter_overview.md index 44943fa46ba..176ea26d95a 100644 --- a/docs/guides/ti/ti_matter_overview.md +++ b/docs/platforms/ti/ti_matter_overview.md @@ -103,7 +103,7 @@ by the platform implementation files. Below are several resources available for Matter development: - [Matter Protocol Overview](https://handbook.buildwithmatter.com/howitworks/roles/) -- [Matter Build Guide](../BUILDING.md) +- [Matter Build Guide](../../guides/BUILDING.md) - [Matter over Thread Getting Started](https://dev.ti.com/tirex/explore/node?node=A__AciOYyNq9gli.nsvJzBtQg__com.ti.SIMPLELINK_ACADEMY_CC13XX_CC26XX_SDK__AfkT0vQ__LATEST) - [TI Matter over Wi-Fi Getting Started](https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1122413/faq-cc3235sf-matter----getting-started-guide) - [TI Matter Application Development](https://dev.ti.com/tirex/explore/node?node=A__AXNOPYikmtBCHJ-L6eRivA__com.ti.SIMPLELINK_ACADEMY_CC13XX_CC26XX_SDK__AfkT0vQ__LATEST) diff --git a/docs/style/CODING_STYLE_GUIDE.md b/docs/style/CODING_STYLE_GUIDE.md new file mode 100644 index 00000000000..bba6ef4ffad --- /dev/null +++ b/docs/style/CODING_STYLE_GUIDE.md @@ -0,0 +1,172 @@ +# Coding Style Guide + +_Revision 6_ _2024-10-28_ + +This guide provides a small set of code guidelines used in the SDK. This guide +reflects the currently accepted style practices for the SDK and is subject to +change. + +The SDK was seeded from multiple different projects and contains contributions +from many different companies and the SDK code therefore uses several different +coding styles throughout the code base. Stylistically, code should attempt to +conform to the dominant style of the code being modified, while also adhering to +the guidelines below. + +## Language standard + +Code in the SDK conforms to the following standards. Changes to the C++ standard +happen relatively infrequently. Changes to the Python version are more frequent. + +| Language | Version | +| -------- | ------- | +| C++ | C++17 | +| Python | 3.10 | + +Product-specific software may elect to use later standards in their own work. + +## Coding Guidelines + +### Common + +#### When in Rome + +The most important convention and practice in the Matter SDK repo is "_When in +Rome..._", per the quote below. + +[quote, St. Ambrose] + +--- + +If you should be in Rome, live in the Roman manner; if you should be elsewhere, +live as they do there. + +--- + +Your extensions or fixes to existing code should match the prevailing style of +the original code. + +If you find the conventions so foreign or otherwise confusing, it may be best to +let whoever owns the file make the necessary changes or seek the counsel of +others in the group to find out what the right thing to do is. Never just start +changing code wholesale for personal reasons without consulting others first. + +#### Commenting Out or Disabling Code + +Unused code shall not be disabled by commenting it out with C- or C++-style +comments or with preprocessor `#if 0 ... #endif` semantics. Unused code should +be removed. + +#### Auto-formatters + +We use the following auto-formatters on code: + +| Language | Formatter | Style File | +| ----------- | ------------------ | ------------------------------------------------------------------------------------------ | +| C++ | clang-format | [.clang-format](https://github.com/project-chip/connectedhomeip/blob/master/.clang-format) | +| Objective-C | clang-format | [.clang-format](https://github.com/project-chip/connectedhomeip/blob/master/.clang-format) | +| java | google-java-format | N/A | +| Python | pep8, isort, ruff | [.restyled.yaml][restyle_link] (command line), [isort][isort_link], [ruff][ruff_link] | +| YAML | prettier | None | +| JSON | prettier | None | +| markdown | prettier | None | + +[restyle_link]: + https://github.com/project-chip/connectedhomeip/blob/master/.restyled.yaml +[isort_link]: + https://github.com/project-chip/connectedhomeip/blob/master/.isort.cfg +[ruff_link]: + https://github.com/project-chip/connectedhomeip/blob/master/ruff.toml + +All pull requests run formatting checks using these tools before merge is +allowed. Generated code is not run through restyle. + +### C++ + +#### Use C++ _cstdint_ for Plain Old Data Types + +Standard, scalar data types defined in _cstdint_ should be used for basic signed +and unsigned integer types, especially when size and serialization to +non-volatile storage or across a network is concerned. + +Examples of these are: `uint8_t`, `int8_t`, etc. + +#### Avoid top-level `using namespace` Statements in Headers + +By doing this, you are effectively forcing every other module that includes the +header to also be using the namespace. This causes namespace pollution and +generally defeats the purposes of namespaces. Fully-qualified symbols or +namespace blocks should be used instead. + +#### Classes / objects not exposed in a header should be in an anonymous namespace + +If a cpp class defines a class or instantiates a static object, it should be +enclosed in an anonymous namespace. + +``` +namespace { + // CPP internal defines go here +} // namespace +``` + +#### Singleton use + +The decision to use a singleton class should be considered with care. Do not +default to using a singleton for ease of writing code. + +If the class truly should be a singleton (ex. if it is controlling access to a +hardware resource) + +- The standard function name for accessing an SDK singleton is GetInstance(). +- Singleton classes should delete copy and move constructors + +#### Avoid Heap-based Resource Allocation and auto-resizing std containers + +Heap-based resource allocation should be avoided in the core SDK for common code +that may run on constrained embedded devices. This includes any container +element in std that automatically re-sizes itself at runtime (ex. vector, string +etc.) as these re-size operations are often large and can lead to memory +exhaustion and fragmentation on embedded systems. + +Heap-based allocation is allowed for controller code and is at the discretion of +platform vendors for platform-specific code. + +##### Alternatives + +In either case, recommended resource allocation alternatives are: + +- In-place allocation and initialization +- Pool-based allocators +- Platform-defined and -assigned allocators + +[CHIPMem.h](https://github.com/project-chip/connectedhomeip/blob/master/src/lib/support/CHIPMem.h) +provides support for platform defined allocators. + +[Pool.h](https://github.com/project-chip/connectedhomeip/blob/master/src/lib/support/Pool.h) +is the Matter SDK pool allocator implementation. + +#### Prefer CopySpanToMutableSpan over memcpy when using spans + +See +[Span.h](https://github.com/project-chip/connectedhomeip/blob/master/src/lib/support/Span.h) + +#### Prefer std::optional to CHIP implementation in newer code + +The Matter SDK Optional.h was implemented when the Matter SDK was C++14, but +newer code can use std::optional, which offers some benefits over the Matter SDK +implementation (ex. std::optional is trivially destructible if the underlying +type is also trivially destructible) + +### Python + +#### Type hints + +Use type hints on function definitions for public APIs. + +#### Docstrings + +Docstrings should be included for all public APIs. + +#### mypy + +The current python code does not yet pass mypy checks, but we are working +towards this goal. The more compliant new code is to mypy, the better. diff --git a/docs/style/coding/CODING_STYLE_GUIDE-figure1.png b/docs/style/coding/CODING_STYLE_GUIDE-figure1.png deleted file mode 100644 index d8603de93c6..00000000000 Binary files a/docs/style/coding/CODING_STYLE_GUIDE-figure1.png and /dev/null differ diff --git a/docs/style/coding/CODING_STYLE_GUIDE.adoc b/docs/style/coding/CODING_STYLE_GUIDE.adoc deleted file mode 100644 index d6436523d65..00000000000 --- a/docs/style/coding/CODING_STYLE_GUIDE.adoc +++ /dev/null @@ -1,721 +0,0 @@ -[.text-center] -= Project Connected Home over IP Software -:listing-caption: *Listing* -:toc: macro -:toclevels: 7 -:sectnumlevels: 7 -:sectanchors: -:sectlinks: - -:plusplus: ++ - -:sectnums!: - -== Best Practices, Coding Conventions, and Style - -[.text-center] -_Revision 5_ + -_2020-09-22_ - -[.text-center] -*Status:* [red]*Approved* / [red]*Active* - -toc::[] - -== Typographic and Syntactic Conventions - -The following syntactic conventions are used throughout this document: - -_shall_:: - -is used to indicate a mandatory rule or guideline that must be adhered -to without exception to claim compliance with this specification. - -_should_:: - -is used to indicate a rule or guideline that serves as a strong -preference to suggested practice and is to be followed in the absence of -a compelling reason to do otherwise. - -_may_:: - -is used to indicate a rule or guideline that serves as a reference to -suggested practice. - -== Introduction - -There are likely as many unique combinations of software engineering and -development standards, conventions, and practices as there organizations -that do such work. This document pulls together those that Project -Connected Home over IP believes best for our organization, its efforts, -and products that consume those efforts, with a particular emphasis on -embedded systems with C or C{plusplus} language development and runtime -environments. - -This document and requirements should be considered canonical for all -Project Connected Home over IP shared infrastructure software, including -both RTOS-based and non-RTOS-based projects on both tightly- and -loosely-constrained system platforms. - -The document is broadly categorized at the highest level into: - -* Best Practices and Conventions -* Format and Style - -And, within conventions, further sub-categorized into those that apply -to: - -* Tightly-constrained -* Loosely-constrained - -system platforms. Applicability to tightly-constrained systems also -generally applies to shared infrastructure software that is used on both -tightly- and loosely-constrained systems. - -link:#id.jzphr1iiku89[Figure 1 below] attempts to illustrate both -qualitative and quantitative applicability of these guidelines to -Project Connected Home over IP software. - -Generally, product-specific applications have the greatest flexibility -and latitude in applying these guidelines to their software. Whereas, -shared infrastructure bears the least flexibility and bears the greatest -adherence to these guidelines. - -image:CODING_STYLE_GUIDE-figure1.png[Figure 1. Graphical summary of the -qualitative and quantitative applicability to Project CHIP software.] - -[[id.jzphr1iiku89]] - -[.text-center] -*Figure 1.* Graphical summary of the qualitative and quantitative -applicability to Project CHIP software. - -:sectnums: - -== Standards - -Project CHIP embedded software development adopts the minimum C and C{plusplus} -standards listed in Table 2.1 below. - -[[t.4d8bfeef046f29261fc72f1a903d6d10a909957a]][[t.2]] - -[cols=3,options="header"] -|=== -|Language |Minimum Standard |Aliases - -|C|ISO9899:1999|ISO C99, C99 -|C{plusplus}|ISO14882:2014|ISO C{plusplus}14, C{plusplus}14 -|=== -[.text-center] -*Table 2.1.* C and C{plusplus} language minimum standards adopted by Project CHIP -software. - -Product-specific software may elect to use later standards to the extent -their software is not broadly shared inside or outside Project CHIP. - -=== C - -Project CHIP embedded software development uses and enforces the -ISO9899:1999 (aka ISO C99, C99) C language standard as the minimum. - -Wherever possible, particularly in non-product-specific, -shared-infrastructure software, toolchain-specific (e.g GCC/GNU) -extensions or the use of later standards shall be avoided or shall be -leveraged through toolchain-compatibility preprocessor macros. - -==== Motivation and Rationale - -At the time of this writing, the C99 standard has been out for over 20 -years. Project CHIP and both the new and contributed source code that -comprise it have only existed for the last seven to eight of those -20-plus years. - -This is beyond more than adequate time for this standard to be pervasive -throughout any toolchain vendor’s C compiler and saves team members from -worrying about ISO9899:1990 (aka ISO C90, C90) portability issues that -have long-since been solved by C99. - -=== C{plusplus} - -Project CHIP embedded software development uses the ISO14882:2014 (aka -ISO C{plusplus}14) language standard as a baseline for source code -compatibility. Conformance with other standards, for example, ISO14882:1998 -(aka ISO C{plusplus}98), may be additionally required in cases where wider -portability is necessary, but in all cases, ISO C{plusplus}14 is the baseline -requirement. - -Wherever possible, particularly in non-product-specific, -shared-infrastructure software, toolchain-specific (e.g GCC/GNU) -extensions or the use of later standards shall be avoided or shall be -leveraged through toolchain-compatibility preprocessor macros. - -==== Motivation and Rationale - -CHIP strives to use the latest C++ functionality as long as existing compilers -support such standards. - -C{plusplus}14 is considered pervasive enough to be used. As compilers start -supporting standards such as C{plusplus}17, C{plusplus}20 and beyond, -CHIP may follow suit. - -== Conventions and Best Practices - -=== Common - -The following sections summarize those best practices that are -independent of particular nuances of either the C or C{plusplus} languages. - -==== When in Rome - -The most important convention and practice in the Project CHIP embedded -software is "_When in Rome..._", per the quote below. - -[quote, St. Ambrose] -____ -If you should be in Rome, live in the Roman manner; if you should be -elsewhere, live as they do there. -____ - -===== Motivation and Rationale - -At this stage in the work group’s and the team’s life cycle, it is rare -the project or subsystem that is entirely new and built from scratch. -More often than not, development will involve extending, enhancing, and -fixing existing code in existing projects. - -When in this situation, it is mandatory you observe how things are done -in this context and do the best that you can to follow the prevailing -conventions present. Not doing so can lead to readability and -maintenance problems down the line and will likely earn you the -disapprobation of the code’s _owner_ or other team members. - -Your extensions or fixes to existing code should be *indistinguishable*, -stylistically, from the original code such that the only way to -ascertain ownership and responsibility is to use the source code control -system’s change attribution (aka _blame_) feature. - -If you find the conventions so foreign or otherwise confusing, it may be -best to let whoever owns the file make the necessary changes or seek the -counsel of others in the group to find out what the right thing to do -is. Never just start changing code wholesale for personal reasons -without consulting others first. - -==== Language-independent - -===== Commenting Out or Disabling Code - -Unused code shall not be disabled by commenting it out with C- or -C{plusplus}-style comments or with preprocessor `#if 0 ... #endif` semantics. - -====== Motivation and Rationale - -Code should either be actively maintained and "in" the source base for a -purpose or removed entirely. Code that is disabled in this way is -generally sloppy and does not convey a sense of certainty and direction -in the code. - -Anyone who is interested in the history of a particular source code file -should use the source code control system to browse it. - -Code that is debug- or test-only should be moved to a conditionally -compiled test source file or conditionalized with an appropriate -`WITH_DEBUG`, `WANT_DEBUG`, `WITH_TESTS`, `WANT_TESTS`, or some similar such -preprocessor mnemonic that can be asserted from the build system. - -===== Use C _stdint.h_ or C{plusplus} _cstdint_ for Plain Old Data Types - -Standard, scalar data types defined in _stdint.h_ \(C) or _cstdint_ (C{plusplus}) -should be used for basic signed and unsigned integer types, especially -when size and serialization to non-volatile storage or across a network -is concerned. - -Examples of these are: `uint8_t`, `int8_t`, etc. - -====== Motivation and Rationale - -These types have been effectively standardized since C99 and should be -available on every platform and provide more neutral portability than -OS-specific types such as `u8`, `UInt8`, etc. Moreover, because these are -pervasive, you do not need to spend any time and energy as a developer -and engineer creating more such types on your own—the compiler vendors -have already done the hard work for you. - -Additionally, using traditional scalar types such as `char`, `int`, `short`, or -`long` have portability issues where data width is concerned because these -types are either signed- or sized-differently on different processor -architectures and and ABIs for those architectures. For example, a char is signed -on some architectures and unsigned on others and a long is 32-bits on some -architectures and 64-bits on others. - -==== Language-dependent - -===== C{plusplus} - -====== Avoid `using namespace` Statements in Headers - -By doing this, you are effectively forcing every other module that -includes the header to also be using the namespace. This causes -namespace pollution and generally defeats the purposes of namespaces. -Fully-qualified symbols should be used instead. - -=== Tightly-constrained Systems and Shared Infrastructure - -Applicability to tightly-constrained systems also generally applies to -shared infrastructure software that is used on both tightly- and -loosely-constrained systems. - -==== Avoid Heap-based Resource Allocation - -Heap-based resource allocation should be avoided. - -===== Motivation and Rationale - -As emphasized throughout this document, the software produced by Project -CHIP is consumed both inside and outside Project CHIP, across a variety -of platforms. The capabilities of these platforms are broad, spanning -soft real-time, deeply-embedded systems based on RTOSes that -may cover life safety and/or physical security applications to richer, -softly-embedded systems based on non-RTOS platforms such as Darwin or -Linux. While the latter are apt to have fully-functional heaps, the -former explicitly may not. - -Consequently, when planning new or extending existing Project CHIP code, -consider the platforms to which the code is targeted. If the platforms -include those deeply-embedded platforms absent functioning heaps, then -heap-based resource allocation is absolutely forbidden. If not, -consideration should be made to the cost / benefit trade-offs of -heap-based allocation and, if possible, it should be avoided using one -of the recommended techniques below. - -===== Alternatives - -In either case, recommended resource allocation alternatives are: - -* In Place Allocation and Initialization -* Pool-based Allocators -* Platform-defined and -assigned Allocators - -The interfaces in https://github.com/project-chip/connectedhomeip/blob/master/src/lib/support/CHIPMem.h[_src/lib/support/CHIPMem.h_] provide support for -the latter two alternatives. - -====== Use In Place Allocation and Initialization - -Regardless of whether the source code and runtime are C or C{plusplus}, the -first step is creating storage for the object being allocated and -initialized. For simple -https://en.wikipedia.org/wiki/Passive_data_structure[plain-old-data -(POD)] data structures, this can be done by just allocating the -structure at an appropriate scope. Alternatively, _raw_ storage can be -allocated and then cast. However, great care must be taken with the -latter approach to ensure that natural machine alignments and language -strict-aliasing rules are observed. With the simple data structure -declaration, the compiler does this on your behalf. With the raw -approach, you must do this. - -Once the storage has been allocated, then use symmetric initializers and -deinitializers such as those, for example, for `pthread_attr_t`. An -example is shown in the listing below. - -[source,C,caption='',title='{listing-caption} *{counter:refnum}*. Using in place allocation and initialization in C or C{plusplus}.'] ----- -#include -#include - -... - -// Preprocessor Definitions - -// Allocate the structure using "raw" storage. - -#if defined(__cplusplus) && (__cplusplus >= 201103L) -#include - -#define chipDEFINE_ALIGNED_VAR(name, size, align_type) \ - typename std::aligned_storage::type name; - -#else -#define chipDEFINE_ALIGNED_VAR(name, size, align_type) \ - align_type name[(((size) + (sizeof (align_type) - 1)) / sizeof (align_type))] - -#endif // defined(__cplusplus) && (__cplusplus >= 201103L) - -// Forward Declarations - -extern void * foobar_entry(void *aArgument); - -// Global Variables - -#if USE_STRUCT_STORAGE -// Allocate the structure directly. -static pthread_attr_t sThreadAttributes; - -#elif USE_RAW_STORAGE -static chipDEFINE_ALIGNED_VAR(sThreadAttributes, sizeof (pthread_attr_t), uint64_t); - -#endif // USE_STRUCT_STORAGE - -int foobar() -{ - int retval; - int status; - pthread_t thread; - pthread_attr_t * attrs = (pthread_attr_t *)&sThreadAttributes; - - // Now "construct" or initialize the storage. - retval = pthread_attr_init(attrs); - - if (retval == 0) - { - retval = pthread_create(&thread, attrs, foobar_entry, NULL); - - if (retval == 0) - { - status = pthread_join(thread, NULL); - - if (status != 0) - { - retval = status; - } - - status = pthread_attr_destroy(attrs); - - if (status != 0) - { - retval = status; - } - } - } - - return (retval); -} ----- - -For non-scalar types and objects such as C{plusplus} classes, this gets slightly -trickier since C{plusplus} constructors and destructors must be accounted for -and invoked. Fortunately, C{plusplus} has placement new which handles this. -The listing below modifies the listing above using C{plusplus} placement new -to ensure the class is properly constructed before initialization and -destructed after deinitialization. - -[source,C++,caption='',title='{listing-caption} *{counter:refnum}*. Using C{plusplus} placement new for in place allocation and initialization.'] ----- -#include - -#include -#include - -... - -// Preprocessor Definitions - -// Allocate the structure using "raw" storage. - -#if defined(__cplusplus) && (__cplusplus >= 201103L) -#include - -#define chipDEFINE_ALIGNED_VAR(name, size, align_type) \ - typename std::aligned_storage::type name; - -#else -#define chipDEFINE_ALIGNED_VAR(name, size, align_type) \ - align_type name[(((size) + (sizeof (align_type) - 1)) / sizeof (align_type))] - -#endif // defined(__cplusplus) && (__cplusplus >= 201103L) - -// Type Declarations - -class ThreadAttributes -{ -public: - ThreadAttributes() {}; - ~ThreadAttributes() {}; - - operator pthread_attr_t *() { return &mAttributes; } - -private: - pthread_attr_t mAttributes; -}; - -// Forward Declarations - -extern void * foobar_entry(void *aArgument); - -// Global Variables - -static chipDEFINE_ALIGNED_VAR(sThreadAttributes, sizeof (ThreadAttributes), uint64_t); - -int foobar() -{ - int retval = -1; - int status; - pthread_t thread; - ThreadAttributes * ta; - pthread_attr_t * attrs; - - ta = new (&sThreadAttributes) ThreadAttributes; - - if (ta != NULL) - { - attrs = static_cast(*ta); - - // Now "construct" or initialize the storage. - retval = pthread_attr_init(attrs); - - if (retval == 0) - { - retval = pthread_create(&thread, attrs, foobar_entry, NULL); - - if (retval == 0) - { - status = pthread_join(thread, NULL); - - if (status != 0) - { - retval = status; - } - - status = pthread_attr_destroy(attrs); - - if (status != 0) - { - retval = status; - } - } - } - - ta->~ThreadAttributes(); - } - - return retval; -} ----- - -====== Use Pool-based Allocators - -In place allocation allows the successful allocation, initialization, -deinitialization, and deallocation of a single object allocated from -preallocated storage. However, if the desire exists for a fixed, -configurable pool of objects where 0 to `n` of such objects can be -allocated at any one time, a pool allocator for that specific object -type must be created. - -As shown in the listing below, a pool allocator for a `Foo` class of -`CHIP_FOO_COUNT` objects is effected, assuming the existence of another -helper class, StaticAllocatorBitmap, which uses a bitmap to track the -storage of objects from a static array of storage. - -[source,C++,caption='',title='{listing-caption} *{counter:refnum}*. Using pool-based allocators.'] ----- - -#include - -// Preprocessor Definitions - -// Allocate the structure using "raw" storage. - -#if defined(__cplusplus) && (__cplusplus >= 201103L) -#include - -#define chipDEFINE_ALIGNED_VAR(name, size, align_type) \ - typename std::aligned_storage::type name; - -#else -#define chipDEFINE_ALIGNED_VAR(name, size, align_type) \ - align_type name[(((size) + (sizeof (align_type) - 1)) / sizeof (align_type))] - -#endif // defined(__cplusplus) && (__cplusplus >= 201103L) - -// Type Definitions - -class Foo -{ -public: - Foo(); - Foo(const Foo &inFoo); - ~Foo(); -}; - -// Global Variables - -static chipDEFINE_ALIGNED_VAR(sFooAllocatorBuffer, sizeof (StaticAllocatorBitmap), uint32_t); -static StaticAllocatorBitmap *sFooAllocator; - -static void CreateFooAllocator(void *inStorage, - const StaticAllocatorBitmap::size_type &inStorageSize, - const StaticAllocatorBitmap::size_type &inElementCount, - StaticAllocatorBitmap::InitializeFunction inInitialize, - StaticAllocatorBitmap::DestroyFunction inDestroy) -{ - sFooAllocator = new (sFooAllocatorBuffer) - StaticAllocatorBitmap(inStorage, - inStorageSize, - inElementCount, - inInitialize, - inDestroy); -} - -static StaticAllocatorBitmap &GetFooAllocator() -{ - return *sFooAllocator; -} - -static void *FooInitialize(AllocatorBase &inAllocator, void *inObject) -{ - memset(inObject, 0, sizeof(Foo)); - - return inObject; -} - -static void FooDestroy(AllocatorBase &inAllocator, void *inObject) -{ - return; -} - -int Init() -{ - static const size_t sFooCount = CHIP_FOO_COUNT; - static chipAllocatorStaticBitmapStorageDefine(sFooStorage, Foo, sFooCount, uint32_t, sizeof (void *)); - int retval = 0; - - CreateFooAllocator(sFooStorage, - sizeof (sFooStorage), - sFooCount, - FooInitialize, - FooDestroy); - - return retval; -} - -Foo * FooAllocate() -{ - Foo *foo; - - foo = static_cast(GetFooAllocator().allocate()); - - return foo; -} - -void FooDeallocate(Foo *inFoo) -{ - GetFooAllocator().deallocate(inFoo); -} ----- - -====== Use Platform-defined and -assigned Allocators - -This is a variation on both in place allocation and pool-based -allocation in that it completely delegates resource allocation to the -system integrator and the platform on which the particular software -subsystem is running. - -The advantage of this approach is that it allows the platform to decide -how resource allocation will be handled and allows the package to scale -independently of platform resource allocation. - -The package may define default implementations for a few types of -platform allocation strategies, such as heap-based allocators and -pool-based allocators. - -There are a range of granularities for achieving this type of -delegation, depending on the desired size of the API surface, as shown -in the listings below. - -[source,C++,caption='',title='{listing-caption} *{counter:refnum}*. Using a common allocator method pattern with unique allocators per object, accessed from a unique singleton access per allocator.'] ----- - -chipPlatformInitFooAllocator(); -chipPlatformInitBarAllocator(); -… -foo = chipPlatformGetFooAllocator().allocate(); -… -chipPlatformGetFooAllocator().deallocate(foo); -… -bar = chipPlatformGetBarAllocator().allocate(); -… -chipPlatformGetBarAllocator().deallocate(bar); ----- - -[source,C++,caption='',title='{listing-caption} *{counter:refnum}*. Using a common allocator method pattern with unique allocators per object, accessed from a common singleton access with type per allocator.'] ----- -chipPlatformInitAllocator(CHIP_FOO_T); -chipPlatformInitAllocator(CHIP_BAR_T); -… -foo = chipPlatformGetAllocator(CHIP_FOO_T).allocate(); -… -chipPlatformGetAllocator(CHIP_FOO_T).deallocate(foo); -… -bar = chipPlatformGetAllocator(CHIP_BAR_T).allocate(); -… -chipPlatformGetAllocator(CHIP_BAR_T).deallocate(bar); ----- - -[source,C,caption='',title='{listing-caption} *{counter:refnum}*. Using unique allocators per object.'] ----- -chipPlatformInitFooAllocator(); -chipPlatformInitBarAllocator(); -… -foo = chipPlatformFooAllocate(); -… -chipPlatformFooDeallocate(foo); -… -bar = chipPlatformBarAllocate(); -… -chipPlatformBarDeallocate(bar); ----- - -[source,C,caption='',title='{listing-caption} *{counter:refnum}*. Using a common allocator pattern with unique allocators per object, accessed from a common interface with type per allocator.'] ----- - -chipPlatformInitAllocator(CHIP_FOO_T); -chipPlatformInitAllocator(CHIP_BAR_T); -… -foo = chipPlatformAllocate(CHIP_FOO_T); -… -chipPlatformDeallocate(CHIP_FOO_T, foo); -… -bar = chipPlatformAllocate(CHIP_BAR_T); -… -chipPlatformBarDeallocate(CHIP_BAR_T, bar); ----- - -:sectnums!: - -== Recommended Reading - -While the following references and reading are not part of the formal -best practices, coding conventions, and style cannon, they are -informative and useful guides for improving the style and quality of the -code you write: - -. Jet Propulsion Laboratory. -http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf[JPL -Institutional Coding Standard for the C Programming Language.] Version -1.0. March 3, 2009. -. Jet Propulsion Laboratory. -http://pixelscommander.com/wp-content/uploads/2014/12/P10.pdf[The -Power of Ten – Rules for Developing Safety Critical Code]. December -2014. -. Meyers, Scott. Effective C{plusplus}: 55 Specific Ways to Improve Your -Programs and Designs. Third Edition. 2005. -. Meyers, Scott. More Effective C{plusplus}: 35 New Ways to Improve Your -Programs and Designs. 1996. -. Meyers. Scott. https://www.artima.com/shop/effective_cpp_in_an_embedded_environment[Effective C{plusplus} in an Embedded Environment]. 2015. -. Motor Industry Software Reliability Association. Guidelines for the -Use of the C Language in Critical Systems. March 2013. -. Motor Industry Software Reliability Association. Guidelines for the -Use of the C{plusplus} Language in Critical Systems. June 2008. - -== Revision History - -[cols="^1,^1,<2,<3",options="header"] -|=== -|Revision |Date |Modified By |Description -|5 |2020-09-22 |Grant Erickson |Added Tightly-constrained Systems and Shared Infrastructure > Avoid Heap-based Resource Allocation -|4 |2020-09-15 |Grant Erickson |Added Common > Language-dependent > Avoid `using namespace` Statements in Headers -|3 |2020-09-01 |Grant Erickson |Added Common > Language-independent > Use C _stdint.h_ or C{plusplus} _cstdint_ for Plain Old Data Types -|2 |2020-07-09 |Grant Erickson |Added Common > Language-independent > Commenting Out or Disabling Code -|1 |2020-07-08 |Grant Erickson |Initial revision. -|=== - -[.text-center] -_Project Connect Home over IP Public Information_ diff --git a/docs/testing/fuzz_testing.md b/docs/testing/fuzz_testing.md index 68f08f4885c..7b5fd5683f6 100644 --- a/docs/testing/fuzz_testing.md +++ b/docs/testing/fuzz_testing.md @@ -79,10 +79,10 @@ for an example of a simple fuzz test. - Another example: [src/setup_payload/tests/BUILD.gn](https://github.com/project-chip/connectedhomeip/blob/b367512f519e5e109346e81a0d84fd85cd9192f7/src/setup_payload/tests/BUILD.gn#L43) -- Add to `src/BUILD.gn` +- Add to `${chip_root}/BUILD.gn` - Add the Fuzzing Target in this part of the code : - [src/BUILD.gn](https://github.com/project-chip/connectedhomeip/blob/b367512f519e5e109346e81a0d84fd85cd9192f7/BUILD.gn#L52) + [\${chip_root}/BUILD.gn](https://github.com/project-chip/connectedhomeip/blob/b367512f519e5e109346e81a0d84fd85cd9192f7/BUILD.gn#L52) - Add Fuzzing Target like that diff --git a/docs/testing/python.md b/docs/testing/python.md index a186e9bf203..9bda585726d 100644 --- a/docs/testing/python.md +++ b/docs/testing/python.md @@ -25,7 +25,7 @@ Python tests located in src/python_testing section should include various parameters and their respective values, which will guide the test runner on how to execute the tests. - All test classes inherit from `MatterBaseTest` in - [matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py) + [matter_testing.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_infrastructure/chip/testing/matter_testing.py) - Support for commissioning using the python controller - Default controller (`self.default_controller`) of type `ChipDeviceCtrl` - `MatterBaseTest` inherits from the Mobly BaseTestClass @@ -38,7 +38,7 @@ Python tests located in src/python_testing decorated with the @async_test_body decorator - Use `ChipDeviceCtrl` to interact with the DUT - Controller API is in `ChipDeviceCtrl.py` (see API doc in file) - - Some support methods in `matter_testing_support.py` + - Some support methods in `matter_testing.py` - Use Mobly assertions for failing tests - `self.step()` along with a `steps_*` method to mark test plan steps for cert tests @@ -61,7 +61,7 @@ Python tests located in src/python_testing # --passcode 20202021 # --trace-to json:${TRACE_TEST_JSON}.json # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto -# factoryreset: true +# factory-reset: true # quiet: true # === END CI TEST ARGUMENTS === @@ -217,7 +217,7 @@ Each `Clusters..Structs.` has: Example: -``` +```python Clusters.BasicInformation.Structs.ProductAppearanceStruct( finish=Clusters.BasicInformation.Enums.ProductFinishEnum.kFabric, primaryColor=Clusters.BasicInformation.Enums.ColorEnum.kBlack) @@ -293,7 +293,7 @@ Multi-path Example: -``` +```python urgent = 1 await dev_ctrl ReadEvent(node_id, [(1, @@ -359,7 +359,7 @@ asserts.assert_equal(ret[0].status, Status.Success, “write failed”) Example: -``` +```python pai = await dev_ctrl.SendCommand(nodeid, 0, Clusters.OperationalCredentials.Commands.CertificateChainRequest(2)) ``` @@ -379,7 +379,7 @@ pai = await dev_ctrl.SendCommand(nodeid, 0, Clusters.OperationalCredentials.Comm ## Mobly helpers The test system is based on Mobly, and the -[matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py) +[matter_testing.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_infrastructure/chip/testing/matter_testing.py) class provides some helpers for Mobly integration. - `default_matter_test_main` @@ -387,7 +387,7 @@ class provides some helpers for Mobly integration. use as: -``` +```python if __name__ == "__main__": default_matter_test_main() ``` @@ -479,7 +479,7 @@ See To create a controller on a new fabric: -``` +```python new_CA = self.certificate_authority_manager.NewCertificateAuthority() new_fabric_admin = new_certificate_authority.NewFabricAdmin(vendorId=0xFFF1, @@ -490,7 +490,7 @@ TH2 = new_fabric_admin.NewController(nodeId=112233) Open a commissioning window (ECW): -``` +```python params = self.OpenCommissioningWindow(dev_ctrl=self.default_controller, node_id=self.dut_node_id) ``` @@ -499,7 +499,7 @@ the fabric admin. Fabric admin for default controller: -``` +```python fa = self.certificate_authority_manager.activeCaList[0].adminList[0] second_ctrl = fa.new_fabric_admin.NewController(nodeId=node_id) ``` @@ -561,11 +561,11 @@ these steps to set this up: ## Other support utilities -- `basic_composition_support` +- `basic_composition` - wildcard read, whole device analysis - `CommissioningFlowBlocks` - various commissioning support for core tests -- `spec_parsing_support` +- `spec_parsing` - parsing data model XML into python readable format # Running tests locally @@ -577,25 +577,24 @@ running. To compile and install the wheel, do the following: First activate the matter environment using either -``` +```shell . ./scripts/bootstrap.sh ``` or -``` +```shell . ./scripts/activate.sh ``` bootstrap.sh should be used for for the first setup, activate.sh may be used for subsequent setups as it is faster. -Next build the python wheels and create / activate a venv (called `pyenv` here, -but any name may be used) +Next build the python wheels and create / activate a venv -``` -./scripts/build_python.sh -i pyenv -source pyenv/bin/activate +```shell +./scripts/build_python.sh -i out/python_env +source out/python_env/bin/activate ``` ## Running tests @@ -610,7 +609,7 @@ that will be commissioned either over BLE or WiFi. For example, to run the TC-ACE-1.2 tests against an un-commissioned DUT: -``` +```shell python3 src/python_testing/TC_ACE_1_2.py --commissioning-method on-network --qr-code MT:-24J0AFN00KA0648G00 ``` @@ -618,7 +617,7 @@ Some tests require additional arguments (ex. PIXITs or configuration variables for the CI). These arguments can be passed as sets of key/value pairs using the `---arg:` command line arguments. For example: -``` +```shell --int-arg PIXIT.ACE.APPENDPOINT:1 --int-arg PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff --string-arg PIXIT.ACE.APPATTRIBUTE:OnOff ``` @@ -627,7 +626,15 @@ for the CI). These arguments can be passed as sets of key/value pairs using the `./scripts/tests/run_python_test.py` is a convenient script that starts an example DUT on the host and includes factory reset support -`./scripts/tests/run_python_test.py --factoryreset --app --app-args "whatever" --script --script-args "whatever"` +```shell +./scripts/tests/run_python_test.py --factory-reset --app --app-args "whatever" --script --script-args "whatever" +``` + +For example, to run TC-ACE-1.2 tests against the linux `chip-lighting-app`: + +```shell +./scripts/tests/run_python_test.py --factory-reset --app ./out/linux-x64-light-no-ble/chip-lighting-app --app-args "--trace-to json:log" --script src/python_testing/TC_ACE_1_2.py --script-args "--commissioning-method on-network --qr-code MT:-24J0AFN00KA0648G00" +``` # Running tests in CI @@ -678,7 +685,7 @@ for that run, e.g.: # app: ${TYPE_OF_APP} # app-args: # script-args: -# factoryreset: +# factory-reset: # quiet: # === END CI TEST ARGUMENTS === ``` @@ -692,7 +699,7 @@ for that run, e.g.: - Example: `${TYPE_OF_APP}` -- `factoryreset`: Determines whether a factory reset should be performed +- `factory-reset`: Determines whether a factory reset should be performed before the test. - Example: `true` @@ -715,6 +722,11 @@ for that run, e.g.: - Example: `"Manual pairing code: \\[\\d+\\]"` +- `app-stdin-pipe`: Specifies the path to the named pipe that the test runner + might use to send input to the application. + + - Example: `/tmp/app-fifo` + - `script-args`: Specifies the arguments to be passed to the test script. - Example: diff --git a/docs/testing/yaml.md b/docs/testing/yaml.md index 9f65b1fed42..0adeca43e55 100644 --- a/docs/testing/yaml.md +++ b/docs/testing/yaml.md @@ -330,12 +330,11 @@ or bootstrap.sh should be used for for the first setup, activate.sh may be used for subsequent setups as it is faster. -Next build the python wheels and create a venv (called `py` here, but any name -may be used) +Next build the python wheels and create a venv ``` -./scripts/build_python.sh -i py -source py/bin/activate +./scripts/build_python.sh -i out/python_env +source out/python_env/bin/activate ``` Compile chip-tool: diff --git a/docs/upgrading.md b/docs/upgrading.md index 5640c925aca..e9e17239d50 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -92,3 +92,18 @@ Replacements for methods are: `chip::app::AttributeAccessInterfaceRegistry::Instance().UnregisterAllForEndpoint` - `chip::app::GetAttributeAccessOverride` replaced by `chip::app::AttributeAccessInterfaceRegistry::Instance().Get` + +### `ServerInitParams::dataModelProvider` in `Server::Init` and `FactoryInitParams` + +Server and controller initialization require a set data model provider to work +rather than auto-initializing ember-compatible code-generated data models. + +To preserve `codegen/zap` generated logic, use +`CodegenDataModelProviderInstance` (see changes in +[36558](https://github.com/project-chip/connectedhomeip/pull/36558) and +[36613](https://github.com/project-chip/connectedhomeip/pull/36613) ). + +To use default attribute persistence, you need to pass in a +`PersistentStorageDelegate` to `CodegenDataModelProviderInstance`. See example +changes in [36658](https://github.com/project-chip/connectedhomeip/pull/36658) +). diff --git a/docs/code_generation.md b/docs/zap_and_codegen/code_generation.md similarity index 98% rename from docs/code_generation.md rename to docs/zap_and_codegen/code_generation.md index bf5b6f30369..aac74bd6e66 100644 --- a/docs/code_generation.md +++ b/docs/zap_and_codegen/code_generation.md @@ -197,6 +197,11 @@ via `-o/--output-dir`. ./scripts/tools/zap/generate.py $PATH_TO_ZAP_FILE ``` +Rebuild the application. + +It is also recommended to run device composition tests to ensure the selected +composition is spec compliant (see [Testing](../testing)) + ### Compile-time code generation / pre-generated code A subset of code generation (both `codegen.py` and `zap-cli`) is done at compile @@ -208,9 +213,6 @@ at: - `src/app/chip_data_model.cmake` - `src/app/chip_data_model.gni` -Additionally, `build/chip/esp32/esp32_codegen.cmake` adds processing support for -the 2-pass cmake builds used by the Espressif `idf.py` build system. - ## Pre-generation Code pre-generation can be used: diff --git a/docs/getting_started/img/zap1.png b/docs/zap_and_codegen/img/zap1.png similarity index 100% rename from docs/getting_started/img/zap1.png rename to docs/zap_and_codegen/img/zap1.png diff --git a/docs/getting_started/img/zap2.png b/docs/zap_and_codegen/img/zap2.png similarity index 100% rename from docs/getting_started/img/zap2.png rename to docs/zap_and_codegen/img/zap2.png diff --git a/docs/getting_started/img/zap3.png b/docs/zap_and_codegen/img/zap3.png similarity index 100% rename from docs/getting_started/img/zap3.png rename to docs/zap_and_codegen/img/zap3.png diff --git a/docs/getting_started/img/zap4.png b/docs/zap_and_codegen/img/zap4.png similarity index 100% rename from docs/getting_started/img/zap4.png rename to docs/zap_and_codegen/img/zap4.png diff --git a/docs/getting_started/img/zap5.png b/docs/zap_and_codegen/img/zap5.png similarity index 100% rename from docs/getting_started/img/zap5.png rename to docs/zap_and_codegen/img/zap5.png diff --git a/docs/getting_started/img/zap6.png b/docs/zap_and_codegen/img/zap6.png similarity index 100% rename from docs/getting_started/img/zap6.png rename to docs/zap_and_codegen/img/zap6.png diff --git a/docs/getting_started/img/zap_compiler.png b/docs/zap_and_codegen/img/zap_compiler.png similarity index 100% rename from docs/getting_started/img/zap_compiler.png rename to docs/zap_and_codegen/img/zap_compiler.png diff --git a/docs/zap_and_codegen/index.md b/docs/zap_and_codegen/index.md new file mode 100644 index 00000000000..7301f03b214 --- /dev/null +++ b/docs/zap_and_codegen/index.md @@ -0,0 +1,8 @@ +# ZAP and Codegen + +```{toctree} +:glob: +:maxdepth: 1 + +* +``` diff --git a/docs/getting_started/zap.md b/docs/zap_and_codegen/zap_intro.md similarity index 100% rename from docs/getting_started/zap.md rename to docs/zap_and_codegen/zap_intro.md diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index dbcd306f440..be9b08eecf6 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -739,6 +739,7 @@ cluster GeneralCommissioning = 48 { provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6; provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7; provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8; + provisional readonly attribute access(read: administer) optional int32u TCUpdateDeadline = 9; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1146,7 +1147,7 @@ cluster GeneralDiagnostics = 51 { /** Take a snapshot of system time and epoch time. */ command TimeSnapshot(): TimeSnapshotResponse = 1; /** Request a variable length payload response. */ - command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; + command access(invoke: manage) PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; } /** Commands to trigger a Node to allow a new Administrator to commission it. */ @@ -2770,7 +2771,6 @@ endpoint 1 { ram attribute identifyType default = 0x0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -2786,7 +2786,6 @@ endpoint 1 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -2801,7 +2800,6 @@ endpoint 1 { callback attribute replacementProductList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -2818,7 +2816,6 @@ endpoint 1 { callback attribute replacementProductList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -2841,7 +2838,6 @@ endpoint 1 { ram attribute airflowDirection default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 63; ram attribute clusterRevision default = 4; @@ -2858,7 +2854,6 @@ endpoint 2 { ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -2873,7 +2868,6 @@ endpoint 2 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -2883,7 +2877,6 @@ endpoint 2 { callback attribute airQuality; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -2903,7 +2896,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2923,7 +2915,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2943,7 +2934,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2963,7 +2953,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2983,7 +2972,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -3003,7 +2991,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -3023,7 +3010,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -3043,7 +3029,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -3063,7 +3048,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -3083,7 +3067,6 @@ endpoint 2 { callback attribute levelValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -3098,7 +3081,6 @@ endpoint 3 { ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -3114,7 +3096,6 @@ endpoint 3 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -3127,7 +3108,6 @@ endpoint 3 { ram attribute tolerance default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -3142,7 +3122,6 @@ endpoint 4 { ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -3158,7 +3137,6 @@ endpoint 4 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -3171,7 +3149,6 @@ endpoint 4 { ram attribute tolerance; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 3; @@ -3186,7 +3163,6 @@ endpoint 5 { ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -3202,7 +3178,6 @@ endpoint 5 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -3218,7 +3193,6 @@ endpoint 5 { ram attribute thermostatRunningState default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 1; ram attribute clusterRevision default = 6; diff --git a/examples/air-purifier-app/ameba/chip_main.cmake b/examples/air-purifier-app/ameba/chip_main.cmake index 22a325bf6ed..4811bda0d88 100755 --- a/examples/air-purifier-app/ameba/chip_main.cmake +++ b/examples/air-purifier-app/ameba/chip_main.cmake @@ -145,6 +145,11 @@ endif (matter_enable_ota_requestor) list( APPEND ${list_chip_main_sources} + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/air-purifier-manager.cpp + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/air-quality-sensor-manager.cpp + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/filter-delegates.cpp + ${chip_dir}/examples/air-purifier-app/air-purifier-common/src/thermostat-manager.cpp + ${chip_dir}/examples/air-purifier-app/ameba/main/chipinterface.cpp ${chip_dir}/examples/air-purifier-app/ameba/main/DeviceCallbacks.cpp ${chip_dir}/examples/air-purifier-app/ameba/main/CHIPDeviceManager.cpp @@ -192,6 +197,7 @@ target_include_directories( ${chip_dir}/examples/air-purifier-app/air-purifier-common/include ${chip_dir}/examples/air-purifier-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/providers ${chip_dir_output}/gen/include ${chip_dir}/src/include/ diff --git a/examples/air-purifier-app/ameba/main/chipinterface.cpp b/examples/air-purifier-app/ameba/main/chipinterface.cpp index 0829bb041e4..766197dec36 100644 --- a/examples/air-purifier-app/ameba/main/chipinterface.cpp +++ b/examples/air-purifier-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" #include "Server.h" @@ -31,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -133,12 +135,15 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); #if CONFIG_ENABLE_AMEBA_CRYPTO ChipLogProgress(DeviceLayer, "platform crypto enabled!"); static chip::AmebaPersistentStorageOperationalKeystore sAmebaPersistentStorageOpKeystore; VerifyOrDie((sAmebaPersistentStorageOpKeystore.Init(initParams.persistentStorageDelegate)) == CHIP_NO_ERROR); initParams.operationalKeystore = &sAmebaPersistentStorageOpKeystore; #endif + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; chip::Server::GetInstance().Init(initParams); gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -151,6 +156,7 @@ static void InitServer(intptr_t context) PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); InitAirPurifierManager(); } diff --git a/examples/air-purifier-app/cc32xx/main/AppTask.cpp b/examples/air-purifier-app/cc32xx/main/AppTask.cpp index 0b284254b0c..b604271d5f8 100644 --- a/examples/air-purifier-app/cc32xx/main/AppTask.cpp +++ b/examples/air-purifier-app/cc32xx/main/AppTask.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -164,6 +165,7 @@ int AppTask::Init() PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/air-purifier-app/linux/README.md b/examples/air-purifier-app/linux/README.md index 2d771bdf5b5..377d53a0965 100644 --- a/examples/air-purifier-app/linux/README.md +++ b/examples/air-purifier-app/linux/README.md @@ -11,7 +11,7 @@ Temperature Sensor and Endpoint 5 is a Thermostat. To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +[README document](../../../docs/platforms/nxp/nxp_imx8m_linux_examples.md) for details.
diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter index dd9a87d59d6..3fac5bbaeac 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter @@ -739,6 +739,7 @@ cluster GeneralCommissioning = 48 { provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6; provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7; provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8; + provisional readonly attribute access(read: administer) optional int32u TCUpdateDeadline = 9; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1099,7 +1100,7 @@ cluster GeneralDiagnostics = 51 { /** Take a snapshot of system time and epoch time. */ command TimeSnapshot(): TimeSnapshotResponse = 1; /** Request a variable length payload response. */ - command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; + command access(invoke: manage) PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; } /** The Software Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ @@ -2620,7 +2621,6 @@ endpoint 1 { ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -2635,7 +2635,6 @@ endpoint 1 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -2645,7 +2644,6 @@ endpoint 1 { callback attribute airQuality; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -2657,7 +2655,6 @@ endpoint 1 { ram attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -2669,7 +2666,6 @@ endpoint 1 { ram attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 3; @@ -2681,7 +2677,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2693,7 +2688,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2705,7 +2699,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2717,7 +2710,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2729,7 +2721,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2741,7 +2732,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2753,7 +2743,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2765,7 +2754,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2777,7 +2765,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -2789,7 +2776,6 @@ endpoint 1 { callback attribute maxMeasuredValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; diff --git a/examples/air-quality-sensor-app/linux/README.md b/examples/air-quality-sensor-app/linux/README.md index ef90a4bd23d..158cd0d2deb 100644 --- a/examples/air-quality-sensor-app/linux/README.md +++ b/examples/air-quality-sensor-app/linux/README.md @@ -7,7 +7,7 @@ for Raspberry Pi Desktop 20.10 (aarch64)** To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +[README document](../../../docs/platforms/nxp/nxp_imx8m_linux_examples.md) for details.
diff --git a/examples/air-quality-sensor-app/silabs/BUILD.gn b/examples/air-quality-sensor-app/silabs/BUILD.gn index ed3077a3f16..958918e0d50 100644 --- a/examples/air-quality-sensor-app/silabs/BUILD.gn +++ b/examples/air-quality-sensor-app/silabs/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/pigweed.gni") import("${build_root}/config/defaults.gni") -import("${efr32_sdk_build_root}/silabs_executable.gni") +import("${silabs_sdk_build_root}/silabs_executable.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/platform/device.gni") @@ -38,7 +38,7 @@ if (wifi_soc) { import("${chip_root}/third_party/silabs/SiWx917_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917" } else { - import("${efr32_sdk_build_root}/efr32_sdk.gni") + import("${silabs_sdk_build_root}/efr32_sdk.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" } diff --git a/examples/air-quality-sensor-app/silabs/README.md b/examples/air-quality-sensor-app/silabs/README.md index d0e89d363dd..b2687c6cadb 100644 --- a/examples/air-quality-sensor-app/silabs/README.md +++ b/examples/air-quality-sensor-app/silabs/README.md @@ -257,6 +257,7 @@ combination with JLinkRTTClient as follows: - _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode for 30 seconds. The device will then switch to a slower interval advertisement. After 15 minutes, the advertisement stops. + Additionally, it will cycle through the QR code, application status screen and device status screen, respectively. - _Pressed and hold for 6 s_ : Initiates the factory reset of the device. Releasing the button within the 6-second window cancels the factory reset @@ -330,7 +331,7 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see -[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) +[EFR32 OTA Software Update](../../../docs/platforms/silabs/silabs_efr32_software_update.md) ## Building options diff --git a/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni b/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni index 718600a8115..8b5ccad9ebc 100644 --- a/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni +++ b/examples/air-quality-sensor-app/silabs/build_for_wifi_args.gni @@ -15,7 +15,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") -import("${chip_root}/src/platform/silabs/wifi_args.gni") +import("${chip_root}/src/platform/silabs/wifi/args.gni") chip_enable_wifi = true chip_enable_ota_requestor = true app_data_model = diff --git a/examples/air-quality-sensor-app/silabs/build_for_wifi_gnfile.gn b/examples/air-quality-sensor-app/silabs/build_for_wifi_gnfile.gn index d391814190d..1d6a71e88dd 100644 --- a/examples/air-quality-sensor-app/silabs/build_for_wifi_gnfile.gn +++ b/examples/air-quality-sensor-app/silabs/build_for_wifi_gnfile.gn @@ -24,5 +24,6 @@ default_args = { target_cpu = "arm" target_os = "freertos" chip_enable_wifi = true + chip_device_platform = "SiWx917" import("//build_for_wifi_args.gni") } diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 2d5c20aee41..be6f4c0622c 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -1642,6 +1642,7 @@ cluster GeneralCommissioning = 48 { provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6; provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7; provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8; + provisional readonly attribute access(read: administer) optional int32u TCUpdateDeadline = 9; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2049,7 +2050,7 @@ cluster GeneralDiagnostics = 51 { /** Take a snapshot of system time and epoch time. */ command TimeSnapshot(): TimeSnapshotResponse = 1; /** Request a variable length payload response. */ - command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; + command access(invoke: manage) PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; } /** The Software Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ @@ -4009,7 +4010,7 @@ provisional cluster ScenesManagement = 98 { /** Get an unused scene identifier when no commissioning tool is in the network, or for a commissioning tool to get the used scene identifiers within a certain group */ fabric command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6; /** Allows a client to efficiently copy scenes from one group/scene identifier pair to another group/scene identifier pair. */ - fabric command CopyScene(CopySceneRequest): CopySceneResponse = 64; + fabric command access(invoke: manage) CopyScene(CopySceneRequest): CopySceneResponse = 64; } /** Attributes and commands for monitoring HEPA filters in a device */ @@ -4708,13 +4709,13 @@ provisional cluster DeviceEnergyManagement = 152 { command ModifyForecastRequest(ModifyForecastRequestRequest): DefaultSuccess = 5; /** Allows a client to ask the ESA to recompute its Forecast based on power and time constraints. */ command RequestConstraintBasedForecast(RequestConstraintBasedForecastRequest): DefaultSuccess = 6; - /** Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command */ + /** Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command. */ command CancelRequest(): DefaultSuccess = 7; } /** Electric Vehicle Supply Equipment (EVSE) is equipment used to charge an Electric Vehicle (EV) or Plug-In Hybrid Electric Vehicle. This cluster provides an interface to the functionality of Electric Vehicle Supply Equipment (EVSE) management. */ cluster EnergyEvse = 153 { - revision 4; + revision 3; enum EnergyTransferStoppedReasonEnum : enum8 { kEVStopped = 0; @@ -4879,9 +4880,9 @@ cluster EnergyEvse = 153 { /** Allows a client to disable the EVSE from charging and discharging. */ timed command Disable(): DefaultSuccess = 1; - /** This command allows a client to enable the EVSE to charge an EV, */ + /** This command allows a client to enable the EVSE to charge an EV, and to provide or update the maximum and minimum charge current. */ timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2; - /** Upon receipt, this SHALL allow a client to enable the discharge of an EV, */ + /** Upon receipt, this SHALL allow a client to enable the discharge of an EV, and to provide or update the maximum discharge current. */ timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3; /** Allows a client to put the EVSE into a self-diagnostics mode. */ timed command StartDiagnostics(): DefaultSuccess = 4; @@ -4950,7 +4951,7 @@ cluster PowerTopology = 156 { /** Attributes and commands for selecting a mode from a list of supported options. */ cluster EnergyEvseMode = 157 { - revision 1; + revision 2; enum ModeTag : enum16 { kAuto = 0; @@ -4966,6 +4967,7 @@ cluster EnergyEvseMode = 157 { kManual = 16384; kTimeOfUse = 16385; kSolarCharging = 16386; + kV2X = 16387; } bitmap Feature : bitmap32 { @@ -4985,8 +4987,6 @@ cluster EnergyEvseMode = 157 { readonly attribute ModeOptionStruct supportedModes[] = 0; readonly attribute int8u currentMode = 1; - attribute optional nullable int8u startUpMode = 2; - attribute optional nullable int8u onMode = 3; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5003,8 +5003,7 @@ cluster EnergyEvseMode = 157 { optional char_string<64> statusText = 1; } - /** This command is used to change device modes. - On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */ + /** This command is used to change device modes. */ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; } @@ -5045,8 +5044,6 @@ cluster WaterHeaterMode = 158 { readonly attribute ModeOptionStruct supportedModes[] = 0; readonly attribute int8u currentMode = 1; - attribute optional nullable int8u startUpMode = 2; - attribute optional nullable int8u onMode = 3; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5060,17 +5057,16 @@ cluster WaterHeaterMode = 158 { response struct ChangeToModeResponse = 1 { enum8 status = 0; - optional char_string statusText = 1; + optional char_string<64> statusText = 1; } - /** This command is used to change device modes. - On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */ + /** This command is used to change device modes. */ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; } /** Attributes and commands for selecting a mode from a list of supported options. */ provisional cluster DeviceEnergyManagementMode = 159 { - revision 1; + revision 2; enum ModeTag : enum16 { kAuto = 0; @@ -5106,8 +5102,6 @@ provisional cluster DeviceEnergyManagementMode = 159 { readonly attribute ModeOptionStruct supportedModes[] = 0; readonly attribute int8u currentMode = 1; - attribute optional nullable int8u startUpMode = 2; - attribute optional nullable int8u onMode = 3; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -5124,8 +5118,7 @@ provisional cluster DeviceEnergyManagementMode = 159 { optional char_string<64> statusText = 1; } - /** This command is used to change device modes. - On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */ + /** This command is used to change device modes. */ command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0; } @@ -7586,7 +7579,6 @@ endpoint 0 { callback attribute tagList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -7608,7 +7600,6 @@ endpoint 0 { callback attribute accessControlEntriesPerFabric; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; callback attribute clusterRevision; @@ -7642,7 +7633,6 @@ endpoint 0 { callback attribute maxPathsPerInvoke; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 3; @@ -7667,7 +7657,6 @@ endpoint 0 { callback attribute supportedLocales; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -7679,7 +7668,6 @@ endpoint 0 { callback attribute supportedCalendarTypes; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 1; ram attribute clusterRevision default = 1; @@ -7689,7 +7677,6 @@ endpoint 0 { persist attribute temperatureUnit default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x1; ram attribute clusterRevision default = 1; @@ -7711,7 +7698,6 @@ endpoint 0 { callback attribute endpointList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 2; ram attribute clusterRevision default = 2; @@ -7725,7 +7711,6 @@ endpoint 0 { callback attribute supportsConcurrentConnection; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -7752,7 +7737,6 @@ endpoint 0 { callback attribute threadVersion; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 2; ram attribute clusterRevision default = 1; @@ -7771,7 +7755,6 @@ endpoint 0 { server cluster DiagnosticLogs { callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -7796,7 +7779,6 @@ endpoint 0 { callback attribute testEventTriggersEnabled; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -7967,7 +7949,6 @@ endpoint 0 { callback attribute adminVendorId; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -7986,7 +7967,6 @@ endpoint 0 { callback attribute currentFabricIndex; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -8012,7 +7992,6 @@ endpoint 0 { callback attribute maxGroupKeysPerFabric; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -8067,7 +8046,6 @@ endpoint 1 { ram attribute identifyType default = 0x0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -8080,7 +8058,6 @@ endpoint 1 { ram attribute nameSupport; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -8105,7 +8082,6 @@ endpoint 1 { persist attribute startUpOnOff default = 0xFF; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0001; ram attribute clusterRevision default = 6; @@ -8154,7 +8130,6 @@ endpoint 1 { callback attribute tagList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -8185,7 +8160,6 @@ endpoint 1 { callback attribute endpointList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 2; ram attribute clusterRevision default = 2; @@ -8228,7 +8202,6 @@ endpoint 1 { callback attribute operationalError; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -8245,7 +8218,6 @@ endpoint 1 { ram attribute currentMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -8259,7 +8231,6 @@ endpoint 1 { ram attribute selectedDrynessLevel; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -8319,7 +8290,6 @@ endpoint 1 { callback attribute supportedRinses; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 3; ram attribute clusterRevision default = 1; @@ -8330,7 +8300,6 @@ endpoint 1 { callback attribute currentMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -8344,7 +8313,6 @@ endpoint 1 { callback attribute currentMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -8453,7 +8421,6 @@ endpoint 1 { callback attribute currentMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -8492,7 +8459,6 @@ endpoint 1 { callback attribute operationalError; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -8509,7 +8475,6 @@ endpoint 1 { callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 1; ram attribute clusterRevision default = 1; @@ -8576,7 +8541,6 @@ endpoint 1 { ram attribute sensorFault default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0F; ram attribute clusterRevision default = 1; @@ -8601,7 +8565,6 @@ endpoint 1 { ram attribute levelStep default = 1; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 3; ram attribute clusterRevision default = 1; @@ -8633,7 +8596,6 @@ endpoint 1 { callback attribute neutralCurrent; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -8650,7 +8612,6 @@ endpoint 1 { callback attribute cumulativeEnergyReset; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -8665,7 +8626,6 @@ endpoint 1 { callback attribute boostState; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -8689,7 +8649,6 @@ endpoint 1 { callback attribute optOutState; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 3; @@ -8730,7 +8689,6 @@ endpoint 1 { callback attribute sessionEnergyCharged; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 2; @@ -8753,7 +8711,6 @@ endpoint 1 { ram attribute currentLowPowerModeSensitivity; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 3; ram attribute clusterRevision default = 1; @@ -8764,7 +8721,6 @@ endpoint 1 { callback attribute activeEndpoints; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -8773,11 +8729,8 @@ endpoint 1 { server cluster EnergyEvseMode { callback attribute supportedModes; callback attribute currentMode; - ram attribute startUpMode; - ram attribute onMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -8789,11 +8742,8 @@ endpoint 1 { server cluster WaterHeaterMode { callback attribute supportedModes; callback attribute currentMode; - ram attribute startUpMode; - ram attribute onMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -8805,11 +8755,8 @@ endpoint 1 { server cluster DeviceEnergyManagementMode { callback attribute supportedModes; callback attribute currentMode; - ram attribute startUpMode; - ram attribute onMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; ram attribute clusterRevision default = 1; @@ -8912,7 +8859,6 @@ endpoint 1 { ram attribute setpointHoldExpiryTimestamp; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0123; ram attribute clusterRevision default = 7; @@ -9101,7 +9047,7 @@ endpoint 1 { ram attribute occupancySensorTypeBitmap default = 1; callback attribute holdTime; callback attribute holdTimeLimits; - ram attribute PIROccupiedToUnoccupiedDelay default = 10; + callback attribute PIROccupiedToUnoccupiedDelay; callback attribute featureMap; ram attribute clusterRevision default = 5; } @@ -9450,7 +9396,6 @@ endpoint 2 { ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -9463,7 +9408,6 @@ endpoint 2 { ram attribute nameSupport; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -9488,7 +9432,6 @@ endpoint 2 { ram attribute startUpOnOff; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0001; ram attribute clusterRevision default = 6; @@ -9509,7 +9452,6 @@ endpoint 2 { callback attribute tagList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -9525,7 +9467,6 @@ endpoint 2 { callback attribute endpointList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 2; ram attribute clusterRevision default = 2; @@ -9537,7 +9478,6 @@ endpoint 2 { callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 1; ram attribute clusterRevision default = 1; @@ -9565,7 +9505,7 @@ endpoint 2 { ram attribute occupancySensorTypeBitmap default = 1; callback attribute holdTime; callback attribute holdTimeLimits; - ram attribute PIROccupiedToUnoccupiedDelay default = 10; + callback attribute PIROccupiedToUnoccupiedDelay; callback attribute featureMap; ram attribute clusterRevision default = 5; } @@ -9658,7 +9598,6 @@ endpoint 65534 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -9675,7 +9614,6 @@ endpoint 65534 { callback attribute lastConnectErrorValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap default = 0; callback attribute clusterRevision default = 1; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index f8e3dbd8806..c3586287ea4 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 103, + "featureLevel": 104, "creator": "zap", "keyValuePairs": [ { @@ -41,20 +41,23 @@ "code": 17, "profileId": 259, "label": "MA-powersource", - "name": "MA-powersource" + "name": "MA-powersource", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 17, "profileId": 259, "label": "MA-powersource", - "name": "MA-powersource" + "name": "MA-powersource", + "deviceTypeOrder": 0 }, { "code": 22, "profileId": 259, "label": "MA-rootdevice", - "name": "MA-rootdevice" + "name": "MA-rootdevice", + "deviceTypeOrder": 1 } ], "deviceVersions": [ @@ -329,22 +332,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -573,22 +560,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -1047,22 +1018,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 1, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -1389,22 +1344,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -1543,22 +1482,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -1665,22 +1588,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -1941,22 +1848,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -2177,22 +2068,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -2533,22 +2408,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -2657,22 +2516,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -2949,22 +2792,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -5192,22 +5019,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -5492,22 +5303,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -5712,22 +5507,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -6102,20 +5881,23 @@ "code": 256, "profileId": 259, "label": "MA-onofflight", - "name": "MA-onofflight" + "name": "MA-onofflight", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 256, "profileId": 259, "label": "MA-onofflight", - "name": "MA-onofflight" + "name": "MA-onofflight", + "deviceTypeOrder": 0 }, { "code": 17, "profileId": 259, "label": "MA-powersource", - "name": "MA-powersource" + "name": "MA-powersource", + "deviceTypeOrder": 1 } ], "deviceVersions": [ @@ -6220,22 +6002,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -6424,22 +6190,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -6694,22 +6444,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -7212,22 +6946,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -7579,24 +7297,8 @@ "reportableChange": 0 }, { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AttributeList", - "code": 65531, + "name": "AttributeList", + "code": 65531, "mfgCode": null, "side": "server", "type": "array", @@ -8088,22 +7790,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -8260,22 +7946,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -8398,22 +8068,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -9124,22 +8778,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -9280,22 +8918,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -9436,22 +9058,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -10651,22 +10257,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -11131,22 +10721,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -11424,22 +10998,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -12068,22 +11626,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -12384,22 +11926,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -12810,22 +12336,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -13021,22 +12531,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -13258,22 +12752,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -13559,22 +13037,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -14033,22 +13495,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -14264,22 +13710,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -14402,22 +13832,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -14488,71 +13902,39 @@ "name": "ChangeToModeResponse", "code": 1, "mfgCode": null, - "source": "server", - "isIncoming": 0, - "isEnabled": 1 - } - ], - "attributes": [ - { - "name": "SupportedModes", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "CurrentMode", - "code": 1, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ { - "name": "StartUpMode", - "code": 2, + "name": "SupportedModes", + "code": 0, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "OnMode", - "code": 3, + "name": "CurrentMode", + "code": 1, "mfgCode": null, "side": "server", "type": "int8u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14590,22 +13972,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -14714,38 +14080,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "StartUpMode", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "OnMode", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "GeneratedCommandList", "code": 65528, @@ -14778,22 +14112,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -14903,38 +14221,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "StartUpMode", - "code": 2, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "OnMode", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "int8u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "GeneratedCommandList", "code": 65528, @@ -14967,22 +14253,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -16425,22 +15695,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -23363,20 +22617,23 @@ "code": 256, "profileId": 259, "label": "MA-onofflight", - "name": "MA-onofflight" + "name": "MA-onofflight", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 256, "profileId": 259, "label": "MA-onofflight", - "name": "MA-onofflight" + "name": "MA-onofflight", + "deviceTypeOrder": 0 }, { "code": 17, "profileId": 259, "label": "MA-powersource", - "name": "MA-powersource" + "name": "MA-powersource", + "deviceTypeOrder": 1 } ], "deviceVersions": [ @@ -23481,22 +22738,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -23685,22 +22926,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -23921,22 +23146,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -24107,22 +23316,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -24325,22 +23518,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -24602,22 +23779,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -24815,14 +23976,16 @@ "code": 15, "profileId": 259, "label": "MA-genericswitch", - "name": "MA-genericswitch" + "name": "MA-genericswitch", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 15, "profileId": 259, "label": "MA-genericswitch", - "name": "MA-genericswitch" + "name": "MA-genericswitch", + "deviceTypeOrder": 0 } ], "deviceVersions": [ @@ -25274,14 +24437,16 @@ "code": 15, "profileId": 259, "label": "MA-genericswitch", - "name": "MA-genericswitch" + "name": "MA-genericswitch", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 15, "profileId": 259, "label": "MA-genericswitch", - "name": "MA-genericswitch" + "name": "MA-genericswitch", + "deviceTypeOrder": 0 } ], "deviceVersions": [ @@ -25685,14 +24850,16 @@ "code": 25, "profileId": 259, "label": "MA-secondary-network-interface", - "name": "MA-secondary-network-interface" + "name": "MA-secondary-network-interface", + "deviceTypeOrder": 0 }, "deviceTypes": [ { "code": 25, "profileId": 259, "label": "MA-secondary-network-interface", - "name": "MA-secondary-network-interface" + "name": "MA-secondary-network-interface", + "deviceTypeOrder": 0 } ], "deviceVersions": [ @@ -25809,22 +24976,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, @@ -26117,22 +25268,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "EventList", - "code": 65530, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": null, - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "AttributeList", "code": 65531, diff --git a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp index 6acc81ac285..efaa19600bb 100644 --- a/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp @@ -26,6 +26,11 @@ static std::unique_ptr gDelegate; static std::unique_ptr gEvseTargetsDelegate; static std::unique_ptr gInstance; +EndpointId GetEnergyDeviceEndpointId() +{ + return chip::EndpointId(1); +} + void emberAfEnergyEvseClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. diff --git a/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp new file mode 100644 index 00000000000..8bdf305b6d6 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::DeviceLayer; + +namespace { + +void SetTestEventTrigger_SoftwareFaultOccurred() +{ + Clusters::SoftwareDiagnostics::Events::SoftwareFault::Type softwareFault; + char threadName[kMaxThreadNameLength + 1]; + + softwareFault.id = static_cast(getpid()); + Platform::CopyString(threadName, std::to_string(softwareFault.id).c_str()); + + softwareFault.name.SetValue(CharSpan::fromCharString(threadName)); + + std::time_t result = std::time(nullptr); + // Using size of 50 as it is double the expected 25 characters "Www Mmm dd hh:mm:ss yyyy\n". + char timeChar[50]; + if (std::strftime(timeChar, sizeof(timeChar), "%c", std::localtime(&result))) + { + softwareFault.faultRecording.SetValue(ByteSpan(Uint8::from_const_char(timeChar), strlen(timeChar))); + } + + Clusters::SoftwareDiagnosticsServer::Instance().OnSoftwareFaultDetect(softwareFault); +} + +} // namespace + +bool HandleSoftwareDiagnosticsTestEventTrigger(uint64_t eventTrigger) +{ + SoftwareDiagnosticsTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case SoftwareDiagnosticsTrigger::kSoftwareFault: + ChipLogProgress(Support, "[Software-Diagnostics-Test-Event] => Software Fault occurred"); + SetTestEventTrigger_SoftwareFaultOccurred(); + break; + default: + + return false; + } + + return true; +} diff --git a/examples/all-clusters-app/all-clusters-common/src/wifi-diagnostics-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/wifi-diagnostics-stub.cpp new file mode 100644 index 00000000000..e142e897e40 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/wifi-diagnostics-stub.cpp @@ -0,0 +1,96 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include + +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::DeviceLayer; +using namespace chip::app::Clusters; + +namespace { + +/** + * @brief Helper function to simulate a Disconnection event + */ +void SetTestEventTrigger_Disconnection() +{ + uint16_t reasonCode = 3; // Deauthenticated because sending STA is leaving (or has left) IBSS or ESS. + + WiFiDiagnosticsServer::Instance().OnDisconnectionDetected(reasonCode); +} + +/** + * @brief Helper function to simulate an Association Failure event + */ +void SetTestEventTrigger_AssociationFailure() +{ + uint8_t associationFailureCause = + static_cast(WiFiNetworkDiagnostics::AssociationFailureCauseEnum::kAuthenticationFailed); + uint16_t status = 4; // IEEE 802.11-2020 Status Codes, AP is unable to handle additional associated STAs + + WiFiDiagnosticsServer::Instance().OnAssociationFailureDetected(associationFailureCause, status); +} + +/** + * @brief Helper function to simulate a Connection Status event + */ +void SetTestEventTrigger_ConnectionStatus() +{ + uint8_t connectionStatus = static_cast(WiFiNetworkDiagnostics::ConnectionStatusEnum::kNotConnected); + WiFiDiagnosticsServer::Instance().OnConnectionStatusChanged(connectionStatus); +} + +} // anonymous namespace + +bool HandleWiFiDiagnosticsTestEventTrigger(uint64_t eventTrigger) +{ + // Convert raw trigger to our enum + WiFiDiagnosticsTrigger trigger = static_cast(eventTrigger); + + switch (trigger) + { + case WiFiDiagnosticsTrigger::kDisconnection: + ChipLogProgress(Support, "[WiFiDiagnostics-Test-Event] => Disconnection triggered"); + SetTestEventTrigger_Disconnection(); + break; + + case WiFiDiagnosticsTrigger::kAssociationFailure: + ChipLogProgress(Support, "[WiFiDiagnostics-Test-Event] => AssociationFailure triggered"); + SetTestEventTrigger_AssociationFailure(); + break; + + case WiFiDiagnosticsTrigger::kConnectionStatus: + ChipLogProgress(Support, "[WiFiDiagnostics-Test-Event] => ConnectionStatus triggered"); + SetTestEventTrigger_ConnectionStatus(); + break; + + default: + // If we get here, the trigger value is unknown to this handler + return false; + } + + // Indicate that we handled the trigger successfully + return true; +} diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 9c442d6652e..cfe8e68f692 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:97 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:97 - Setup build environment: diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index 852673d07dd..cdcaab15651 100644 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -248,6 +248,7 @@ target_include_directories( ${chip_dir}/examples/energy-management-app/energy-management-common/energy-reporting/include ${chip_dir}/examples/all-clusters-app/ameba/main/include ${chip_dir}/examples/platform/ameba + ${chip_dir}/examples/platform/ameba/observer ${chip_dir}/examples/platform/ameba/route_hook ${chip_dir}/examples/providers ${chip_dir_output}/gen/include diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 7d06e72c094..80a98b9c3d4 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -149,6 +150,7 @@ static void InitServer(intptr_t context) initParams.appDelegate = &sAmebaObserver; initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); #if CONFIG_ENABLE_AMEBA_CRYPTO ChipLogProgress(DeviceLayer, "platform crypto enabled!"); diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn index e27884810cb..c9764e95418 100644 --- a/examples/all-clusters-app/asr/BUILD.gn +++ b/examples/all-clusters-app/asr/BUILD.gn @@ -111,6 +111,7 @@ asr_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common", "${chip_root}/examples/common/QRCode", "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/app:attribute-persistence", "${chip_root}/src/lib", "${chip_root}/src/platform/logging:default", "${chip_root}/src/setup_payload", diff --git a/examples/all-clusters-app/asr/README.md b/examples/all-clusters-app/asr/README.md index bde062feab4..6e31c18ac29 100755 --- a/examples/all-clusters-app/asr/README.md +++ b/examples/all-clusters-app/asr/README.md @@ -15,7 +15,7 @@ control on ASR platform. ## Building and Commissioning Please refer -[Building and Commissioning](../../../docs/guides/asr_getting_started_guide.md#building-the-example-application) +[Building and Commissioning](../../../docs/platforms/asr/asr_getting_started_guide.md#building-the-example-application) guides to get started ``` diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index 0a3145dbc24..8e6ef5a61d8 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -4,16 +4,16 @@ A prototype application that demonstrates device commissioning and cluster control. Please -[setup ESP-IDF and CHIP Environment](../../../docs/guides/esp32/setup_idf_chip.md) +[setup ESP-IDF and CHIP Environment](../../../docs/platforms/esp32/setup_idf_chip.md) and refer -[building and commissioning](../../../docs/guides/esp32/build_app_and_commission.md) +[building and commissioning](../../../docs/platforms/esp32/build_app_and_commission.md) guides to get started. --- - [Cluster control](#cluster-control) -- [Matter OTA guide](../../../docs/guides/esp32/ota.md) -- [RPC console and Device Tracing](../../../docs/guides/esp32/rpc_console.md) +- [Matter OTA guide](../../../docs/platforms/esp32/ota.md) +- [RPC console and Device Tracing](../../../docs/platforms/esp32/rpc_console.md) - [Multiple Network Interfaces](#multiple-network-interfaces) --- diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 31292543ca5..66e0c5b7b2b 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -16,110 +16,47 @@ # # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) # The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk -set(PRIV_INCLUDE_DIRS_LIST - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/water-heater/include" - "${CMAKE_CURRENT_LIST_DIR}/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlfaultinjection/include" + +get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) +get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(ENERGY_MANAGEMENT_COMMON_DIR ${CHIP_ROOT}/examples/energy-management-app/energy-management-common/ REALPATH) +get_filename_component(APP_COMMON_GEN_DIR ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated REALPATH) + +set(PRIV_INCLUDE_DIRS_LIST "${ALL_CLUSTERS_COMMON_DIR}/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/common/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/energy-reporting/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/water-heater/include" + "${CMAKE_CURRENT_LIST_DIR}/include" + "${CHIP_ROOT}/examples/providers" + "${CHIP_ROOT}/examples/platform/esp32" + "${CHIP_ROOT}/third_party/nlfaultinjection/include" ) -set(SRC_DIRS_LIST - "${CMAKE_CURRENT_LIST_DIR}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/water-heater/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd/server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/air-quality-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/boolean-state-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-evse-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fault-injection-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/window-covering-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/color-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-state-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/mode-select-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/mode-base-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/low-power-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/smoke-co-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/refrigerator-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/device-energy-management-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-evse-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-topology-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/resource-monitoring-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/valve-configuration-and-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-dryer-controls-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-preference-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-energy-measurement-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-power-measurement-server" +set(SRC_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}" + "${APP_COMMON_GEN_DIR}/attributes" + "${APP_COMMON_GEN_DIR}" + "${ALL_CLUSTERS_COMMON_DIR}/src" + "${ENERGY_MANAGEMENT_COMMON_DIR}/common/src" + "${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/src" + "${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src" + "${ENERGY_MANAGEMENT_COMMON_DIR}/energy-reporting/src" + "${ENERGY_MANAGEMENT_COMMON_DIR}/water-heater/src" + "${CHIP_ROOT}/examples/providers" + "${CHIP_ROOT}/examples/platform/esp32/ota" + "${CHIP_ROOT}/examples/platform/esp32/common" + "${CHIP_ROOT}/examples/platform/esp32/shell_extension" ) if (CONFIG_ENABLE_PW_RPC) # Append additional directories for RPC build set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/pw_sys_io/public" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support" + "${CHIP_ROOT}/examples/platform/esp32/pw_sys_io/public" + "${CHIP_ROOT}/examples/common" + "${CHIP_ROOT}/examples/common/pigweed" + "${CHIP_ROOT}/examples/common/pigweed/esp32" + "${CHIP_ROOT}/src/lib/support" ) if (${IDF_VERSION_MAJOR} LESS 5) @@ -129,26 +66,24 @@ else() endif() set(SRC_DIRS_LIST "${SRC_DIRS_LIST}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" + "${CHIP_ROOT}/examples/platform/esp32" + "${CHIP_ROOT}/examples/common/pigweed" + "${CHIP_ROOT}/examples/common/pigweed/esp32" ) endif (CONFIG_ENABLE_PW_RPC) if (CONFIG_ENABLE_ICD_SERVER) - list(APPEND PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/icd") - list(APPEND SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/icd") + list(APPEND PRIV_INCLUDE_DIRS_LIST "${CHIP_ROOT}/examples/platform/esp32/icd") + list(APPEND SRC_DIRS_LIST "${CHIP_ROOT}/examples/platform/esp32/icd") endif() idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST} SRC_DIRS ${SRC_DIRS_LIST}) -get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) - -include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake") - -chip_app_component_codegen("${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter") -chip_app_component_zapgen("${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap") +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) +chip_configure_data_model(${COMPONENT_LIB} + ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/all-clusters-app.zap +) set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index 2cec0c32093..72807a16186 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -26,6 +26,7 @@ menu "Demo" default DEVICE_TYPE_ESP32_C3_DEVKITM if IDF_TARGET_ESP32C3 default DEVICE_TYPE_ESP32_C2_DEVKITM if IDF_TARGET_ESP32C2 default DEVICE_TYPE_ESP32_C6_DEVKITC if IDF_TARGET_ESP32C6 + default DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD if IDF_TARGET_ESP32P4 help Specifies the type of ESP32 device. @@ -57,6 +58,9 @@ menu "Demo" config DEVICE_TYPE_ESP32_H2_DEVKITM bool "ESP32H2-DevKitM" depends on IDF_TARGET_ESP32H2 + config DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD + bool "ESP32P4 Function EV Board" + depends on IDF_TARGET_ESP32P4 endchoice choice @@ -87,7 +91,7 @@ menu "Demo" config TFT_PREDEFINED_DISPLAY_TYPE int range 0 5 - default 0 if DEVICE_TYPE_ESP32_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM + default 0 if DEVICE_TYPE_ESP32_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM || DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC default 3 if DEVICE_TYPE_M5STACK default 4 if DEVICE_TYPE_ESP32_WROVER_KIT @@ -118,7 +122,7 @@ menu "Demo" range 0 40 default 2 if DEVICE_TYPE_ESP32_DEVKITC #Use LED1 (blue LED) as status LED on DevKitC default 2 if DEVICE_TYPE_ESP32_ETHERNET_KIT - default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM + default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM || DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD default 26 if DEVICE_TYPE_ESP32_WROVER_KIT default 40 if DEVICE_TYPE_M5STACK help diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 6a0d0d389a9..7ef84346e6c 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -210,7 +210,6 @@ extern "C" void app_main() { ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed : %" CHIP_ERROR_FORMAT, error.Format()); } - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); } diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults b/examples/all-clusters-app/esp32/sdkconfig.defaults index ed9adcc7d82..4dcff1583e4 100644 --- a/examples/all-clusters-app/esp32/sdkconfig.defaults +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults @@ -19,14 +19,6 @@ # Some useful defaults for the demo app configuration. # - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 - #enable BT CONFIG_BT_ENABLED=y CONFIG_BT_NIMBLE_ENABLED=y @@ -74,3 +66,6 @@ CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC=3 + +# Enable OTA Requestor +CONFIG_ENABLE_OTA_REQUESTOR=y diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c3 b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c3 index 8d7455d0d76..62c2cb2fd57 100644 --- a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c3 +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c3 @@ -1,55 +1 @@ -# -# Copyright (c) 2020 Project CHIP Authors -# Copyright (c) 2018 Nest Labs, Inc. -# 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. -# -# Description: -# CI uses this to select the ESP32C3-DevKitM. -# CONFIG_IDF_TARGET="esp32c3" -CONFIG_IDF_TARGET_ESP32C3=y -CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM=y - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 - -#enable BT -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y - -#enable lwip ipv6 autoconfig -CONFIG_LWIP_IPV6_AUTOCONFIG=y - -# Use a custom partition table -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" - -#enable lwIP route hooks -CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y -CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y - -# Serial Flasher config -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y -CONFIG_ESPTOOLPY_FLASHSIZE="4MB" - -# Enable HKDF in mbedtls -CONFIG_MBEDTLS_HKDF_C=y - -# Move functions from IRAM to flash -CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c6 b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c6 index 29a525f2a75..5844e52c9d3 100644 --- a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c6 +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32c6 @@ -1,64 +1 @@ CONFIG_IDF_TARGET="esp32c6" - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_FLASHMODE_QIO=y -CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -CONFIG_ESPTOOLPY_FLASHFREQ="40m" -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 - -# libsodium -CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y - - -# NIMBLE -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_EXT_ADV=n -CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 -CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=y - -# Disable OpenThread -CONFIG_OPENTHREAD_ENABLED=n - -# Disable lwip ipv6 autoconfig -CONFIG_LWIP_IPV6_AUTOCONFIG=y - -# Use a custom partition table -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" - -# LwIP config for OpenThread -CONFIG_LWIP_IPV6_NUM_ADDRESSES=8 -CONFIG_LWIP_MULTICAST_PING=y - -# mbedTLS -CONFIG_MBEDTLS_HARDWARE_AES=n -CONFIG_MBEDTLS_HARDWARE_MPI=n -CONFIG_MBEDTLS_HARDWARE_SHA=n -CONFIG_MBEDTLS_HARDWARE_ECC=y -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y -CONFIG_MBEDTLS_ECJPAKE_C=y - -# MDNS platform -CONFIG_USE_MINIMAL_MDNS=y -CONFIG_ENABLE_EXTENDED_DISCOVERY=y - -# FreeRTOS should use legacy API -CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y - -# Wi-Fi Settings -CONFIG_ENABLE_WIFI_STATION=y -CONFIG_ENABLE_WIFI_AP=n -# Enable this to avoid implicit declaration of function 'esp_send_assoc_resp' -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y - -# Enable OTA Requestor -CONFIG_ENABLE_OTA_REQUESTOR=y - -# Enable chip shell -CONFIG_ENABLE_CHIP_SHELL=y diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32h2 b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32h2 index f415104a665..078b7f72439 100644 --- a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32h2 +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32h2 @@ -1,26 +1,4 @@ CONFIG_IDF_TARGET="esp32h2" -CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2=y - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_FLASHMODE_QIO=y -CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -CONFIG_ESPTOOLPY_FLASHFREQ="40m" -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 - -# libsodium -CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y - - -# NIMBLE -CONFIG_BT_ENABLED=y -CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_EXT_ADV=n -CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 -CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n # Enable OpenThread CONFIG_OPENTHREAD_ENABLED=y @@ -33,46 +11,13 @@ CONFIG_OPENTHREAD_DNS_CLIENT=y # Disable lwip ipv6 autoconfig CONFIG_LWIP_IPV6_AUTOCONFIG=n -# Use a custom partition table -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" - # LwIP config for OpenThread CONFIG_LWIP_IPV6_NUM_ADDRESSES=8 CONFIG_LWIP_MULTICAST_PING=y -# mbedTLS -CONFIG_MBEDTLS_HARDWARE_AES=n -CONFIG_MBEDTLS_HARDWARE_MPI=n -CONFIG_MBEDTLS_HARDWARE_SHA=n -CONFIG_MBEDTLS_HARDWARE_ECC=y -CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN=n -CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY=n -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_SSL_PROTO_DTLS=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y - -# rtc clk for ble -# CONFIG_ESP32H2_RTC_CLK_SRC_EXT_CRYS=y - # MDNS platform CONFIG_USE_MINIMAL_MDNS=n CONFIG_ENABLE_EXTENDED_DISCOVERY=y -# FreeRTOS should use legacy API -CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y - -# Disable STA and AP for ESP32H2 +# Disable STA for ESP32H2 CONFIG_ENABLE_WIFI_STATION=n -CONFIG_ENABLE_WIFI_AP=n -# Enable this to avoid implicit declaration of function 'esp_send_assoc_resp' -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y - -# Enable OTA Requestor -CONFIG_ENABLE_OTA_REQUESTOR=y - -# Enable chip shell -CONFIG_ENABLE_CHIP_SHELL=y - -# Enable HKDF in mbedtls -CONFIG_MBEDTLS_HKDF_C=y diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 new file mode 100644 index 00000000000..5a5709da53e --- /dev/null +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 @@ -0,0 +1,14 @@ +CONFIG_IDF_TARGET="esp32p4" + +# Enable BLE Host but use remote controller +CONFIG_BT_NIMBLE_TRANSPORT_UART=n +CONFIG_ESP_ENABLE_BT=y + +# Increase main task stack size +CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 + +# Do not deinit BLE after commissioning +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n + +# ESP32-P4 Function EV Board use ESP32C6 as slave device +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y diff --git a/examples/all-clusters-app/esp32/sdkconfig_rpc.defaults b/examples/all-clusters-app/esp32/sdkconfig_rpc.defaults new file mode 100644 index 00000000000..3faf5754c82 --- /dev/null +++ b/examples/all-clusters-app/esp32/sdkconfig_rpc.defaults @@ -0,0 +1,92 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# Copyright (c) 2024 Nest Labs, Inc. +# 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. +# +# Description: +# CI uses this to select the ESP32. +# +CONFIG_IDF_TARGET="esp32" +CONFIG_IDF_TARGET_ESP32=y + +# Default to 921600 baud when flashing and monitoring device +CONFIG_ESPTOOLPY_BAUD_921600B=y +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 + +#enable BT +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y + +#enable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=y + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# Vendor and product id +CONFIG_DEVICE_VENDOR_ID=0xFFF1 +CONFIG_DEVICE_PRODUCT_ID=0x8001 + +# Main task needs a bit more stack than the default +# default is 3584, bump this up to 5k. +CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120 + +# PW RPC Debug channel +CONFIG_EXAMPLE_UART_PORT_NUM=0 +CONFIG_EXAMPLE_UART_BAUD_RATE=115200 +CONFIG_EXAMPLE_UART_RXD=3 +CONFIG_EXAMPLE_UART_TXD=1 +CONFIG_ENABLE_PW_RPC=y + +# Disable shell +CONFIG_ENABLE_CHIP_SHELL=n + +# Serial Flasher config +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" + + +#disable Bluetooth modem sleep +#enable it may cause GPIO ISR triggers continuously +CONFIG_BTDM_CTRL_MODEM_SLEEP=n +CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG=n +CONFIG_BTDM_CTRL_LPCLK_SEL_MAIN_XTAL=n + +# Enable HKDF in mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Build chip tests +CONFIG_BUILD_CHIP_TESTS=y + +# Move functions from IRAM to flash +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y + +CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y + +# Memory Optimizations +CONFIG_NIMBLE_MAX_CONNECTIONS=1 +CONFIG_BTDM_CTRL_BLE_MAX_CONN=1 +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n + +# Reduce the event logging buffer to reduce the DRAM overflow +# TODO: [ESP32] Fix the DRAM overflow in esp32 apps #34717 +CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE=512 +CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE=512 +CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE=512 diff --git a/examples/all-clusters-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn index aeb1fa0b6fe..bc250abd5c6 100644 --- a/examples/all-clusters-app/infineon/psoc6/BUILD.gn +++ b/examples/all-clusters-app/infineon/psoc6/BUILD.gn @@ -148,6 +148,7 @@ psoc6_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common", "${chip_root}/examples/common/QRCode", "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/app:attribute-persistence", "${chip_root}/src/lib", "${chip_root}/src/platform/logging:default", "${chip_root}/src/setup_payload", diff --git a/examples/all-clusters-app/infineon/psoc6/README.md b/examples/all-clusters-app/infineon/psoc6/README.md index 138f132f7a0..b4faa2e9ea4 100644 --- a/examples/all-clusters-app/infineon/psoc6/README.md +++ b/examples/all-clusters-app/infineon/psoc6/README.md @@ -126,4 +126,4 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode. For the description of Software Update process with infineon PSoC6 example applications see -[Infineon PSoC6 OTA Software Update](../../../../docs/guides/infineon_psoc6_software_update.md) +[Infineon PSoC6 OTA Software Update](../../../../docs/platforms/infineon/infineon_psoc6_software_update.md) diff --git a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index bb499d20098..5c416f847d3 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -129,6 +130,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); chip::Server::GetInstance().Init(initParams); // We only have network commissioning on endpoint 0. diff --git a/examples/all-clusters-app/linux/AppOptions.cpp b/examples/all-clusters-app/linux/AppOptions.cpp index bd514710271..1abab56a486 100644 --- a/examples/all-clusters-app/linux/AppOptions.cpp +++ b/examples/all-clusters-app/linux/AppOptions.cpp @@ -29,14 +29,11 @@ using chip::ArgParser::OptionDef; using chip::ArgParser::OptionSet; using chip::ArgParser::PrintArgError; -constexpr uint16_t kOptionDacProviderFilePath = 0xFF01; constexpr uint16_t kOptionMinCommissioningTimeout = 0xFF02; constexpr uint16_t kOptionEndUserSupportFilePath = 0xFF03; constexpr uint16_t kOptionNetworkDiagnosticsFilePath = 0xFF04; constexpr uint16_t kOptionCrashFilePath = 0xFF05; -static chip::Credentials::Examples::TestHarnessDACProvider mDacProvider; - static chip::Optional sEndUserSupportLogFilePath; static chip::Optional sNetworkDiagnosticsLogFilePath; static chip::Optional sCrashLogFilePath; @@ -51,9 +48,6 @@ bool AppOptions::HandleOptions(const char * program, OptionSet * options, int id bool retval = true; switch (identifier) { - case kOptionDacProviderFilePath: - mDacProvider.Init(value); - break; case kOptionMinCommissioningTimeout: { auto & commissionMgr = chip::Server::GetInstance().GetCommissioningWindowManager(); commissionMgr.OverrideMinCommissioningTimeout(chip::System::Clock::Seconds16(static_cast(atoi(value)))); @@ -92,7 +86,6 @@ bool AppOptions::HandleOptions(const char * program, OptionSet * options, int id OptionSet * AppOptions::GetOptions() { static OptionDef optionsDef[] = { - { "dac_provider", kArgumentRequired, kOptionDacProviderFilePath }, { "min_commissioning_timeout", kArgumentRequired, kOptionMinCommissioningTimeout }, { "end_user_support_log", kArgumentRequired, kOptionEndUserSupportFilePath }, { "network_diagnostics_log", kArgumentRequired, kOptionNetworkDiagnosticsFilePath }, @@ -102,8 +95,6 @@ OptionSet * AppOptions::GetOptions() static OptionSet options = { AppOptions::HandleOptions, optionsDef, "PROGRAM OPTIONS", - " --dac_provider \n" - " A json file with data used by the example dac provider to validate device attestation procedure.\n" " --min_commissioning_timeout \n" " The minimum time in seconds during which commissioning session establishment is allowed by the Node.\n" " --end_user_support_log \n" @@ -117,11 +108,6 @@ OptionSet * AppOptions::GetOptions() return &options; } -chip::Credentials::DeviceAttestationCredentialsProvider * AppOptions::GetDACProvider() -{ - return &mDacProvider; -} - chip::Optional AppOptions::GetEndUserSupportLogFilePath() { return sEndUserSupportLogFilePath; diff --git a/examples/all-clusters-app/linux/AppOptions.h b/examples/all-clusters-app/linux/AppOptions.h index 69c1af83b72..735c904c045 100644 --- a/examples/all-clusters-app/linux/AppOptions.h +++ b/examples/all-clusters-app/linux/AppOptions.h @@ -20,15 +20,12 @@ #include "AppMain.h" -#include - #include class AppOptions { public: static chip::ArgParser::OptionSet * GetOptions(); - static chip::Credentials::DeviceAttestationCredentialsProvider * GetDACProvider(); static chip::Optional GetEndUserSupportLogFilePath(); static chip::Optional GetNetworkDiagnosticsLogFilePath(); static chip::Optional GetCrashLogFilePath(); diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 0e16c64c41d..30c42e6cdf5 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -56,9 +56,11 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-operational-state-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/software-diagnostics-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/wifi-diagnostics-stub.cpp", "${chip_root}/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", @@ -92,7 +94,7 @@ source_set("chip-all-clusters-common") { deps = [ "${chip_root}/examples/all-clusters-app/all-clusters-common", "${chip_root}/examples/platform/linux:app-main", - "${chip_root}/src/app/tests/suites/credentials:dac_provider", + "${chip_root}/src/app:attribute-persistence", "${chip_root}/src/lib", "${chip_root}/third_party/jsoncpp", ] diff --git a/examples/all-clusters-app/linux/ValveControlDelegate.cpp b/examples/all-clusters-app/linux/ValveControlDelegate.cpp index f161ee65eae..ed006eaa14b 100644 --- a/examples/all-clusters-app/linux/ValveControlDelegate.cpp +++ b/examples/all-clusters-app/linux/ValveControlDelegate.cpp @@ -38,7 +38,6 @@ DataModel::Nullable ValveControlDelegate::HandleOpenValve(DataMod // In this demo application, the transition is considered instant, // so current level is set to the requested level and current state is set to kOpen. currentLevel = sLevel; - Attributes::CurrentState::Set(kValveEndpoint, ValveConfigurationAndControl::ValveStateEnum::kOpen); return DataModel::Nullable(currentLevel); } @@ -48,8 +47,6 @@ CHIP_ERROR ValveControlDelegate::HandleCloseValve() sLastOpenDuration = 0; sLevel = 0; ReturnErrorOnFailure(ValveConfigurationAndControl::UpdateCurrentLevel(kValveEndpoint, sLevel)); - ReturnErrorOnFailure( - ValveConfigurationAndControl::UpdateCurrentState(kValveEndpoint, ValveConfigurationAndControl::ValveStateEnum::kClosed)); ChipLogProgress(NotSpecified, "Valve closed"); return CHIP_NO_ERROR; } diff --git a/examples/all-clusters-app/linux/args.gni b/examples/all-clusters-app/linux/args.gni index 92d01ea3358..068178d83b9 100644 --- a/examples/all-clusters-app/linux/args.gni +++ b/examples/all-clusters-app/linux/args.gni @@ -30,3 +30,5 @@ matter_log_json_payload_hex = true chip_enable_smoke_co_trigger = true chip_enable_boolean_state_configuration_trigger = true chip_enable_water_heater_management_trigger = true +chip_enable_software_diagnostics_trigger = true +chip_enable_wifi_diagnostics_trigger = true diff --git a/examples/all-clusters-app/linux/fuzzing-main.cpp b/examples/all-clusters-app/linux/fuzzing-main.cpp index 2d8422d0d2e..2b41a2517a1 100644 --- a/examples/all-clusters-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-app/linux/fuzzing-main.cpp @@ -17,6 +17,7 @@ #include "AppMain.h" #include +#include #include @@ -56,6 +57,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); ApplicationInit(); diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index b62d154f0d5..22170885db1 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -124,6 +124,7 @@ const Clusters::Descriptor::Structs::SemanticTagStruct::Type gEp3TagList[] = { { .tag = kTagSwitchesUp } }; const Clusters::Descriptor::Structs::SemanticTagStruct::Type gEp4TagList[] = { { .namespaceID = kNamespaceSwitches, .tag = kTagSwitchesDown } }; + } // namespace #ifdef MATTER_DM_PLUGIN_DISHWASHER_ALARM_SERVER @@ -256,7 +257,7 @@ void ApplicationInit() Clusters::ValveConfigurationAndControl::SetDefaultDelegate(chip::EndpointId(1), &sValveDelegate); Clusters::TimeSynchronization::SetDefaultDelegate(&sTimeSyncDelegate); - Clusters::WaterHeaterManagement::WhmApplicationInit(); + Clusters::WaterHeaterManagement::WhmApplicationInit(chip::EndpointId(1)); SetTagList(/* endpoint= */ 0, Span(gEp0TagList)); SetTagList(/* endpoint= */ 1, Span(gEp1TagList)); diff --git a/examples/all-clusters-app/linux/main.cpp b/examples/all-clusters-app/linux/main.cpp index cd1e88c87e3..2d83c132eec 100644 --- a/examples/all-clusters-app/linux/main.cpp +++ b/examples/all-clusters-app/linux/main.cpp @@ -31,8 +31,6 @@ int main(int argc, char * argv[]) ChipLinuxAppInit(argc, argv, AppOptions::GetOptions(), chip::MakeOptional(kNetworkCommissioningEndpointSecondary)) == 0); VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR); - LinuxDeviceOptions::GetInstance().dacProvider = AppOptions::GetDACProvider(); - ChipLinuxAppMainLoop(); return 0; diff --git a/examples/all-clusters-app/linux/with_pw_rpc.gni b/examples/all-clusters-app/linux/with_pw_rpc.gni index 0f1ab1ea89c..a67251431a0 100644 --- a/examples/all-clusters-app/linux/with_pw_rpc.gni +++ b/examples/all-clusters-app/linux/with_pw_rpc.gni @@ -21,8 +21,8 @@ import("${chip_root}/config/standalone/args.gni") import("//build_overrides/pigweed.gni") -pw_log_BACKEND = "$dir_pw_log_basic" -pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" pw_trace_BACKEND = "$dir_pw_trace_tokenized" pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" @@ -39,4 +39,3 @@ pw_build_LINK_DEPS = [ ] chip_enable_pw_rpc = true -chip_use_pw_logging = true diff --git a/examples/all-clusters-app/mbed/README.md b/examples/all-clusters-app/mbed/README.md index 0952e18914b..f5d0a78b290 100644 --- a/examples/all-clusters-app/mbed/README.md +++ b/examples/all-clusters-app/mbed/README.md @@ -225,7 +225,8 @@ the terminal. #### CHIP Tools -Read the [MbedCommissioning](../../../docs/guides/mbedos_commissioning.md) to +Read the +[MbedCommissioning](../../../docs/platforms/mbedos/mbedos_commissioning.md) to see how to use different CHIP tools to commission and control the application within a WiFi network. @@ -239,7 +240,7 @@ within a WiFi network. - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in - [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) + [MbedNewTarget](../../../docs/platforms/mbedos/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in `all-clusters-app/mbed/mbed_app.json`. Information about this file syntax and its meaning in mbed-os project can be found here: diff --git a/examples/all-clusters-app/mbed/main/AppTask.cpp b/examples/all-clusters-app/mbed/main/AppTask.cpp index f67876b1da5..3a6686b517a 100644 --- a/examples/all-clusters-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-app/mbed/main/AppTask.cpp @@ -72,7 +72,8 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - error = Server::GetInstance().Init(initParams); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); + error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Server initialization failed: %s", error.AsString()); diff --git a/examples/all-clusters-app/nrfconnect/README.md b/examples/all-clusters-app/nrfconnect/README.md index 3a58e448d76..4c51e52a1ff 100644 --- a/examples/all-clusters-app/nrfconnect/README.md +++ b/examples/all-clusters-app/nrfconnect/README.md @@ -43,7 +43,7 @@ This example is running on the nRF Connect platform, which is based on Nordic Semiconductor's [nRF Connect SDK](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html) and [Zephyr RTOS](https://zephyrproject.org/). Visit Matter's -[nRF Connect platform overview](../../../docs/guides/nrfconnect_platform_overview.md) +[nRF Connect platform overview](../../../docs/platforms/nrf/nrfconnect_platform_overview.md) to read more about the platform structure and dependencies. By default, the Matter accessory device has IPv6 networking disabled. You must @@ -183,7 +183,7 @@ following states are possible: **SEGGER J-Link USB port** can be used to get logs from the device or communicate with it using the -[command line interface](../../../docs/guides/nrfconnect_examples_cli.md). +[command line interface](../../../docs/platforms/nrf/nrfconnect_examples_cli.md).
@@ -379,7 +379,7 @@ depending on the selected board: those platforms support the DFU. For more information, see the -[Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) +[Configuring nRF Connect SDK examples](../../../docs/platforms/nrf/nrfconnect_examples_configuration.md) page.
@@ -414,19 +414,20 @@ to read more about flashing on the nRF52840 Dongle. ## Testing the example -Check the [CLI tutorial](../../../docs/guides/nrfconnect_examples_cli.md) to -learn how to use command-line interface of the application. +Check the [CLI tutorial](../../../docs/platforms/nrf/nrfconnect_examples_cli.md) +to learn how to use command-line interface of the application. ### Testing using Linux CHIPTool -Read the [CHIP Tool user guide](../../../docs/guides/chip_tool_guide.md) to see -how to use [CHIP Tool for Linux or mac OS](../../chip-tool/README.md) to +Read the +[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md) +to see how to use [CHIP Tool for Linux or mac OS](../../chip-tool/README.md) to commission and control the application within a Matter-enabled Thread network. ### Testing using Android CHIPTool Read the -[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md) +[Android commissioning guide](../../../docs/platforms/nrf/nrfconnect_android_commissioning.md) to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for Android smartphones to commission and control the application within a Matter-enabled Thread network. diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 067e8113c41..f0f096ffcc3 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -226,6 +227,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); @@ -487,10 +489,10 @@ void AppTask::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* arg */ switch (event->Type) { case DeviceEventType::kCHIPoBLEAdvertisingChange: -#ifdef CONFIG_CHIP_NFC_COMMISSIONING +#ifdef CONFIG_CHIP_NFC_ONBOARDING_PAYLOAD if (event->CHIPoBLEAdvertisingChange.Result == kActivity_Started) { - if (NFCMgr().IsTagEmulationStarted()) + if (NFCOnboardingPayloadMgr().IsTagEmulationStarted()) { LOG_INF("NFC Tag emulation is already started"); } @@ -501,7 +503,7 @@ void AppTask::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* arg */ } else if (event->CHIPoBLEAdvertisingChange.Result == kActivity_Stopped) { - NFCMgr().StopTagEmulation(); + NFCOnboardingPayloadMgr().StopTagEmulation(); } #endif sHaveBLEConnections = ConnectivityMgr().NumBLEConnections() != 0; diff --git a/examples/all-clusters-app/nrfconnect/main/main.cpp b/examples/all-clusters-app/nrfconnect/main/main.cpp index 400f9b30e0d..77d7bd785f9 100644 --- a/examples/all-clusters-app/nrfconnect/main/main.cpp +++ b/examples/all-clusters-app/nrfconnect/main/main.cpp @@ -33,9 +33,9 @@ static int InitUSB() { int err = usb_enable(nullptr); - if (err) + if ((err != 0) && (err != -EALREADY)) { - LOG_ERR("Failed to initialize USB device"); + LOG_ERR("Failed to initialize USB device %d", err); return err; } diff --git a/examples/all-clusters-app/nrfconnect/prj.conf b/examples/all-clusters-app/nrfconnect/prj.conf index 5917c3a9c7a..075fdd8e9d8 100644 --- a/examples/all-clusters-app/nrfconnect/prj.conf +++ b/examples/all-clusters-app/nrfconnect/prj.conf @@ -54,3 +54,6 @@ CONFIG_CHIP_QSPI_NOR=n # Enable the Read Client for binding purposes CONFIG_CHIP_ENABLE_READ_CLIENT=y + +# Increase the settings partition +CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000 diff --git a/examples/all-clusters-app/nxp/common/main/AppTask.cpp b/examples/all-clusters-app/nxp/common/main/AppTask.cpp index 0b945d49561..702a63e89b5 100644 --- a/examples/all-clusters-app/nxp/common/main/AppTask.cpp +++ b/examples/all-clusters-app/nxp/common/main/AppTask.cpp @@ -40,6 +40,9 @@ void AllClustersApp::AppTask::PostInitMatterStack() void AllClustersApp::AppTask::PostInitMatterServerInstance() { +#ifdef APP_BT_DEVICE_NAME + chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName(APP_BT_DEVICE_NAME); +#endif // Disable last fixed endpoint, which is used as a placeholder for all of the // supported clusters so that ZAP will generated the requisite code. emberAfEndpointEnableDisable(emberAfEndpointFromIndex(static_cast(emberAfFixedEndpointCount() - 1)), false); diff --git a/examples/all-clusters-app/nxp/common/main/main.cpp b/examples/all-clusters-app/nxp/common/main/main.cpp index b2aadab98ce..26772e9e600 100644 --- a/examples/all-clusters-app/nxp/common/main/main.cpp +++ b/examples/all-clusters-app/nxp/common/main/main.cpp @@ -32,7 +32,7 @@ uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE]; using namespace ::chip::DeviceLayer; -extern "C" int main(int argc, char * argv[]) +int main(int argc, char * argv[]) { TaskHandle_t taskHandle; diff --git a/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md b/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md index e20ff1065d3..01941f58e74 100644 --- a/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md +++ b/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md @@ -1,4 +1,4 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) +[README document](../../../../../docs/platforms/nxp/nxp_imx8m_linux_examples.md) for details. diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index 89ba7f24971..73ea8cc0202 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -64,6 +64,7 @@ mw320_executable("shell_mw320") { ] deps = [ + "${chip_root}/src/app:attribute-persistence", "${chip_root}/src/platform:syscalls_stub", "${chip_root}/src/platform/logging:default", ] diff --git a/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h index 5e4a6b1e4f5..d39e2dc0c03 100644 --- a/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nxp/mw320/include/CHIPProjectConfig.h @@ -143,15 +143,6 @@ */ #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/all-clusters-app/nxp/mw320/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index 82d335cccbb..a828706b0fa 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -1068,6 +1069,7 @@ static void run_chip_srv(System::Layer * aSystemLayer, void * aAppState) static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); chip::Server::GetInstance().Init(initParams); PRINTF("Done to call chip::Server() \r\n"); } diff --git a/examples/all-clusters-app/nxp/rt/rt1060/.gn b/examples/all-clusters-app/nxp/rt/rt1060/.gn new file mode 100644 index 00000000000..0985ed955a4 --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1060/.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_cpu = "arm" + target_os = "freertos" + + import("//args.gni") + + # Import common example GN args + import("${chip_root}/examples/platform/nxp/common/gn/args.gni") + + # Import default platform configs + import("${chip_root}/src/platform/nxp/rt/rt1060/args.gni") +} diff --git a/examples/all-clusters-app/nxp/rt/rt1060/BUILD.gn b/examples/all-clusters-app/nxp/rt/rt1060/BUILD.gn new file mode 100644 index 00000000000..d5a4936a48f --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1060/BUILD.gn @@ -0,0 +1,288 @@ +# Copyright (c) 2021-2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/openthread.gni") +import("${chip_root}/src/platform/device.gni") + +#allows to get common NXP SDK gn options +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +# Allows to get various RT gn options +import("${nxp_sdk_build_root}/${nxp_sdk_name}/rt_sdk.gni") + +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") +import( + "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}/${rt_platform}.gni") +import("${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_executable.gni") + +assert(current_os == "freertos") +assert(target_os == "freertos") +assert(nxp_platform == "rt/rt1060") + +declare_args() { + # Allows to enable to ota_provider support + enable_ota_provider = false + + # Allows to connect to a predefine Wi-Fi network at boot + wifi_auto_connect_at_boot = false + wifi_auto_connect_at_boot_ssid = "" + wifi_auto_connect_at_boot_password = "" + + # Setup discriminator as argument + setup_discriminator = 3840 +} + +example_platform_dir = + "${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}" +common_example_dir = "${chip_root}/examples/platform/nxp/common" + +app_common_folder = "all-clusters-app/all-clusters-common" + +# Create here the SDK instance. +# Particular sources/defines/includes could be added/changed depending on the target application. +rt_sdk("sdk") { + defines = [] + + cflags = [] + public_deps = [] + public_configs = [] + sources = [] + include_dirs = [] + + # Indicate paths to default board files + include_dirs += [ "${example_platform_dir}/board/" ] + + # RT1060 rev A use same pin mux as rev B + # If user needs different pin mux files for rev A and rev B boards, the source and include from below needs to be updated accordingly + if (evkname == "evkmimxrt1060") { + include_dirs += [ "${example_platform_dir}/board/evkbmimxrt1060/" ] + sources += [ "${example_platform_dir}/board/evkbmimxrt1060/pin_mux.c" ] + } else { + include_dirs += [ "${example_platform_dir}/board/${evkname}/" ] + sources += [ "${example_platform_dir}/board/${evkname}/pin_mux.c" ] + } + + sources += [ "${example_platform_dir}/board/hardware_init.c" ] + sources += [ "${example_platform_dir}/board/clock_config.c" ] + sources += [ "${example_platform_dir}/board/board.c" ] + sources += [ "${example_platform_dir}/board/peripherals.c" ] + + # Indicate the path to CHIPProjectConfig.h + include_dirs += [ "include/config" ] + + # Indicate the default path to FreeRTOSConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/freeRTOS" ] + + # Indicate the default path to OpenThreadConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/openthread" ] + + # For matter with BR feature, increase FreeRTOS heap size + if (chip_enable_wifi && chip_enable_openthread) { + defines += [ "configTOTAL_HEAP_SIZE=(size_t)(170 * 1024)" ] + } + + defines += [ + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", + ] +} + +# Create the SDK driver instance. +# Particular sources/defines/includes could be added to add other drivers not available in the default sdk driver template +rt1060_sdk_drivers("sdk_driver") { +} + +rt_executable("all_cluster_app") { + output_name = "chip-rt1060-all-cluster-example" + + defines = [ + "CONFIG_RENDEZVOUS_MODE=7", + "CONFIG_APP_FREERTOS_OS=1", + ] + + if (chip_enable_openthread) { + defines += [ "CONFIG_NET_L2_OPENTHREAD=1" ] + } + + include_dirs = [ + "../../common/main/include", + "../../common/main", + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/providers/", + ] + + sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", + "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", + "../../common/main/AppTask.cpp", + "../../common/main/DeviceCallbacks.cpp", + "../../common/main/ZclCallbacks.cpp", + "../../common/main/include/AppEvent.h", + "../../common/main/include/AppTask.h", + "../../common/main/include/DeviceCallbacks.h", + "../../common/main/main.cpp", + ] + + # App common files + include_dirs += [ + "${common_example_dir}/icd/include", + "${common_example_dir}/matter_cli/include", + "${common_example_dir}/device_manager/include", + "${common_example_dir}/device_callbacks/include", + "${common_example_dir}/matter_button/include", + "${common_example_dir}/factory_data/include", + "${common_example_dir}/app_task/include", + ] + + sources += [ + "${chip_root}/examples/platform/nxp/${nxp_platform}/factory_data/source/AppFactoryDataExample.cpp", + "${common_example_dir}/app_task/source/AppTaskBase.cpp", + "${common_example_dir}/app_task/source/AppTaskFreeRTOS.cpp", + "${common_example_dir}/device_callbacks/source/CommonDeviceCallbacks.cpp", + "${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp", + "${common_example_dir}/icd/source/ICDUtil.cpp", + "${common_example_dir}/matter_button/source/ButtonDefault.cpp", + "${common_example_dir}/matter_button/source/ButtonManager.cpp", + "${common_example_dir}/matter_button/source/ButtonRegistrationDefault.cpp", + ] + + deps = [ "${chip_root}/examples/${app_common_folder}" ] + + sources += [ + "${chip_root}/examples/${app_common_folder}/src/bridged-actions-stub.cpp", + "${chip_root}/examples/${app_common_folder}/src/smco-stub.cpp", + "${chip_root}/examples/${app_common_folder}/src/static-supported-modes-manager.cpp", + ] + + if (nxp_enable_matter_cli) { + defines += [ "ENABLE_CHIP_SHELL" ] + deps += [ + "${chip_root}/examples/shell/shell_common:shell_common", + "${chip_root}/src/lib/shell:shell", + ] + sources += [ + "${common_example_dir}/matter_cli/source/AppCLIBase.cpp", + "${common_example_dir}/matter_cli/source/AppCLIFreeRTOS.cpp", + ] + } + + if (chip_enable_ota_requestor) { + include_dirs += [ "${common_example_dir}/ota_requestor/include" ] + sources += [ + "${common_example_dir}/ota_requestor/source/OTARequestorInitiator.cpp", + "${common_example_dir}/ota_requestor/source/OTARequestorInitiatorCommon.cpp", + ] + } + + if (wifi_auto_connect_at_boot) { + assert(wifi_auto_connect_at_boot_ssid != "" && + wifi_auto_connect_at_boot_password != "", + "WiFi SSID and password must be specified at build time!") + + defines += [ + "CONFIG_CHIP_APP_WIFI_CONNECT_AT_BOOT=1", + "CONFIG_CHIP_APP_WIFI_SSID=\"${wifi_auto_connect_at_boot_ssid}\"", + "CONFIG_CHIP_APP_WIFI_PASSWORD=\"${wifi_auto_connect_at_boot_password}\"", + ] + + include_dirs += [ "${common_example_dir}/wifi_connect/include" ] + sources += [ "${common_example_dir}/wifi_connect/source/WifiConnect.cpp" ] + } + + if (enable_ota_provider) { + defines += [ "CONFIG_CHIP_OTA_PROVIDER=1" ] + + include_dirs += [ + "${common_example_dir}/ota_provider/include", + "${common_example_dir}/ota_provider/ota-provider-common", + ] + + sources += [ + "${common_example_dir}/ota_provider/ota-provider-common/RTBdxOtaSender.cpp", + "${common_example_dir}/ota_provider/ota-provider-common/RTOTAProviderExample.cpp", + "${common_example_dir}/ota_provider/source/OTAProvider.cpp", + ] + + deps += [ + "${chip_root}/src/app/server", + "${chip_root}/src/protocols/bdx", + "${chip_root}/third_party/jsoncpp", + ] + } + + if (chip_enable_ble) { + defines += [ "APP_BT_DEVICE_NAME=\"NXP-AllClustersApp\"" ] + } + + # In case a dedicated assert function needs to be supported the flag sdk_fsl_assert_support should be set to false + # The would add to the build a dedicated application assert implementation. + if (!sdk_fsl_assert_support) { + sources += [ "${common_example_dir}/app_assert/source/AppAssert.cpp" ] + } + + cflags = [ "-Wconversion" ] + + ldscript = + "${example_platform_dir}/app/ldscripts/MIMXRT1062xxxxx_flexspi_nor.ld" + + inputs = [ ldscript ] + + ldflags = [ + "-T" + rebase_path(ldscript, root_build_dir), + "-fno-common", + "-Wl,--defsym=__stack_size__=2048", + "-ffreestanding", + "-fno-builtin", + "-mapcs", + "-u qspiflash_config", + "-u image_vector_table", + "-u boot_data", + "-u dcd_data", + "-Wl,-print-memory-usage", + "-Wl,--no-warn-rwx-segments", + ] + + if (evkname == "evkcmimxrt1060") { + ldflags += [ "-Wl,--defsym=gEVKCFlashSize_d=0x1000000" ] + } + + if (enable_ota_provider) { + # As the OTA file will be stored in the littlefs file system, it is required to increase the size of the file system + # To be able to store an OTA file with a MAX size of 640K, + # it recommended to size the file system with: + # 161 sectors of 4K => reserved for the OTA file + # 32 sectors of 4K => reserved for Matter/OT/BLE settings storage + ldflags += [ "-Wl,--defsym=gNVMSectorCountLink_d=193" ] + } + + if (chip_enable_ota_requestor) { + # If OTA build flag is enabled, + # we would need to reserve enough space for the bootloader (MCUBoot) + # MCUBoot requires 0x11000 Bytes to be reserved at the base of the flash + # Consequently, some sections will need to be shifted + ldflags += [ "-Wl,--defsym=__m_mcuboot_size__=0x40000" ] + } + + output_dir = root_out_dir +} + +group("rt1060") { + deps = [ ":all_cluster_app" ] +} + +group("default") { + deps = [ ":rt1060" ] +} diff --git a/examples/all-clusters-app/nxp/rt/rt1060/README.md b/examples/all-clusters-app/nxp/rt/rt1060/README.md new file mode 100644 index 00000000000..3ddcbd7c853 --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1060/README.md @@ -0,0 +1,723 @@ +# CHIP RT1060 All-clusters Application + +The all-clusters example implements a server which can be accessed by a CHIP +controller and can accept basic cluster commands. + +The example is based on +[Project CHIP](https://github.com/project-chip/connectedhomeip) and the NXP +RT1060 SDK, and provides a prototype application that demonstrates device +commissioning and different cluster control. + +
+ +- [CHIP RT1060 All-clusters Application](#chip-rt1060-all-clusters-application) + - [Introduction](#introduction) + - [Configurations supported](#configurations-supported) + - [Hardware requirements RT1060 + transceiver](#hardware-requirements-rt1060--transceiver) + - [Hardware requirements RT1060+IW416](#hardware-requirements-rt1060iw416) + - [Hardware requirements RT1060+88W8801](#hardware-requirements-rt106088w8801) + - [Hardware requirements RT1060 + K32W0](#hardware-requirements-rt1060--k32w0) + - [Hardware requirements RT1060-EVK-C+IW612](#hardware-requirements-rt1060-evk-ciw612) + - [Hardware requirements RT1060 + 88W8801 + K32W0x1DK6](#hardware-requirements-rt1060--88w8801--k32w0x1dk6) + - [Building](#building) + - [Building with Matter over Wifi configuration on RT1060 + transceiver](#building-with-matter-over-wifi-configuration-on-rt1060--transceiver) + - [Build with Matter over Thread configuration on RT1060 + transceiver](#build-with-matter-over-thread-configuration-on-rt1060--transceiver) + - [Build with Matter over Thread configuration on RT1060 + K32W0](#build-with-matter-over-thread-configuration-on-rt1060--k32w0) + - [Build with Matter over Thread configuration on RT1060-EVK-C + IW612](#build-with-matter-over-thread-configuration-on-rt1060-evk-c--iw612) + - [Build with Matter over Wi-Fi + OpenThread Border Router configuration on RT1060 + 88W8801 + K32W0x1DK6](#build-with-matter-over-wi-fi--openthread-border-router-configuration-on-rt1060--88w8801--k32w0x1dk6) + - [General Information](#general-information) + - [Manufacturing data](#manufacturing-data) + - [Flashing and debugging](#flashing-and-debugging) + - [Testing the example](#testing-the-example) + - [Matter over wifi configuration :](#matter-over-wifi-configuration-) + - [Matter over thread configuration :](#matter-over-thread-configuration-) + - [Matter over wifi with openthread border router configuration :](#matter-over-wifi-with-openthread-border-router-configuration-) + - [Testing the all-clusters application without Matter CLI:](#testing-the-all-clusters-application-without-matter-cli) + - [Testing the all-clusters application with Matter CLI enabled:](#testing-the-all-clusters-application-with-matter-cli-enabled) + - [Thread Border Router overview](#thread-border-router-overview) +
+ + + +## Introduction + +![RT1060 EVK-B](../../../../platform/nxp/rt/rt1060/doc/images/MIMXRT1060-EVKB-TOP.png) + +The RT1060 all-cluster application provides a working demonstration of the +RT1060 board integration, built using the Project CHIP codebase and the NXP +RT1060 SDK. + +The example supports: + +- Matter over Wi-Fi +- Matter over Openthread +- Matter over Wi-Fi with Openthread Border Router support + +The example targets the +[NXP MIMXRT1060-EVK-B](https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/mimxrt1060-evk-i-mx-rt1060-evaluation-kit:MIMXRT1060-EVK) +board by default. It is also possible to use the older MIMXRT1060-EVK board, +build and board setup instructions differ in some steps. + +### Configurations supported + +Here are listed configurations supported on RT1060. + +Matter over Wi-Fi : + +- RT1060 + IW416 (Wi-Fi + BLE) +- RT1060 + 88W8801 (Wi-Fi) +- **Experimental:** _RT1060-EVK-C + IW612 (Wi-fi +BLE)_ + +Matter over Thread : + +- RT1060 + K32W0 (15.4 + BLE) +- **Experimental:** _RT1060-EVK-C + IW612 (15.4 + BLE)_ + +Matter over Wi-Fi with Openthread Border Router support : + +- RT1060 + 88W8801 + K32W0x1DK6 + +### Hardware requirements RT1060 + transceiver + +#### Hardware requirements RT1060+IW416 + +Host part: + +- 1 MIMXRT1060-EVK-B or MIMXRT1060-EVK board +- external 5V supply + +Transceiver part: + +- 1 AzureWave AW-AM510-uSD evaluation board + +Jumper settings for MIMXRT1060-EVK-B (enables external 5V supply): + +- remove J40 5-6 +- connect J40 1-2 +- connect J45 with external power (controlled by SW6 - position 3) + +Jumper settings for MIMXRT1060-EVK (enables external 5V supply): + +- remove J1 5-6 +- connect J1 1-2 +- connect J2 with external power (enabled by SW1 - position 3) + +The hardware should be reworked according to the chapter _Hardware Rework Guide +for MIMXRT1060-EVK-B and AW-AM510-uSD_ or the chapter _Hardware Rework Guide for +MIMXRT1060-EVK and AW-AM510-uSD_ in the document +_`Hardware Rework Guide for EdgeFast BT PAL`_ which can be found in the NXP +RT1060 SDK (_docs/wireless/bluetooth/`edgefast_bluetooth`/Hardware Rework Guide +for EdgeFast BT PAL.pdf_): + +- Make sure resistors R368/R376/R347/R349/R365/R363/R193/R186 are removed. + +Only the SDK package downloaded from https://mcuxpresso.nxp.com contains the PDF +document mentioned above, it is not present in the SDK downloaded from GitHub +using the west tool. + +Jumper settings for AzureWave AW-AM510-uSD Module: + +- J4 1-2: `VIO` 1.8V (Voltage level of SD-IO pins is 1.8V) +- J2 1-2: 3.3V `VIO_uSD` (Power Supply from uSD connector) +- The pin 1 of J4 is not marked on the board. Please note that pin numbering + of J4 is opposite to J2. + +Plug AW-AM510-uSD into uSD connector J22 on MIMXRT1060-EVK-B or J39 on +MIMXRT1060-EVK. + +Connect the following pins between RT1060 and AW-AM510-uSD to enable Bluetooth +HCI UART: + +| PIN NAME | AW-AM510-uSD | MIMXRT1060-EVK-B | MIMXRT1060-EVK | PIN NAME OF RT1060 | GPIO NAME OF RT1060 | +| :--------: | :-----------: | :--------------: | :------------: | :----------------: | :-----------------: | +| `UART_TXD` | `J10 (pin 4)` | `J16 (pin 1)` | `J22 (pin 1)` | `LPUART3_RXD` | `GPIO_AD_B1_07` | +| `UART_RXD` | `J10 (pin 2)` | `J16 (pin 2)` | `J22 (pin 2)` | `LPUART3_TXD` | `GPIO_AD_B1_06` | +| `UART_RTS` | `J10 (pin 6)` | `J33 (pin 3)` | `J23 (pin 3)` | `LPUART3_CTS` | `GPIO_AD_B1_04` | +| `UART_CTS` | `J10 (pin 8)` | `J33 (pin 4)` | `J23 (pin 4)` | `LPUART3_RTS` | `GPIO_AD_B1_05` | +| `GND` | `J6 (pin 7)` | `J32 (pin 7)` | `J25 (pin 7)` | `GND` | `GND` | + +Attach external antenna into connector on AW-AM510-uSD. + +Additional information about the AW-AM510-uSD can be found in the user manual +_UM11441 - Getting Started with NXP-based Wireless Modules and i.MX RT Platform +Running RTOS_, which can be found in the NXP RT1060 SDK +(docs/wireless/UM11441-Getting-Started-with-NXP-based-Wireless-Modules-and-i.MX-RT-Platform-Running-on-RTOS.pdf). +Only the SDK package downloaded from https://mcuxpresso.nxp.com contains the PDF +document, it is not present in the SDK downloaded from GitHub using the west +tool. + +#### Hardware requirements RT1060+88W8801 + +Host part: + +- 1 MIMXRT1060-EVK-B + +Transceiver part : + +- 1 88W8801 2DS M.2 Module (rev A) +- 1 Murata uSD-M.2 Adapter (rev B1) + +The 88W8801 2DS M.2 Module should be inserted into the Murata uSD-M.2 Adapter +and inserted in the uSD slot J22 of MIMXRT1060-EVK-B. The Murata uSD-M.2 Adapter +can be powered up using uSD pins. For that, set the J1 jumper of Murata uSD-M.2 +to position 2-3 (Position 2-3: `VBAT supply`, typical 3.1 ~ 3.3V, from microSD +connector). + +Note: as the 88W8801 module supports only the 2.4 GHz Wi-Fi band, it is +mandatory to connect it to a Wi-Fi access point on the 2.4 GHz band. + +#### Hardware requirements RT1060 + K32W0 + +Host part: + +- 1 MIMXRT1060-EVK-B or MIMXRT1060-EVK board + +Transceiver part: + +- 1 OM15076-3 Carrier Board (DK6 board) +- 1 K32W0 Module to be plugged on the Carrier Board + +**Board settings** + +The below table explains pin settings (UART settings) to connect the +MIMXRT1060-EVK-B (host) to a k32w061 transceiver (rcp). + +| PIN NAME | DK6 (K32W061) | MIMXRT1060-EVK-B | MIMXRT1060-EVK | PIN NAME OF RT1060 | GPIO NAME OF RT1060 | +| :--------------: | :-----------: | :--------------: | :------------: | :----------------: | :-----------------: | +| `UART_TXD` | `PIO, pin 8` | `J16, pin 1` | `J22, pin 1` | `LPUART3_RXD` | `GPIO_AD_B1_07` | +| `UART_RXD` | `PIO, pin 9` | `J16, pin 2` | `J22, pin 2` | `LPUART3_TXD` | `GPIO_AD_B1_06` | +| `UART_RTS` | `PIO, pin 6` | `J33, pin 3` | `J23, pin 3` | `LPUART3_CTS` | `GPIO_AD_B1_04` | +| `UART_CTS` | `PIO, pin 7` | `J33, pin 4` | `J23, pin 4` | `LPUART3_RTS` | `GPIO_AD_B1_05` | +| `GND` | `J3, pin 1` | `J32, pin 7` | `J25, pin 7` | `XX` | `XX` | +| `RESET` | `RSTN` | `J33, pin 2` | `J23, pin 2` | `GPIO_AD_B1_11` | `GPIO_AD_B1_11` | +| `DIO5/ISP Entry` | `PIO, pin 5` | `J33, pin 1` | `J23, pin 1` | `GPIO_AD_B1_10` | `GPIO_AD_B1_10` | + +The below picture shows pins connections for the MIMXRT1060-EVK. + +![rt1060_k32w061_pin_settings](../../../../platform/nxp/rt/rt1060/doc/images/rt1060_k32w061_pin_settings.jpg) + +#### Hardware requirements RT1060-EVK-C+IW612 + +Host part: + +- 1 MIMXRT1060-EVK-C + + Hardware should be reworked as below: + + - populate R93, R96, R2155, R2156, R2157, R2158, R2159 with 0Ohm resistors + - J76 and J107 jumpers in 2-3 position. + - J109 and J110 jumpers in 1-2 position. + - disconnect pin15 of component U9 + +![rt1060_evkc_IW612_hw_rework](../../../../platform/nxp/rt/rt1060/doc/images/rt1060_evkc_IW612_hw_rework.jpg) + +![rt1060_evkc_IW612_hw_rework_detail](../../../../platform/nxp/rt/rt1060/doc/images/rt1060_evkc_IW612_hw_rework_detail.jpg) + +Transceiver part : + +- 1 + [2EL M2 A1 IW612 Secure Module](https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth-plus-802-15-4/2-4-5-ghz-dual-band-1x1-wi-fi-6-802-11ax-plus-bluetooth-5-2-plus-802-15-4-tri-radio-solution:IW612) + +![](../../../../platform/nxp/rt/rt1170/doc/images/iwx612_2EL.jpg) + +#### Hardware requirements RT1060 + 88W8801 + K32W0x1DK6 + +- i.MX RT1060 EVK-A or EVK-B board +- 88W8801 module (for Wi-Fi connection), for example 88W8801 2DS M.2 Module + (rev A) and Murata uSD-M.2 Adapter (rev B1) +- K32W0x1 mezzanine module (for Thread connection) +- `IOT_ZTB-DK006` carrier board for the K32W0x1 module (referenced as DK6 + carrier board) + + + +## Building + +In order to build the Project CHIP example, we recommend using a Linux +distribution. Supported Operating Systems are listed in +[BUILDING.md](../../../../../docs/guides/BUILDING.md). + +- Make sure that below prerequisites are correctly installed, as described in + [BUILDING.md](../../../../../docs/guides/BUILDING.md). + +``` +sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \ + libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ + python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev +``` + +- Step 1: checkout NXP specific submodules only + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive +``` + +- Step 2: activate local environment + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh +``` + +If the script says the environment is out of date, you can update it by running +the following command: + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh +``` + +- Step 3: Init NXP SDK(s) + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ third_party/nxp/nxp_matter_support/scripts/update_nxp_sdk.py --platform common +``` + +Note: By default update_nxp_sdk.py will try to initialize all NXP SDKs. Arg "-- +help" could be used to view all available options. + +- Start building the application. + +### Building with Matter over Wifi configuration on RT1060 + transceiver + +- Build the Wi-fi configuration for **MIMXRT1060-EVK-B board + IW416 + transceiver** (with BLE for commissioning). + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_wifi=true iw416_transceiver=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +- Build the Wi-fi configuration for **MIMXRT1060-EVK-B board + 88W8801 + transceiver** with Matter-over-Wifi configuration and only onnetwork + commissioning (without BLE, the WiFi network credentials are provided at + build-time which will enable the device to join the Wi-Fi AP at startup): + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ export ssid_name= && export ssid_password= && gn gen --args="chip_enable_wifi=true w8801_transceiver=true chip_config_network_layer_ble=false wifi_auto_connect_at_boot=true wifi_auto_connect_at_boot_ssid=\"${ssid_name}\" wifi_auto_connect_at_boot_password=\"${ssid_password}\"" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +- Build the Wi-fi configuration for **MIMXRT1060-EVK-C board + IW612 + transceiver** (with BLE for commissioning). + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_wifi=true iwx12_transceiver=true evkname=\"evkcmimxrt1060\" " out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +- Build the Wi-fi configuration for **MIMXRT1060-EVK-C board + IW612 + transceiver** with Matter-over-Wifi configuration and only onnetwork + commissioning (without BLE, the WiFi network credentials are provided at + build-time which will enable the device to join the Wi-Fi AP at startup): + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ export ssid_name= && export ssid_password= && gn gen --args="chip_enable_wifi=true iwx12_transceiver=true evkname=\"evkcmimxrt1060\" chip_config_network_layer_ble=false wifi_auto_connect_at_boot=true wifi_auto_connect_at_boot_ssid=\"${ssid_name}\" wifi_auto_connect_at_boot_password=\"${ssid_password}\"" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +### Build with Matter over Thread configuration on RT1060 + transceiver + +#### Build with Matter over Thread configuration on RT1060 + K32W0 + +For this configuration a K32W0 RCP image is required and must support in a +single image the openthread RCP configuration and the BLE HCI BB configuration. +Messages between the host and the K32W0 transceiver are transferred on a single +UART with flow control support. For that the HDLC-Lite framing protocol is used +to transfer spinel and hci frames. In addition, hci and spinel frames can be +distinguished by using the Spinel convention which is line compatible with +BT/BLE HCI. + +Before building the Matter host application, it is required to generate the +K32W0 image supporting features as described above. To build this binary the +target `ot_rcp_ble_hci_bb_single_uart_fc` should be built by following the +[Readme.md][ot_rcp_ble_hci_bb_k32w0_readme]. After a successful build, a `".h"` +file will be generated and would contain the K32W0 RCP binary. As described in +the [Readme.md][ot_rcp_ble_hci_bb_k32w0_readme], the application binaries will +be generated in +`ot_nxp/build_k32w061/ot_rcp_ble_hci_bb_single_uart_fc/bin/ot-rcp-ble-hci-bb-k32w061.elf.bin.h`. + +The generate K32W0 transceiver binary `".h"` file path must be indicated to the +host Matter application build. In fact the Matter host application is in charge +of storing the K32W0 firmware in its flash to be able to use the +`The Over The Wire (OTW) protocol (over UART)` to download (at host startup) the +k32w0 transceiver image from the host to the K32W0 internal flash. For more +information on the k32w0 `OTW` protocol, user can consult the doxygen header of +the file located in +`/third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/middleware/wireless/framework/OTW/k32w0_transceiver/fwk_otw.c`. + +Here is a summary of the k32w0 _gn gen_ arguments that are mandatory or +optional: + +- Mandatory: `k32w0_transceiver=true` +- Mandatory: `hci_spinel_single_uart=true` +- Optional: + `k32w0_transceiver_bin_path=\"/home/ot-nxp/build_k32w061/ot_rcp_ble_hci_bb_single_uart_fc/bin/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\"` + This argument is optional, by default, if not set, the binary file located + in + "\${chip_root}/third_party/openthread/ot_nxp/build_k32w061/ot_rcp_ble_hci_bb_single_uart_fc/bin/ot-rcp-ble-hci-bb-k32w061.elf.bin.h" + will be used. If the K32W061 transceiver binary is saved at another location + an absolute path of its location should be given. +- Optional: `otw_logs_enabled=true` This argument is optional, by default + being set to false. If set to true, RT logging will print the `OTW` logs. + +[ot_rcp_ble_hci_bb_k32w0_readme]: + https://github.com/NXP/ot-nxp/blob/v1.0.0.2-tag-nxp/examples/hybrid/ot_rcp_ble_hci_bb/k32w061/README.md#building-the-examples + +Below is presented an example of _gn gen_ argument that could be used to +generate the host matter application with a k32w0 transceiver. + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_openthread=true k32w0_transceiver=true k32w0_transceiver_bin_path=\"/home/ot-nxp/build_k32w061/ot_rcp_ble_hci_bb_single_uart_fc/bin/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\" hci_spinel_single_uart=true chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +#### Build with Matter over Thread configuration on RT1060-EVK-C + IW612 + +Build the OpenThread configuration for MIMXRT1060-EVK-C board + IW612 +transceiver (with BLE for commissioning). + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_openthread=true iwx12_transceiver=true evkname=\"evkcmimxrt1060\" chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=true" " out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +### Build with Matter over Wi-Fi + OpenThread Border Router configuration on RT1060 + 88W8801 + K32W0x1DK6 + +This configuration supports the Thread Border Router management cluster to +provision the Thread credentials. Enabling the Matter CLI in order to control +the Thread network on the Border Router is optional but recommended for other +features like the Thread credential sharing. + +Note that the Thread Border Router management cluster is only supported on the +thermostat application for now. + +- Build Matter with Border Router configuration with ble-wifi commissioning: + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ gn gen --args="chip_enable_wifi=true w8801_transceiver=true nxp_enable_matter_cli=true chip_config_network_layer_ble=true chip_enable_openthread=true k32w0_transceiver=true k32w0_transceiver_bin_path=\"/path/to/ot-rcp/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\" hci_spinel_single_uart=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +- Build Matter with Border Router configuration with onnetwork commissioning: + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ export ssid_name= && export ssid_password= && gn gen --args="chip_enable_wifi=true w8801_transceiver=true nxp_enable_matter_cli=true chip_config_network_layer_ble=false wifi_auto_connect_at_boot=true wifi_auto_connect_at_boot_ssid=\"${ssid_name}\" wifi_auto_connect_at_boot_password=\"${ssid_password}\" chip_enable_openthread=true k32w0_transceiver=true k32w0_transceiver_bin_path=\"/path/to/ot-rcp/ot-rcp-ble-hci-bb-k32w061.elf.bin.h\"" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1060$ ninja -C out/debug +``` + +### General Information + +The resulting output file can be found in +out/debug/chip-rt1060-all-cluster-example. + +Optional GN options that can be added when building an application: + +- To enable the + [secondary network commissioning interface](../../../../../docs/platforms/nxp/nxp_otbr_guide.md#using-the-secondary-network-commissioning-interface), + the arguments `chip_enable_secondary_nwk_if=true` and + `chip_device_config_thread_network_endpoint_id=3` must be added to the _gn + gen_ command. Note that this is only supported when building the Matter over + Wifi + OpenThread Border Router configuration. Note that is only supported + on the on the thermostat application for now. +- To enable the [matter CLI](README.md#matter-shell), the argument + `nxp_enable_matter_cli=true` must be added to the _gn gen_ command. +- To build the application in debug mode, the argument + `is_debug=true optimize_debug=false` must be added to the _gn gen_ command. +- By default, the MIMXRT1060-EVK-B will be chosen. To switch to an + MIMXRT1060-EVK, the argument `evkname=\"evkmimxrt1060\"` must be added to + the _gn gen_ command. +- To build with the option to have Matter certificates/keys pre-loaded in a + specific flash area the argument `nxp_use_factory_data=true` must be added + to the _gn gen_ command. For more information, see + [Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) + + + +## Manufacturing data + +See +[Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) + +Other comments: + +The RT1060 all cluster app demonstrates the usage of encrypted Matter +manufacturing data storage. Matter manufacturing data should be encrypted before +flashing them to the RT1060 flash. + +For development purpose the RT1060 all cluster app code could use the hardcoded +AES 128 software key. This software key should be used only during development +stage. + +For production usage, it is recommended to use the `OTP key` which needs to be +fused in the RT1060 SW_GP2. The application note AN12800 should be followed to +get more information. In this case the all cluster app should be updated to +indicate to the `DCP` module to use the `OTP key` instead of the software key. +For that the call to `FactoryDataPrvdImpl().SetAes128Key()` should be changed to +`FactoryDataPrvdImpl().SetKeySelected(KeySelect::)` with the arg value +specifying where the `OTP key` is stored (`kDCP_OCOTPKeyLow` for [127:0] of +SW_GP2 or `kDCP_OCOTPKeyHigh` for [255:128] of SW_GP2). For more information the +RT1060 `FactoryDataProviderImpl` class description should be checked. + + + +## Flashing and debugging + +In order to flash the application we recommend using +[MCUXpresso IDE (version >= 11.6.0)](https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE). + +- Import the previously downloaded NXP SDK into MCUXpresso IDE. + +Right click the empty space in the MCUXpresso IDE "Installed SDKs" tab to show +the menu, select the "Import local SDK Git repository" menu item. + +![Import local SDK Git repository](../../../../platform/nxp/rt/rt1060/doc/images/import-local-repository.png) + +The "Import SDK Git" window will open. The "Repository location" text field +should point to the west workspace +(third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo subfolder of the +Matter repository). The "Manifest(s) folder" text field should point to its core +subfolder (third_party/nxp/nxp_matter_support/github_sdk/common_sdk/repo/core +subfolder of the Matter repository). Click "OK" and wait for MCUXpresso IDE to +import the SDK. + +![Import SDK Git](../../../../platform/nxp/rt/rt1060/doc/images/import-sdk-git.png) + +Finally select the desired board's SDK manifest in the "Installed SDKs" tab. + +![Select SDK](../../../../platform/nxp/rt/rt1060/doc/images/select-sdk.png) + +- Import the connectedhomeip repo in MCUXpresso IDE as Makefile Project. Use + _none_ as _Toolchain for Indexer Settings_: + +``` +File -> Import -> C/C++ -> Existing Code as Makefile Project +``` + +- Configure MCU Settings: + +``` +Right click on the Project -> Properties -> C/C++ Build -> MCU Settings -> Select MIMXRT1060 -> Apply & Close +``` + +![MCU_Set](../../../../platform/nxp/rt/rt1060/doc/images/mcu-set.png) + +Sometimes when the MCU is selected it will not initialize all the memory regions +(usually the `BOARD_FLASH`, `BOARD_SDRAM` and `NCACHE_REGION`) so it is required +that this regions are added manually like in the image above. In addition to +that on the `BOARD_FLASH` line, in the driver tab: + +``` +click inside the tab and on the right side a button with three horizontal dots will appear +click on the button and an window will show +form the dropdown menu select the MIMXRT1060_SFDP_QSPI driver +``` + +![flash_driver](../../../../platform/nxp/rt/rt1060/doc/images/flash_driver.png) + +- Configure the toolchain editor: + +``` +Right click on the Project -> C/C++ Build-> Tool Chain Editor -> NXP MCU Tools -> Apply & Close +``` + +![toolchain](../../../../platform/nxp/rt/rt1060/doc/images/toolchain.JPG) + +- Create a debug configuration: + +``` +Right click on the Project -> Debug -> As->MCUXpresso IDE LinkServer (inc. CMSIS-DAP) probes -> OK -> Select elf file +``` + +![debug_0](../../../../platform/nxp/rt/rt1060/doc/images/debug0.png) + +![debug_1](../../../../platform/nxp/rt/rt1060/doc/images/debug1.png) + +- Set the _Connect script_ for the debug configuration to _RT1060_connect.scp_ + from the dropdown list: + +``` +Right click on the Project -> Debug As -> Debug configurations... -> LinkServer Debugger +``` + +![connect](../../../../platform/nxp/rt/rt1060/doc/images/gdbdebugger.png) + +- Set the _Initialization Commands_ to: + +``` +Right click on the Project -> Debug As -> Debug configurations... -> Startup + +set non-stop on +set pagination off +set mi-async +set remotetimeout 60000 +##target_extended_remote## +set mem inaccessible-by-default ${mem.access} +mon ondisconnect ${ondisconnect} +set arm force-mode thumb +${load} +``` + +![init](../../../../platform/nxp/rt/rt1060/doc/images/startup.png) + +- Set the _vector.catch_ value to _false_ inside the .launch file: + +``` +Right click on the Project -> Utilities -> Open Directory Browser here -> edit *.launch file: + + + +``` + +- Debug using the newly created configuration file: + + + +## Testing the example + +To know how to commission a device over BLE, follow the instructions from +[chip-tool's README.md 'Commission a device over +BLE'][readme_ble_commissioning_section]. + +[readme_ble_commissioning_section]: + ../../../../chip-tool/README.md#commission-a-device-over-ble + +To know how to commissioning a device over IP, follow the instructions from +[chip-tool's README.md 'Pair a device over +IP'][readme_pair_ip_commissioning_section] + +[readme_pair_ip_commissioning_section]: + ../../../../chip-tool/README.md#pair-a-device-over-ip + +#### Matter over wifi configuration : + +The "ble-wifi" pairing method can be used in order to commission the device. + +#### Matter over thread configuration : + +The "ble-thread" pairing method can be used in order to commission the device. + +#### Matter over wifi with openthread border router configuration : + +In order to create or join a Thread network on the Matter Border Router, the TBR +management cluster or the `otcli` commands from the matter CLI can be used. For +more information about using the TBR management cluster follow instructions from +['Using the TBR management cluster'](../../../../../docs/platforms/nxp/nxp_otbr_guide.md#using-the-thread-border-router-management-cluster). +For more information about using the matter shell, follow instructions from +['Testing the all-clusters application with Matter CLI'](#testing-the-all-clusters-application-with-matter-cli-enabled). + +In this configuration, the device can be commissioned over Wi-Fi with the +'ble-wifi' or 'onnetwork' pairing method. + +### Testing the all-clusters application without Matter CLI: + +1. Prepare the board with the flashed `All-cluster application` (as shown + above). +2. The All-cluster example uses UART1 to print logs while running the server. To + view raw UART output, start a terminal emulator like PuTTY and connect to the + used COM port with the following UART settings: + + - Baud rate: 115200 + - 8 data bits + - 1 stop bit + - No parity + - No flow control + +3. Open a terminal connection on the board and watch the printed logs. + +4. On the client side, start sending commands using the chip-tool application as + it is described + [here](../../../../chip-tool/README.md#using-the-client-to-send-matter-commands). + +### Testing the all-clusters application with Matter CLI enabled: + +The Matter CLI can be enabled with the all-clusters application. + +For more information about the Matter CLI default commands, you can refer to the +dedicated [ReadMe](../../../../shell/README.md). + +The All-clusters application supports additional commands : + +``` +> help +[...] +mattercommissioning Open/close the commissioning window. Usage : mattercommissioning [on|off] +matterfactoryreset Perform a factory reset on the device +matterreset Reset the device +``` + +- `matterfactoryreset` command erases the file system completely (all Matter + settings are erased). +- `matterreset` enables the device to reboot without erasing the settings. + +Here are described steps to use the all-cluster-app with the Matter CLI enabled + +1. Prepare the board with the flashed `All-cluster application` (as shown + above). +2. The matter CLI is accessible in UART1. For that, start a terminal emulator + like PuTTY and connect to the used COM port with the following UART settings: + + - Baud rate: 115200 + - 8 data bits + - 1 stop bit + - No parity + - No flow control + +3. The All-cluster example uses UART2 to print logs while running the server. To + view raw UART output, a pin should be plugged to an USB to UART adapter + (connector J16 pin 7 in case of MIMXRT1060-EVK-B board or connector J22 pin 7 + in case of MIMXRT1060-EVK board), then start a terminal emulator like PuTTY + and connect to the used COM port with the following UART settings: + + - Baud rate: 115200 + - 8 data bits + - 1 stop bit + - No parity + - No flow control + +4. On the client side, start sending commands using the chip-tool application as + it is described + [here](../../../../chip-tool/README.md#using-the-client-to-send-matter-commands). + +For Matter with OpenThread Border Router support, the matter CLI can be used to +start/join the Thread network, using the following ot-cli commands. (Note that +setting channel, panid, and network key is not enough anymore because of an Open +Thread stack update. We first need to initialize a new dataset.) + +``` +> otcli dataset init new +Done +> otcli dataset +Active Timestamp: 1 +Channel: 25 +Channel Mask: 0x07fff800 +Ext PAN ID: 42af793f623aab54 +Mesh Local Prefix: fd6e:c358:7078:5a8d::/64 +Network Key: f824658f79d8ca033fbb85ecc3ca91cc +Network Name: OpenThread-b870 +PAN ID: 0xb870 +PSKc: f438a194a5e968cc43cc4b3a6f560ca4 +Security Policy: 672 onrc 0 +Done +> otcli dataset panid 0xabcd +Done +> otcli dataset channel 25 +Done +> otcli dataset commit active +Done +> otcli ifconfig up +Done +> otcli thread start +Done +> otcli state +leader +Done +``` + + + +## Thread Border Router overview + +To enable Thread Border Router support see the [build](README.md#building) +section. + +The complete Border Router guide is located +[here](../../../../../docs/platforms/nxp/nxp_otbr_guide.md). diff --git a/examples/all-clusters-app/nxp/rt/rt1060/args.gni b/examples/all-clusters-app/nxp/rt/rt1060/args.gni new file mode 100644 index 00000000000..c2d91a5db7b --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1060/args.gni @@ -0,0 +1,19 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. + +import("//build_overrides/chip.gni") + +# SDK target definitions +nxp_sdk_target = get_label_info(":sdk", "label_no_toolchain") +nxp_sdk_driver_target = get_label_info(":sdk_driver", "label_no_toolchain") diff --git a/examples/all-clusters-app/nxp/rt/rt1060/build_overrides b/examples/all-clusters-app/nxp/rt/rt1060/build_overrides new file mode 120000 index 00000000000..f10867042f4 --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1060/build_overrides @@ -0,0 +1 @@ +../../../../build_overrides \ No newline at end of file diff --git a/examples/all-clusters-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h new file mode 100644 index 00000000000..61be0867102 --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1060/include/config/CHIPProjectConfig.h @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020 Google LLC. + * 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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +/* + * Tells to the platform Factory Data Provider whether to use the example configuration or real/provisioned data. + */ +#ifndef CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA +#define CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA 0 +#endif + +/** + * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID + * + * 0xFFF1: Test vendor. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID + * + */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8005 + +#if !CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA +// Use a default pairing code if one hasn't been provisioned in flash. +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#endif + +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 +#endif + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_PAIRING_CODE "CHIPUS" + +/** + * CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER + * + * Enables the use of a hard-coded default serial number if none + * is found in CHIP NV storage. + */ +#define CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER "DUMMY_SN" + +#endif /* !CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA */ + +/** + * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION + * + * The hardware version number assigned to device or product by the device vendor. This + * number is scoped to the device product id, and typically corresponds to a revision of the + * physical device, a change to its packaging, and/or a change to its marketing presentation. + * This value is generally *not* incremented for device software versions. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 100 + +#ifndef CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "v0.1.0" +#endif + +/** + * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING + * + * A string identifying the software version running on the device. + * CHIP currently expects the software version to be in the format + * {MAJOR_VERSION}.0d{MINOR_VERSION} + */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING NXP_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION NXP_CONFIG_DEVICE_SOFTWARE_VERSION +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME "NXP Semiconductors" +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "NXP Demo App" +#endif + +#ifndef CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION +//-> format_version = 1 +//-> vendor_id = 0xFFF1 +//-> product_id_array = [ 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007, 0x8008, 0x8009, 0x800A, 0x800B, +// 0x800C, 0x800D, 0x800E, 0x800F, 0x8010, 0x8011, 0x8012, 0x8013, 0x8014, 0x8015, 0x8016, 0x8017, 0x8018, 0x8019, 0x801A, +// 0x801B, 0x801C, 0x801D, 0x801E, 0x801F, 0x8020, 0x8021, 0x8022, 0x8023, 0x8024, 0x8025, 0x8026, 0x8027, 0x8028, 0x8029, +// 0x802A, 0x802B, 0x802C, 0x802D, 0x802E, 0x802F, 0x8030, 0x8031, 0x8032, 0x8033, 0x8034, 0x8035, 0x8036, 0x8037, 0x8038, +// 0x8039, 0x803A, 0x803B, 0x803C, 0x803D, 0x803E, 0x803F, 0x8040, 0x8041, 0x8042, 0x8043, 0x8044, 0x8045, 0x8046, 0x8047, +// 0x8048, 0x8049, 0x804A, 0x804B, 0x804C, 0x804D, 0x804E, 0x804F, 0x8050, 0x8051, 0x8052, 0x8053, 0x8054, 0x8055, 0x8056, +// 0x8057, 0x8058, 0x8059, 0x805A, 0x805B, 0x805C, 0x805D, 0x805E, 0x805F, 0x8060, 0x8061, 0x8062, 0x8063 ] +//-> device_type_id = 0x0016 +//-> certificate_id = "ZIG20142ZB330003-24" +//-> security_level = 0 +//-> security_information = 0 +//-> version_number = 0x2694 +//-> certification_type = 0 +//-> dac_origin_vendor_id is not present +//-> dac_origin_product_id is not present +#define CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION \ + { \ + 0x30, 0x82, 0x02, 0x19, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x02, 0x0a, 0x30, \ + 0x82, 0x02, 0x06, 0x02, 0x01, 0x03, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, \ + 0x02, 0x01, 0x30, 0x82, 0x01, 0x71, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x82, \ + 0x01, 0x62, 0x04, 0x82, 0x01, 0x5e, 0x15, 0x24, 0x00, 0x01, 0x25, 0x01, 0xf1, 0xff, 0x36, 0x02, 0x05, 0x00, 0x80, \ + 0x05, 0x01, 0x80, 0x05, 0x02, 0x80, 0x05, 0x03, 0x80, 0x05, 0x04, 0x80, 0x05, 0x05, 0x80, 0x05, 0x06, 0x80, 0x05, \ + 0x07, 0x80, 0x05, 0x08, 0x80, 0x05, 0x09, 0x80, 0x05, 0x0a, 0x80, 0x05, 0x0b, 0x80, 0x05, 0x0c, 0x80, 0x05, 0x0d, \ + 0x80, 0x05, 0x0e, 0x80, 0x05, 0x0f, 0x80, 0x05, 0x10, 0x80, 0x05, 0x11, 0x80, 0x05, 0x12, 0x80, 0x05, 0x13, 0x80, \ + 0x05, 0x14, 0x80, 0x05, 0x15, 0x80, 0x05, 0x16, 0x80, 0x05, 0x17, 0x80, 0x05, 0x18, 0x80, 0x05, 0x19, 0x80, 0x05, \ + 0x1a, 0x80, 0x05, 0x1b, 0x80, 0x05, 0x1c, 0x80, 0x05, 0x1d, 0x80, 0x05, 0x1e, 0x80, 0x05, 0x1f, 0x80, 0x05, 0x20, \ + 0x80, 0x05, 0x21, 0x80, 0x05, 0x22, 0x80, 0x05, 0x23, 0x80, 0x05, 0x24, 0x80, 0x05, 0x25, 0x80, 0x05, 0x26, 0x80, \ + 0x05, 0x27, 0x80, 0x05, 0x28, 0x80, 0x05, 0x29, 0x80, 0x05, 0x2a, 0x80, 0x05, 0x2b, 0x80, 0x05, 0x2c, 0x80, 0x05, \ + 0x2d, 0x80, 0x05, 0x2e, 0x80, 0x05, 0x2f, 0x80, 0x05, 0x30, 0x80, 0x05, 0x31, 0x80, 0x05, 0x32, 0x80, 0x05, 0x33, \ + 0x80, 0x05, 0x34, 0x80, 0x05, 0x35, 0x80, 0x05, 0x36, 0x80, 0x05, 0x37, 0x80, 0x05, 0x38, 0x80, 0x05, 0x39, 0x80, \ + 0x05, 0x3a, 0x80, 0x05, 0x3b, 0x80, 0x05, 0x3c, 0x80, 0x05, 0x3d, 0x80, 0x05, 0x3e, 0x80, 0x05, 0x3f, 0x80, 0x05, \ + 0x40, 0x80, 0x05, 0x41, 0x80, 0x05, 0x42, 0x80, 0x05, 0x43, 0x80, 0x05, 0x44, 0x80, 0x05, 0x45, 0x80, 0x05, 0x46, \ + 0x80, 0x05, 0x47, 0x80, 0x05, 0x48, 0x80, 0x05, 0x49, 0x80, 0x05, 0x4a, 0x80, 0x05, 0x4b, 0x80, 0x05, 0x4c, 0x80, \ + 0x05, 0x4d, 0x80, 0x05, 0x4e, 0x80, 0x05, 0x4f, 0x80, 0x05, 0x50, 0x80, 0x05, 0x51, 0x80, 0x05, 0x52, 0x80, 0x05, \ + 0x53, 0x80, 0x05, 0x54, 0x80, 0x05, 0x55, 0x80, 0x05, 0x56, 0x80, 0x05, 0x57, 0x80, 0x05, 0x58, 0x80, 0x05, 0x59, \ + 0x80, 0x05, 0x5a, 0x80, 0x05, 0x5b, 0x80, 0x05, 0x5c, 0x80, 0x05, 0x5d, 0x80, 0x05, 0x5e, 0x80, 0x05, 0x5f, 0x80, \ + 0x05, 0x60, 0x80, 0x05, 0x61, 0x80, 0x05, 0x62, 0x80, 0x05, 0x63, 0x80, 0x18, 0x24, 0x03, 0x16, 0x2c, 0x04, 0x13, \ + 0x5a, 0x49, 0x47, 0x32, 0x30, 0x31, 0x34, 0x32, 0x5a, 0x42, 0x33, 0x33, 0x30, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x34, \ + 0x24, 0x05, 0x00, 0x24, 0x06, 0x00, 0x25, 0x07, 0x94, 0x26, 0x24, 0x08, 0x00, 0x18, 0x31, 0x7d, 0x30, 0x7b, 0x02, \ + 0x01, 0x03, 0x80, 0x14, 0x62, 0xfa, 0x82, 0x33, 0x59, 0xac, 0xfa, 0xa9, 0x96, 0x3e, 0x1c, 0xfa, 0x14, 0x0a, 0xdd, \ + 0xf5, 0x04, 0xf3, 0x71, 0x60, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, \ + 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x04, 0x47, 0x30, 0x45, 0x02, 0x20, 0x24, 0xe5, \ + 0xd1, 0xf4, 0x7a, 0x7d, 0x7b, 0x0d, 0x20, 0x6a, 0x26, 0xef, 0x69, 0x9b, 0x7c, 0x97, 0x57, 0xb7, 0x2d, 0x46, 0x90, \ + 0x89, 0xde, 0x31, 0x92, 0xe6, 0x78, 0xc7, 0x45, 0xe7, 0xf6, 0x0c, 0x02, 0x21, 0x00, 0xf8, 0xaa, 0x2f, 0xa7, 0x11, \ + 0xfc, 0xb7, 0x9b, 0x97, 0xe3, 0x97, 0xce, 0xda, 0x66, 0x7b, 0xae, 0x46, 0x4e, 0x2b, 0xd3, 0xff, 0xdf, 0xc3, 0xcc, \ + 0xed, 0x7a, 0xa8, 0xca, 0x5f, 0x4c, 0x1a, 0x7c \ + } +#endif + +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC + * + * Enables synchronizing the device's real time clock with a remote CHIP Time service + * using the CHIP Time Sync protocol. + */ +// #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 + +/** + * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD + * + * Select the ability to offload event logs to any interested subscribers using WDM. + */ +#define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 + +/** + * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS + * + * Enable recording UTC timestamps. + */ +#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1 + +/** + * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE + * + * A size, in bytes, of the individual debug event logging buffer. + */ +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) + +/** + * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE + * + * For a development build, set the default importance of events to be logged as Debug. + * Since debug is the lowest importance level, this means all standard, critical, info and + * debug importance level vi events get logged. + */ +#if BUILD_RELEASE +#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production +#else +#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug +#endif // BUILD_RELEASE + +/* Increasing the retransmission interval of the MRP messages after subsequent failures */ +#ifndef CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL +#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32) +#endif diff --git a/examples/all-clusters-app/nxp/rt/rt1060/third_party/connectedhomeip b/examples/all-clusters-app/nxp/rt/rt1060/third_party/connectedhomeip new file mode 120000 index 00000000000..305f2077ffe --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1060/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../../.. \ No newline at end of file diff --git a/examples/all-clusters-app/nxp/rt/rt1170/.gn b/examples/all-clusters-app/nxp/rt/rt1170/.gn new file mode 100644 index 00000000000..59dcfeb229a --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1170/.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") + +# The location of the build configuration file. +buildconfig = "${build_root}/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_cpu = "arm" + target_os = "freertos" + + import("//args.gni") + + # Import common example GN args + import("${chip_root}/examples/platform/nxp/common/gn/args.gni") + + # Import default platform configs + import("${chip_root}/src/platform/nxp/rt/rt1170/args.gni") +} diff --git a/examples/all-clusters-app/nxp/rt/rt1170/BUILD.gn b/examples/all-clusters-app/nxp/rt/rt1170/BUILD.gn new file mode 100644 index 00000000000..edbd208506b --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1170/BUILD.gn @@ -0,0 +1,245 @@ +# Copyright (c) 2021-2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/openthread.gni") +import("${chip_root}/src/platform/device.gni") + +#allows to get common NXP SDK gn options +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +# Allows to get various RT gn options +import("${nxp_sdk_build_root}/${nxp_sdk_name}/rt_sdk.gni") + +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") +import( + "${nxp_sdk_build_root}/${nxp_sdk_name}/${rt_platform}/${rt_platform}.gni") +import("${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_executable.gni") + +assert(current_os == "freertos") +assert(target_os == "freertos") +assert(nxp_platform == "rt/rt1170") + +declare_args() { + # Allows to connect to a predefine Wi-Fi network at boot + wifi_auto_connect_at_boot = false + wifi_auto_connect_at_boot_ssid = "" + wifi_auto_connect_at_boot_password = "" + + # Setup discriminator as argument + setup_discriminator = 3840 +} + +example_platform_dir = + "${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}" +common_example_dir = "${chip_root}/examples/platform/nxp/common" + +app_common_folder = "all-clusters-app/all-clusters-common" + +# Create here the SDK instance. +# Particular sources/defines/includes could be added/changed depending on the target application. +rt_sdk("sdk") { + defines = [] + + cflags = [] + public_deps = [] + public_configs = [] + sources = [] + include_dirs = [] + + # Indicate paths to default board files + include_dirs += [ "${example_platform_dir}/board/" ] + sources += [ "${example_platform_dir}/board/pin_mux.c" ] + sources += [ "${example_platform_dir}/board/hardware_init.c" ] + sources += [ "${example_platform_dir}/board/clock_config.c" ] + sources += [ "${example_platform_dir}/board/board.c" ] + sources += [ "${example_platform_dir}/board/peripherals.c" ] + sources += [ "${example_platform_dir}/board/sdmmc_config.c" ] + + # Indicate the path to CHIPProjectConfig.h + include_dirs += [ "include/config" ] + + # Indicate the default path to FreeRTOSConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/freeRTOS" ] + + # Indicate the default path to OpenThreadConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/openthread" ] + + # For matter with BR feature, increase FreeRTOS heap size + if (chip_enable_wifi && chip_enable_openthread) { + defines += [ "configTOTAL_HEAP_SIZE=(size_t)(170 * 1024)" ] + } + + defines += [ + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", + ] +} + +# Create the SDK driver instance. +# Particular sources/defines/includes could be added to add other drivers not available in the default sdk driver template +rt1170_sdk_drivers("sdk_driver") { +} + +rt_executable("all_cluster_app") { + output_name = "chip-rt1170-all-cluster-example" + + defines = [ + "CONFIG_RENDEZVOUS_MODE=7", + "CONFIG_APP_FREERTOS_OS=1", + ] + + if (chip_enable_openthread) { + defines += [ "CONFIG_NET_L2_OPENTHREAD=1" ] + } + + include_dirs = [ + "../../common/main/include", + "../../common/main", + "${chip_root}/examples/all-clusters-app/all-clusters-common/include", + "${chip_root}/examples/providers/", + ] + + sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", + "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", + "../../common/main/AppTask.cpp", + "../../common/main/DeviceCallbacks.cpp", + "../../common/main/ZclCallbacks.cpp", + "../../common/main/include/AppEvent.h", + "../../common/main/include/AppTask.h", + "../../common/main/include/DeviceCallbacks.h", + "../../common/main/main.cpp", + ] + + # App common files + include_dirs += [ + "${common_example_dir}/icd/include", + "${common_example_dir}/matter_button/include", + "${common_example_dir}/matter_cli/include", + "${common_example_dir}/device_manager/include", + "${common_example_dir}/device_callbacks/include", + "${common_example_dir}/factory_data/include", + "${common_example_dir}/app_task/include", + ] + + sources += [ + "${common_example_dir}/app_task/source/AppTaskBase.cpp", + "${common_example_dir}/app_task/source/AppTaskFreeRTOS.cpp", + "${common_example_dir}/device_callbacks/source/CommonDeviceCallbacks.cpp", + "${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp", + "${common_example_dir}/factory_data/source/AppFactoryDataDefaultImpl.cpp", + "${common_example_dir}/icd/source/ICDUtil.cpp", + "${common_example_dir}/matter_button/source/ButtonRegistrationEmpty.cpp", + ] + + deps = [ "${chip_root}/examples/${app_common_folder}" ] + + sources += [ + "${chip_root}/examples/${app_common_folder}/src/bridged-actions-stub.cpp", + "${chip_root}/examples/${app_common_folder}/src/smco-stub.cpp", + "${chip_root}/examples/${app_common_folder}/src/static-supported-modes-manager.cpp", + ] + + if (nxp_enable_matter_cli) { + defines += [ "ENABLE_CHIP_SHELL" ] + deps += [ + "${chip_root}/examples/shell/shell_common:shell_common", + "${chip_root}/src/lib/shell:shell", + ] + sources += [ + "${common_example_dir}/matter_cli/source/AppCLIBase.cpp", + "${common_example_dir}/matter_cli/source/AppCLIFreeRTOS.cpp", + ] + } + + if (chip_enable_ota_requestor) { + include_dirs += [ "${common_example_dir}/ota_requestor/include" ] + sources += [ + "${common_example_dir}/ota_requestor/source/OTARequestorInitiator.cpp", + "${common_example_dir}/ota_requestor/source/OTARequestorInitiatorCommon.cpp", + ] + } + + if (wifi_auto_connect_at_boot) { + assert(wifi_auto_connect_at_boot_ssid != "" && + wifi_auto_connect_at_boot_password != "", + "WiFi SSID and password must be specified at build time!") + + defines += [ + "CONFIG_CHIP_APP_WIFI_CONNECT_AT_BOOT=1", + "CONFIG_CHIP_APP_WIFI_SSID=\"${wifi_auto_connect_at_boot_ssid}\"", + "CONFIG_CHIP_APP_WIFI_PASSWORD=\"${wifi_auto_connect_at_boot_password}\"", + ] + + include_dirs += [ "${common_example_dir}/wifi_connect/include" ] + sources += [ "${common_example_dir}/wifi_connect/source/WifiConnect.cpp" ] + } + + if (chip_enable_ble) { + defines += [ "APP_BT_DEVICE_NAME=\"NXP-AllClustersApp\"" ] + } + + # In case a dedicated assert function needs to be supported the flag sdk_fsl_assert_support should be set to false + # The would add to the build a dedicated application assert implementation. + if (!sdk_fsl_assert_support) { + sources += [ "${common_example_dir}/app_assert/source/AppAssert.cpp" ] + } + + cflags = [ "-Wconversion" ] + + ldscript = + "${example_platform_dir}/app/ldscripts/MIMXRT1176xxxxx_cm7_flexspi_nor.ld" + + inputs = [ ldscript ] + + ldflags = [ + "-T" + rebase_path(ldscript, root_build_dir), + "-fno-common", + "-Wl,--defsym=__stack_size__=2048", + "-ffreestanding", + "-fno-builtin", + "-mapcs", + "-u qspiflash_config", + "-u image_vector_table", + "-u boot_data", + "-u dcd_data", + "-Wl,-print-memory-usage", + "-Wl,--no-warn-rwx-segments", + ] + + if (chip_enable_ota_requestor) { + if (no_mcuboot) { + # If "no_mcuboot" is set to true, the application will be linked at the base of the flash. + print( + "Warning : The OTA Requestor is enabled without MCUBoot. This will prevent the application from applying software updates.") + } else { + # we need to reserve enough space for the bootloader (MCUBoot) + # MCUBoot requires 0x40000 Bytes to be reserved at the base of the flash + # Consequently, some sections will need to be shifted + ldflags += [ "-Wl,--defsym=__m_mcuboot_size__=0x40000" ] + } + } + + output_dir = root_out_dir +} + +group("rt1170") { + deps = [ ":all_cluster_app" ] +} + +group("default") { + deps = [ ":rt1170" ] +} diff --git a/examples/all-clusters-app/nxp/rt/rt1170/README.md b/examples/all-clusters-app/nxp/rt/rt1170/README.md new file mode 100644 index 00000000000..8b992982045 --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1170/README.md @@ -0,0 +1,505 @@ +# CHIP RT1170 All-clusters Application + +The all-clusters example implements a server which can be accessed by a CHIP +controller and can accept basic cluster commands. + +The example is based on +[Project CHIP](https://github.com/project-chip/connectedhomeip) and the NXP +RT1170 SDK, and provides a prototype application that demonstrates device +commissioning and different cluster control. + +
+ +- [CHIP RT1170 All-clusters Application](#chip-rt1170-all-clusters-application) + - [Introduction](#introduction) + - [Configuration(s) supported](#configurations-supported) + - [Hardware requirements for RT1170 + IW612](#hardware-requirements-for-rt1170--iw612) + - [Hardware rework for SPI support on MIMXRT1170-EVK-B](#hardware-rework-for-spi-support-on-mimxrt1170-evk-b) + - [Board settings (Spinel over SPI, I2C, BLE over UART)](#board-settings-spinel-over-spi-i2c-ble-over-uart) + - [Building](#building) + - [Building with Matter over Wifi configuration on RT1170 + IW612](#building-with-matter-over-wifi-configuration-on-rt1170--iw612) + - [Building with Matter over Thread configuration on RT1170 + IW612](#building-with-matter-over-thread-configuration-on-rt1170--iw612) + - [Building with Matter over Wifi + OpenThread Border Router configuration on RT1170 + IW612](#building-with-matter-over-wifi--openthread-border-router-configuration-on-rt1170--iw612) + - [General information](#general-information) + - [Manufacturing data](#manufacturing-data) + - [Flashing and debugging](#flashing-and-debugging) + - [Testing the example](#testing-the-example) + - [Matter over wifi configuration :](#matter-over-wifi-configuration-) + - [Matter over thread configuration :](#matter-over-thread-configuration-) + - [Matter over wifi with openthread border router configuration :](#matter-over-wifi-with-openthread-border-router-configuration-) + - [Testing the all-clusters application without Matter CLI:](#testing-the-all-clusters-application-without-matter-cli) + - [Testing the all-clusters application with Matter CLI enabled:](#testing-the-all-clusters-application-with-matter-cli-enabled) + - [Thread Border Router overview](#thread-border-router-overview) +
+ +## Introduction + +![RT1170 EVK](../../../../platform/nxp/rt/rt1170/doc/images/IMX-RT1170-EVK-TOP.jpg) + +The RT1170 all-cluster application provides a working demonstration of the +RT1170 board integration, built using the Project CHIP codebase and the NXP +RT1170 SDK. + +The example supports: + +- Matter over Wi-Fi +- Matter over Openthread +- Matter over Wi-Fi with Openthread Border Router support + +The example targets the +[NXP MIMXRT1170-EVKB](https://www.nxp.com/part/MIMXRT1170-EVKB#/) board by +default. + +### Configuration(s) supported + +Here are listed configurations that allow to support Matter over Wi-Fi & Matter +over Thread on RT1170 : + +- RT1170 + IW612 (Wi-Fi + BLE + 15.4) + +### Hardware requirements for RT1170 + IW612 + +Host part: + +- 1 MIMXRT1170-EVK-B + +Transceiver part : + +- 1 + [2EL M2 A1 IW612 Secure Module](https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth-plus-802-15-4/2-4-5-ghz-dual-band-1x1-wi-fi-6-802-11ax-plus-bluetooth-5-2-plus-802-15-4-tri-radio-solution:IW612) + +![](../../../../platform/nxp/rt/rt1170/doc/images/iwx612_2EL.jpg) + +- 1 + [Murata uSD to M2 adapter revC](https://www.murata.com/en-eu/products/connectivitymodule/wi-fi-bluetooth/overview/lineup/usd-m2-adapter-2we-2wf) + +![](../../../../platform/nxp/rt/rt1170/doc/images/murata_usd-M2_adapter.jpg) + +- Male to female Burg cables + +#### Hardware rework for SPI support on MIMXRT1170-EVK-B + +To support SPI on the MIMXRT1170-EVK-B board, it is required to remove 0Ω +resistors R404,R406,R2015. + +#### Board settings (Spinel over SPI, I2C, BLE over UART) + +Plug IW612 module to M.2 connector on Murata uSD to M2 adapter + +The Murata uSD-M2 adapter should be plugged to the RT1170 via SD-IO. + +The below tables explain pin settings (SPI settings) to connect the +MIMXRT1170-EVK-B (host) to a IW612 transceiver (rcp). + +- Murata uSD to M2 adapter connections description: + +![](../../../../platform/nxp/rt/rt1170/doc/images/murata_usd-m2_connections_1.jpg) + +![](../../../../platform/nxp/rt/rt1170/doc/images/murata_usd-m2_connections_2.jpg) + +- Jumpers positions on Murata uSD to M2 adapter: + + Use USB-C power supply | Jumper | Position| | :----: | :-----: | | J1 | 1-2 + | | J12 | 1-2 | | J13 | 1-2 | | J14 | 1-2 | | JP1.1 (back side)| ON | + +- Jumpers positions on MIMXRT1170-EVK-B: + + | Jumper | Position | + | :----: | :------: | + | `J56` | `2-3` | + +- I2C connection to program `IO_Expander` on the IW612 module + + | MIMXRT1170-EVK-B | uSD-M2 adapter | + | :----------------: | :------------: | + | `I2C_SDA (J10.18)` | `J5.2` | + | `I2C_SDL (J10.20)` | `J5.4` | + +- SPI connection between RT1170 and uSD-M2 adapter + + | MIMXRT1170-EVK-B | uSD-M2 adapter | + | :-----------------: | :------------: | + | `SPI_MOSI (J10.8)` | `J5.10` | + | `SPI_MISO (J10.10)` | `J9.7` | + | `SPI_CLK (J10.12)` | `J9.8` | + | `SPI_CS (J10.6)` | `J5.8` | + | `SPI_INT (J26.4)` | `J5.6` | + | `GND (J10.14)` | `J5.15` | + +- UART BLE and Reset connections between RT1170 and uSD-M2 adapter + + | MIMXRT1170-EVK-B | uSD-M2 adapter | + | :-----------------: | :------------: | + | `RESET (J26.2)` | `J9.3` | + | `UART_RXD (J25.13)` | `J9.1` | + | `UART_TXD (J25.15)` | `J9.2` | + | `UART_CTS (J25.9)` | `J8.4` | + | `UART_RTS (J25.11)` | `J8.3` | + | `GND (J26.1)` | `J7.6` | + +## Building + +In order to build the Project CHIP example, we recommend using a Linux +distribution. Supported Operating Systems are listed in +[BUILDING.md](../../../../../docs/guides/BUILDING.md). + +- Make sure that below prerequisites are correctly installed, as described in + [BUILDING.md](../../../../../docs/guides/BUILDING.md). + +``` +sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \ + libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ + python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev +``` + +- Step 1: checkout NXP specific submodules only + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive +``` + +- Step 2: activate local environment + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh +``` + +If the script says the environment is out of date, you can update it by running +the following command: + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh +``` + +- Step 3: Init NXP SDK(s) + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ third_party/nxp/nxp_matter_support/scripts/update_nxp_sdk.py --platform common +``` + +Note: By default update_nxp_sdk.py will try to initialize all NXP SDKs. Arg "-- +help" could be used to view all available options. + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/all-cluster-app/nxp/rt/rt1170/ +``` + +### Building with Matter over Wifi configuration on RT1170 + IW612 + +- Build the Wi-fi configuration for MIMXRT1170 board + IW612 transceiver (with + BLE for commissioning). + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1170$ gn gen --args="chip_enable_wifi=true iwx12_transceiver=true chip_config_network_layer_ble=true chip_enable_ble=true " out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1170$ ninja -C out/debug +``` + +### Building with Matter over Thread configuration on RT1170 + IW612 + +- Build the Openthread configuration for MIMXRT1170 board + IW612 transceiver + (with BLE for commissioning). + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-cluster/nxp/rt/rt1170$ gn gen --args="chip_enable_openthread=true iwx12_transceiver=true chip_inet_config_enable_ipv4=false chip_config_network_layer_ble=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-cluster/nxp/rt/rt1170/$ ninja -C out/debug +``` + +### Building with Matter over Wifi + OpenThread Border Router configuration on RT1170 + IW612 + +This configuration supports the Thread Border Router management cluster to +provision the Thread credentials. Enabling the Matter CLI in order to control +the Thread network on the Border Router is optional but recommended for other +features like the Thread credential sharing. + +Note that the Thread Border Router management cluster is only supported on the +thermostat application for now. + +- Build Matter with Border Router configuration with BLE commissioning + (ble-wifi) : + +``` +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt11170$ gn gen --args="chip_enable_wifi=true iwx12_transceiver=true chip_config_network_layer_ble=true chip_enable_ble=true chip_enable_openthread=true nxp_enable_matter_cli=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rt1170$ ninja -C out/debug +``` + +### General information + +The resulting output file can be found in +out/debug/chip-rt1170-all-cluster-example. + +Optional GN options that can be added when building an application: + +- To enable the + [secondary network commissioning interface](../../../../../docs/platforms/nxp/nxp_otbr_guide.md#using-the-secondary-network-commissioning-interface), + the arguments `chip_enable_secondary_nwk_if=true` and + `chip_device_config_thread_network_endpoint_id=3` must be added to the _gn + gen_ command. Note that this is only supported when building the Matter over + Wifi + OpenThread Border Router configuration. Note that is only supported + on the on the thermostat application for now. +- To enable the + [matter CLI](#testing-the-all-clusters-application-with-matter-cli-enabled), + the argument `nxp_enable_matter_cli=true` must be added to the _gn gen_ + command. +- To build the application in debug mode, the argument + `is_debug=true optimize_debug=false` must be added to the _gn gen_ command. +- To build with the option to have Matter certificates/keys pre-loaded in a + specific flash area the argument `nxp_use_factory_data=true` must be added + to the _gn gen_ command. For more information, see + [Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) +- To build the application with the OTA Requestor enabled, the arguments + `chip_enable_ota_requestor=true no_mcuboot=false` must be added to the _gn + gen_ command. More information about the OTA Requestor feature in + [OTA Requestor README](../../../../../docs/platforms/nxp/nxp_RTs_ota_software_update.md). + +## Manufacturing data + +See +[Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) + +Other comments: + +The all cluster app demonstrates the usage of encrypted Matter manufacturing +data storage. Matter manufacturing data should be encrypted using an AES 128 +software key before flashing them to the device flash. + +## Flashing and debugging + +In order to flash the application we recommend using +[MCUXpresso IDE (version >= 11.5.0)](https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE). + +- Import the previously downloaded NXP SDK into MCUXpresso IDE. This can be + done by drag-and-dropping the SDK archive into MCUXpresso IDE "Installed + SDKs" tab; + ![Select SDK](../../../../platform/nxp/rt/rt1170/doc/images/select-sdk.png) +- Import the connectedhomeip repo in MCUXpresso IDE as Makefile Project. Use + _none_ as _Toolchain for Indexer Settings_: + +``` +File -> Import -> C/C++ -> Existing Code as Makefile Project +``` + +- Configure MCU Settings: + +``` +Right click on the Project -> Properties -> C/C++ Build -> MCU Settings -> Select MIMXRT1170 -> Apply & Close +``` + +![MCU_Sett](../../../../platform/nxp/rt/rt1170/doc/images/mcu-set.png) + +Sometimes when the MCU is selected it will not initialize all the memory regions +(usually the `BOARD_FLASH`, `BOARD_SDRAM` and `NCACHE_REGION`) so it is required +that this regions are added manually like in the image above. In addition to +that on the `BOARD_FLASH` line, in the driver tab: + +``` +click inside the tab and on the right side a button with three horizontal dots will appear +click on the button and an window will show +form the dropdown menu select the MIMXRT1170_SFDP_QSPI driver +``` + +![flash_driver](../../../../platform/nxp/rt/rt1170/doc/images/flash_driver.png) + +- Configure the toolchain editor: + +``` +Right click on the Project -> C/C++ Build-> Tool Chain Editor -> NXP MCU Tools -> Apply & Close +``` + +![toolchain](../../../../platform/nxp/rt/rt1170/doc/images/toolchain.JPG) + +- Create a debug configuration: + + MIMXRT1170-EVK-B board supports CMSIS-DAP debug protocol by default. It + should be switched to JLink. + + - download and install + [MCU-LINK_INSTALLER 2.263](https://www.nxp.com/webapp/Download?colCode=MCU-LINK_INSTALLER_2.263_LIN) + - connect jumper JP3 to get board in ISP mode when powered + - connect board and run installed MCU-LINK, follow steps to flash JLINK + firmware + - remove jumper JP3 and reboot board + +``` +Right click on the Project -> Debug -> As->SEGGER J-Link probes -> OK -> Select elf file +``` + +![debug_0](../../../../platform/nxp/rt/rt1170/doc/images/debug0.png) + +- Set the _Initialization Commands_ to: + +``` +Right click on the Project -> Debug As -> Debug configurations... -> Startup + +set non-stop on +set pagination off +set mi-async +set remotetimeout 60000 +##target_extended_remote## +set mem inaccessible-by-default ${mem.access} +mon ondisconnect ${ondisconnect} +set arm force-mode thumb +${load} +``` + +![init](../../../../platform/nxp/rt/rt1170/doc/images/startup.png) + +- Set the _vector.catch_ value to _false_ inside the .launch file: + +``` +Right click on the Project -> Utilities -> Open Directory Browser here -> edit .launch file: + + + +``` + +- Debug using the newly created configuration file: + +## Testing the example + +To know how to commission a device over BLE, follow the instructions from +[chip-tool's README.md 'Commission a device over +BLE'][readme_ble_commissioning_section]. + +[readme_ble_commissioning_section]: + ../../../../chip-tool/README.md#commission-a-device-over-ble + +To know how to commissioning a device over IP, follow the instructions from +[chip-tool's README.md 'Pair a device over +IP'][readme_pair_ip_commissioning_section] + +[readme_pair_ip_commissioning_section]: + ../../../../chip-tool/README.md#pair-a-device-over-ip + +#### Matter over wifi configuration : + +The "ble-wifi" pairing method can be used in order to commission the device. + +#### Matter over thread configuration : + +The "ble-thread" pairing method can be used in order to commission the device. + +#### Matter over wifi with openthread border router configuration : + +In order to create or join a Thread network on the Matter Border Router, the TBR +management cluster or the `otcli` commands from the matter CLI can be used. For +more information about using the TBR management cluster follow instructions from +['Using the TBR management cluster'](../../../../../docs/platforms/nxp/nxp_otbr_guide.md#using-the-thread-border-router-management-cluster). +For more information about using the matter shell, follow instructions from +['Testing the all-clusters application with Matter CLI'](#testing-the-all-clusters-application-with-matter-cli-enabled). + +In this configuration, the device can be commissioned over Wi-Fi with the +'ble-wifi' pairing method. + +### Testing the all-clusters application without Matter CLI: + +1. Prepare the board with the flashed `All-cluster application` (as shown + above). +2. The All-cluster example uses UART1 to print logs while running the server. To + view raw UART output, start a terminal emulator like PuTTY and connect to the + used COM port with the following UART settings: + + - Baud rate: 115200 + - 8 data bits + - 1 stop bit + - No parity + - No flow control + +3. Open a terminal connection on the board and watch the printed logs. + +4. On the client side, start sending commands using the chip-tool application as + it is described + [here](../../../../chip-tool/README.md#using-the-client-to-send-matter-commands). + +### Testing the all-clusters application with Matter CLI enabled: + +Testing the all-clusters application with Matter CLI enabled: + +The Matter CLI can be enabled with the all-clusters application. + +For more information about the Matter CLI default commands, you can refer to the +dedicated [ReadMe](../../../../shell/README.md). + +The All-clusters application supports additional commands : + +``` +> help +[...] +mattercommissioning Open/close the commissioning window. Usage : mattercommissioning [on|off] +matterfactoryreset Perform a factory reset on the device +matterreset Reset the device +``` + +- `matterfactoryreset` command erases the file system completely (all Matter + settings are erased). +- `matterreset` enables the device to reboot without erasing the settings. + +Here are described steps to use the all-cluster-app with the Matter CLI enabled + +1. Prepare the board with the flashed `All-cluster application` (as shown + above). +2. The matter CLI is accessible in UART1. For that, start a terminal emulator + like PuTTY and connect to the used COM port with the following UART settings: + + - Baud rate: 115200 + - 8 data bits + - 1 stop bit + - No parity + - No flow control + +3. The All-cluster example uses UART2 to print logs while running the server. To + view raw UART output, a pin should be plugged to an USB to UART adapter + (connector J9 pin 4), then start a terminal emulator like PuTTY and connect + to the used COM port with the following UART settings: + + - Baud rate: 115200 + - 8 data bits + - 1 stop bit + - No parity + - No flow control + +4. On the client side, start sending commands using the chip-tool application as + it is described + [here](../../../../chip-tool/README.md#using-the-client-to-send-matter-commands). + +For Matter with OpenThread Border Router support, the matter CLI can be used to +start/join the Thread network, using the following ot-cli commands. (Note that +setting channel, panid, and network key is not enough anymore because of an Open +Thread stack update. We first need to initialize a new dataset.) + +``` +> otcli dataset init new +Done +> otcli dataset +Active Timestamp: 1 +Channel: 25 +Channel Mask: 0x07fff800 +Ext PAN ID: 42af793f623aab54 +Mesh Local Prefix: fd6e:c358:7078:5a8d::/64 +Network Key: f824658f79d8ca033fbb85ecc3ca91cc +Network Name: OpenThread-b870 +PAN ID: 0xb870 +PSKc: f438a194a5e968cc43cc4b3a6f560ca4 +Security Policy: 672 onrc 0 +Done +> otcli dataset panid 0xabcd +Done +> otcli dataset channel 25 +Done +> otcli dataset commit active +Done +> otcli ifconfig up +Done +> otcli thread start +Done +> otcli state +leader +Done +``` + +## Thread Border Router overview + +To enable Thread Border Router support see the [build](README.md#building) +section. + +The complete Border Router guide is located +[here](../../../../../docs/platforms/nxp/nxp_otbr_guide.md). diff --git a/examples/all-clusters-app/nxp/rt/rt1170/args.gni b/examples/all-clusters-app/nxp/rt/rt1170/args.gni new file mode 100644 index 00000000000..c2d91a5db7b --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1170/args.gni @@ -0,0 +1,19 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# 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. + +import("//build_overrides/chip.gni") + +# SDK target definitions +nxp_sdk_target = get_label_info(":sdk", "label_no_toolchain") +nxp_sdk_driver_target = get_label_info(":sdk_driver", "label_no_toolchain") diff --git a/examples/all-clusters-app/nxp/rt/rt1170/build_overrides b/examples/all-clusters-app/nxp/rt/rt1170/build_overrides new file mode 120000 index 00000000000..f10867042f4 --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1170/build_overrides @@ -0,0 +1 @@ +../../../../build_overrides \ No newline at end of file diff --git a/examples/all-clusters-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h new file mode 100644 index 00000000000..61be0867102 --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1170/include/config/CHIPProjectConfig.h @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020 Google LLC. + * 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. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +/* + * Tells to the platform Factory Data Provider whether to use the example configuration or real/provisioned data. + */ +#ifndef CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA +#define CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA 0 +#endif + +/** + * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID + * + * 0xFFF1: Test vendor. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1 + +/** + * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID + * + */ +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8005 + +#if !CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA +// Use a default pairing code if one hasn't been provisioned in flash. +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#endif + +#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 +#endif + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_PAIRING_CODE "CHIPUS" + +/** + * CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER + * + * Enables the use of a hard-coded default serial number if none + * is found in CHIP NV storage. + */ +#define CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER "DUMMY_SN" + +#endif /* !CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA */ + +/** + * CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION + * + * The hardware version number assigned to device or product by the device vendor. This + * number is scoped to the device product id, and typically corresponds to a revision of the + * physical device, a change to its packaging, and/or a change to its marketing presentation. + * This value is generally *not* incremented for device software versions. + */ +#define CHIP_DEVICE_CONFIG_DEVICE_HARDWARE_VERSION 100 + +#ifndef CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "v0.1.0" +#endif + +/** + * CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING + * + * A string identifying the software version running on the device. + * CHIP currently expects the software version to be in the format + * {MAJOR_VERSION}.0d{MINOR_VERSION} + */ +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING NXP_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION NXP_CONFIG_DEVICE_SOFTWARE_VERSION +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME +#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME "NXP Semiconductors" +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME +#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "NXP Demo App" +#endif + +#ifndef CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION +//-> format_version = 1 +//-> vendor_id = 0xFFF1 +//-> product_id_array = [ 0x8000, 0x8001, 0x8002, 0x8003, 0x8004, 0x8005, 0x8006, 0x8007, 0x8008, 0x8009, 0x800A, 0x800B, +// 0x800C, 0x800D, 0x800E, 0x800F, 0x8010, 0x8011, 0x8012, 0x8013, 0x8014, 0x8015, 0x8016, 0x8017, 0x8018, 0x8019, 0x801A, +// 0x801B, 0x801C, 0x801D, 0x801E, 0x801F, 0x8020, 0x8021, 0x8022, 0x8023, 0x8024, 0x8025, 0x8026, 0x8027, 0x8028, 0x8029, +// 0x802A, 0x802B, 0x802C, 0x802D, 0x802E, 0x802F, 0x8030, 0x8031, 0x8032, 0x8033, 0x8034, 0x8035, 0x8036, 0x8037, 0x8038, +// 0x8039, 0x803A, 0x803B, 0x803C, 0x803D, 0x803E, 0x803F, 0x8040, 0x8041, 0x8042, 0x8043, 0x8044, 0x8045, 0x8046, 0x8047, +// 0x8048, 0x8049, 0x804A, 0x804B, 0x804C, 0x804D, 0x804E, 0x804F, 0x8050, 0x8051, 0x8052, 0x8053, 0x8054, 0x8055, 0x8056, +// 0x8057, 0x8058, 0x8059, 0x805A, 0x805B, 0x805C, 0x805D, 0x805E, 0x805F, 0x8060, 0x8061, 0x8062, 0x8063 ] +//-> device_type_id = 0x0016 +//-> certificate_id = "ZIG20142ZB330003-24" +//-> security_level = 0 +//-> security_information = 0 +//-> version_number = 0x2694 +//-> certification_type = 0 +//-> dac_origin_vendor_id is not present +//-> dac_origin_product_id is not present +#define CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION \ + { \ + 0x30, 0x82, 0x02, 0x19, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x02, 0x0a, 0x30, \ + 0x82, 0x02, 0x06, 0x02, 0x01, 0x03, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, \ + 0x02, 0x01, 0x30, 0x82, 0x01, 0x71, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x82, \ + 0x01, 0x62, 0x04, 0x82, 0x01, 0x5e, 0x15, 0x24, 0x00, 0x01, 0x25, 0x01, 0xf1, 0xff, 0x36, 0x02, 0x05, 0x00, 0x80, \ + 0x05, 0x01, 0x80, 0x05, 0x02, 0x80, 0x05, 0x03, 0x80, 0x05, 0x04, 0x80, 0x05, 0x05, 0x80, 0x05, 0x06, 0x80, 0x05, \ + 0x07, 0x80, 0x05, 0x08, 0x80, 0x05, 0x09, 0x80, 0x05, 0x0a, 0x80, 0x05, 0x0b, 0x80, 0x05, 0x0c, 0x80, 0x05, 0x0d, \ + 0x80, 0x05, 0x0e, 0x80, 0x05, 0x0f, 0x80, 0x05, 0x10, 0x80, 0x05, 0x11, 0x80, 0x05, 0x12, 0x80, 0x05, 0x13, 0x80, \ + 0x05, 0x14, 0x80, 0x05, 0x15, 0x80, 0x05, 0x16, 0x80, 0x05, 0x17, 0x80, 0x05, 0x18, 0x80, 0x05, 0x19, 0x80, 0x05, \ + 0x1a, 0x80, 0x05, 0x1b, 0x80, 0x05, 0x1c, 0x80, 0x05, 0x1d, 0x80, 0x05, 0x1e, 0x80, 0x05, 0x1f, 0x80, 0x05, 0x20, \ + 0x80, 0x05, 0x21, 0x80, 0x05, 0x22, 0x80, 0x05, 0x23, 0x80, 0x05, 0x24, 0x80, 0x05, 0x25, 0x80, 0x05, 0x26, 0x80, \ + 0x05, 0x27, 0x80, 0x05, 0x28, 0x80, 0x05, 0x29, 0x80, 0x05, 0x2a, 0x80, 0x05, 0x2b, 0x80, 0x05, 0x2c, 0x80, 0x05, \ + 0x2d, 0x80, 0x05, 0x2e, 0x80, 0x05, 0x2f, 0x80, 0x05, 0x30, 0x80, 0x05, 0x31, 0x80, 0x05, 0x32, 0x80, 0x05, 0x33, \ + 0x80, 0x05, 0x34, 0x80, 0x05, 0x35, 0x80, 0x05, 0x36, 0x80, 0x05, 0x37, 0x80, 0x05, 0x38, 0x80, 0x05, 0x39, 0x80, \ + 0x05, 0x3a, 0x80, 0x05, 0x3b, 0x80, 0x05, 0x3c, 0x80, 0x05, 0x3d, 0x80, 0x05, 0x3e, 0x80, 0x05, 0x3f, 0x80, 0x05, \ + 0x40, 0x80, 0x05, 0x41, 0x80, 0x05, 0x42, 0x80, 0x05, 0x43, 0x80, 0x05, 0x44, 0x80, 0x05, 0x45, 0x80, 0x05, 0x46, \ + 0x80, 0x05, 0x47, 0x80, 0x05, 0x48, 0x80, 0x05, 0x49, 0x80, 0x05, 0x4a, 0x80, 0x05, 0x4b, 0x80, 0x05, 0x4c, 0x80, \ + 0x05, 0x4d, 0x80, 0x05, 0x4e, 0x80, 0x05, 0x4f, 0x80, 0x05, 0x50, 0x80, 0x05, 0x51, 0x80, 0x05, 0x52, 0x80, 0x05, \ + 0x53, 0x80, 0x05, 0x54, 0x80, 0x05, 0x55, 0x80, 0x05, 0x56, 0x80, 0x05, 0x57, 0x80, 0x05, 0x58, 0x80, 0x05, 0x59, \ + 0x80, 0x05, 0x5a, 0x80, 0x05, 0x5b, 0x80, 0x05, 0x5c, 0x80, 0x05, 0x5d, 0x80, 0x05, 0x5e, 0x80, 0x05, 0x5f, 0x80, \ + 0x05, 0x60, 0x80, 0x05, 0x61, 0x80, 0x05, 0x62, 0x80, 0x05, 0x63, 0x80, 0x18, 0x24, 0x03, 0x16, 0x2c, 0x04, 0x13, \ + 0x5a, 0x49, 0x47, 0x32, 0x30, 0x31, 0x34, 0x32, 0x5a, 0x42, 0x33, 0x33, 0x30, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x34, \ + 0x24, 0x05, 0x00, 0x24, 0x06, 0x00, 0x25, 0x07, 0x94, 0x26, 0x24, 0x08, 0x00, 0x18, 0x31, 0x7d, 0x30, 0x7b, 0x02, \ + 0x01, 0x03, 0x80, 0x14, 0x62, 0xfa, 0x82, 0x33, 0x59, 0xac, 0xfa, 0xa9, 0x96, 0x3e, 0x1c, 0xfa, 0x14, 0x0a, 0xdd, \ + 0xf5, 0x04, 0xf3, 0x71, 0x60, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x30, \ + 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x04, 0x47, 0x30, 0x45, 0x02, 0x20, 0x24, 0xe5, \ + 0xd1, 0xf4, 0x7a, 0x7d, 0x7b, 0x0d, 0x20, 0x6a, 0x26, 0xef, 0x69, 0x9b, 0x7c, 0x97, 0x57, 0xb7, 0x2d, 0x46, 0x90, \ + 0x89, 0xde, 0x31, 0x92, 0xe6, 0x78, 0xc7, 0x45, 0xe7, 0xf6, 0x0c, 0x02, 0x21, 0x00, 0xf8, 0xaa, 0x2f, 0xa7, 0x11, \ + 0xfc, 0xb7, 0x9b, 0x97, 0xe3, 0x97, 0xce, 0xda, 0x66, 0x7b, 0xae, 0x46, 0x4e, 0x2b, 0xd3, 0xff, 0xdf, 0xc3, 0xcc, \ + 0xed, 0x7a, 0xa8, 0xca, 0x5f, 0x4c, 0x1a, 0x7c \ + } +#endif + +/** + * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC + * + * Enables synchronizing the device's real time clock with a remote CHIP Time service + * using the CHIP Time Sync protocol. + */ +// #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 + +/** + * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD + * + * Select the ability to offload event logs to any interested subscribers using WDM. + */ +#define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 + +/** + * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS + * + * Enable recording UTC timestamps. + */ +#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1 + +/** + * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE + * + * A size, in bytes, of the individual debug event logging buffer. + */ +#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) + +/** + * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE + * + * For a development build, set the default importance of events to be logged as Debug. + * Since debug is the lowest importance level, this means all standard, critical, info and + * debug importance level vi events get logged. + */ +#if BUILD_RELEASE +#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production +#else +#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug +#endif // BUILD_RELEASE + +/* Increasing the retransmission interval of the MRP messages after subsequent failures */ +#ifndef CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL +#define CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL (2000_ms32) +#endif diff --git a/examples/all-clusters-app/nxp/rt/rt1170/third_party/connectedhomeip b/examples/all-clusters-app/nxp/rt/rt1170/third_party/connectedhomeip new file mode 120000 index 00000000000..305f2077ffe --- /dev/null +++ b/examples/all-clusters-app/nxp/rt/rt1170/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../../.. \ No newline at end of file diff --git a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn index 19fa822ec24..cb4e017b9b4 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn +++ b/examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn @@ -1,5 +1,5 @@ # Copyright (c) 2021 Project CHIP Authors -# Copyright 2023 NXP +# Copyright 2023-2024 NXP # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -55,15 +55,6 @@ app_common_folder = "all-clusters-app/all-clusters-common" rt_sdk("sdk") { defines = [] - # To be moved, temporary mbedtls config fix to build app with factory data - if (chip_enable_secure_dac_private_key_storage || - chip_enable_secure_whole_factory_data) { - defines += [ - "MBEDTLS_NIST_KW_C", - "MBEDTLS_PSA_CRYPTO_CLIENT", - ] - } - cflags = [] public_deps = [] public_configs = [] @@ -141,10 +132,10 @@ rt_executable("all_cluster_app") { "../../common/main/main.cpp", ] - if (chip_enable_secure_dac_private_key_storage || - chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_whole_factory_data || + nxp_enable_secure_EL2GO_factory_data) { sources += [ "${chip_root}/examples/platform/nxp/${nxp_platform}/factory_data/source/AppFactoryDataExample.cpp" ] - if (chip_enable_secure_whole_factory_data) { + if (nxp_enable_secure_whole_factory_data) { defines += [ "ENABLE_SECURE_WHOLE_FACTORY_DATA" ] } } else { @@ -184,7 +175,7 @@ rt_executable("all_cluster_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", ] - if (chip_enable_matter_cli) { + if (nxp_enable_matter_cli) { defines += [ "ENABLE_CHIP_SHELL" ] deps += [ "${chip_root}/examples/shell/shell_common:shell_common", @@ -219,6 +210,10 @@ rt_executable("all_cluster_app") { sources += [ "${common_example_dir}/wifi_connect/source/WifiConnect.cpp" ] } + if (chip_enable_ble) { + defines += [ "APP_BT_DEVICE_NAME=\"NXP-AllClustersApp\"" ] + } + # In case a dedicated assert function needs to be supported the flag sdk_fsl_assert_support should be set to false # The would add to the build a dedicated application assert implementation. if (!sdk_fsl_assert_support) { diff --git a/examples/all-clusters-app/nxp/rt/rw61x/README.md b/examples/all-clusters-app/nxp/rt/rw61x/README.md index 61d3f008697..455073d390f 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/README.md +++ b/examples/all-clusters-app/nxp/rt/rw61x/README.md @@ -137,7 +137,7 @@ thermostat application for now. (ble-wifi) : ``` -user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ gn gen --args="chip_enable_wifi=true chip_enable_openthread=true chip_enable_matter_cli=true" out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ gn gen --args="chip_enable_wifi=true chip_enable_openthread=true nxp_enable_matter_cli=true" out/debug user@ubuntu:~/Desktop/git/connectedhomeip/examples/all-clusters-app/nxp/rt/rw610$ ninja -C out/debug ``` @@ -149,7 +149,7 @@ out/debug/chip-rw61x-all-cluster-example. Optional GN options that can be added when building an application: - To enable the - [secondary network commissioning interface](../../../../../docs/guides/nxp/nxp_otbr_guide.md#using-the-secondary-network-commissioning-interface), + [secondary network commissioning interface](../../../../../docs/platforms/nxp/nxp_otbr_guide.md#using-the-secondary-network-commissioning-interface), the arguments `chip_enable_secondary_nwk_if=true` and `chip_device_config_thread_network_endpoint_id=2` must be added to the _gn gen_ command. Note that this is only supported when building the Matter over @@ -157,7 +157,7 @@ Optional GN options that can be added when building an application: on the on the thermostat application for now. - To enable the [matter CLI](README.md#testing-the-all-clusters-application-with-matter-cli-enabled), - the argument `chip_enable_matter_cli=true` must be added to the _gn gen_ + the argument `nxp_enable_matter_cli=true` must be added to the _gn gen_ command. - By default, the `NXP RD-RW612-BGA` board revision will be chosen. To switch to `NXP FRDM-RW612` board revision, the argument `board_version=\"frdm\"` @@ -165,18 +165,18 @@ Optional GN options that can be added when building an application: - To build the application in debug mode, the argument `is_debug=true optimize_debug=false` must be added to the _gn gen_ command. - To build with the option to have Matter certificates/keys pre-loaded in a - specific flash area the argument `chip_with_factory_data=1` must be added to - the _gn gen_ command. (for more information see - [Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). + specific flash area the argument `nxp_use_factory_data=true` must be added + to the _gn gen_ command. (for more information see + [Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md). - To build the application with the OTA Requestor enabled, the arguments `chip_enable_ota_requestor=true no_mcuboot=false` must be added to the _gn gen_ command. (More information about the OTA Requestor feature in - [OTA Requestor README](../../../../../docs/guides/nxp/nxp_rw61x_ota_software_update.md) + [OTA Requestor README](../../../../../docs/platforms/nxp/nxp_RTs_ota_software_update.md) ## Manufacturing data See -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md) +[Guide for writing manufacturing data on NXP devices](../../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) Other comments: @@ -187,13 +187,13 @@ software key before flashing them to the device flash. Using DAC private key secure usage: Experimental feature, contain some limitation: potential concurrent access issue during sign with dac key operation due to the lack of protection between multiple access to `ELS` crypto module. -The argument `chip_enable_secure_dac_private_key_storage=1` must be added to the -_gn gen_ command to enable secure private DAC key usage with S50. -`chip_with_factory_data=1` must have been added to the _gn gen_ command +The argument `nxp_enable_secure_dac_private_key_storage=true` must be added to +the _gn gen_ command to enable secure private DAC key usage with S50. +`nxp_use_factory_data=true` must have been added to the _gn gen_ command DAC private key generation: The argument `chip_convert_dac_private_key=1` must be added to the _gn gen_ command to enable DAC private plain key conversion to -blob with S50. `chip_enable_secure_dac_private_key_storage=1` must have been +blob with S50. `nxp_enable_secure_dac_private_key_storage=1` must have been added to the _gn gen_ command `ELS` contain concurrent access risks. They must be fixed before enabling it by @@ -252,7 +252,7 @@ Right click on the Project -> Debug -> As->SEGGER JLink probes -> OK -> Select e CHIP Tool is a Matter controller which can be used to commission a Matter device into the network. For more information regarding how to use the CHIP Tool controller, please refer to the -[CHIP Tool guide](../../../../../docs/guides/chip_tool_guide.md). +[CHIP Tool guide](../../../../../docs/development_controllers/chip-tool/chip_tool_guide.md). To know how to commission a device over BLE, follow the instructions from [chip-tool's README.md 'Commission a device over @@ -281,7 +281,7 @@ The "ble-thread" pairing method can be used in order to commission the device. In order to create or join a Thread network on the Matter Border Router, the TBR management cluster or the `otcli` commands from the matter CLI can be used. For more information about using the TBR management cluster follow instructions from -['Using the TBR management cluster'](../../../../../docs/guides/nxp/nxp_otbr_guide.md#using-the-thread-border-router-management-cluster). +['Using the TBR management cluster'](../../../../../docs/platforms/nxp/nxp_otbr_guide.md#using-the-thread-border-router-management-cluster). For more information about using the matter shell, follow instructions from ['Testing the all-clusters application with Matter CLI'](#testing-the-all-clusters-application-with-matter-cli-enabled). @@ -407,7 +407,7 @@ Done Over-The-Air software updates are supported with the RW61x all-clusters example. The process to follow in order to perform a software update is described in the dedicated guide -['Matter Over-The-Air Software Update with NXP RW61x example applications'](../../../../../docs/guides/nxp/nxp_rw61x_ota_software_update.md). +['Matter Over-The-Air Software Update with NXP RW61x example applications'](../../../../../docs/platforms/nxp/nxp_RTs_ota_software_update.md). @@ -417,4 +417,4 @@ To enable Thread Border Router support see the [build](README.md#building) section. The complete Border Router guide is located -[here](../../../../../docs/guides/nxp/nxp_otbr_guide.md). +[here](../../../../../docs/platforms/nxp/nxp_otbr_guide.md). diff --git a/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h b/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h index 2653e97705f..33a42909f46 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nxp/rt/rw61x/include/config/CHIPProjectConfig.h @@ -168,15 +168,6 @@ */ // #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_MAX_BINDINGS - * - * Maximum number of simultaneously active bindings per ChipExchangeManager - * 1 (Time Sync) + 2 (Two 1-way subscriptions) + 1 (Software Update) = 4 - * in the worst case. Keeping another 4 as buffer. - */ -#define CHIP_CONFIG_MAX_BINDINGS 6 - /** * CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD * diff --git a/examples/all-clusters-app/nxp/zephyr/README.md b/examples/all-clusters-app/nxp/zephyr/README.md index 54a06c62c62..2424e2cd8a7 100644 --- a/examples/all-clusters-app/nxp/zephyr/README.md +++ b/examples/all-clusters-app/nxp/zephyr/README.md @@ -38,6 +38,7 @@ The example supports: The supported boards are: - `rd_rw612_bga` +- `frdm_rw612` @@ -51,12 +52,12 @@ Prerequisites: - Follow instruction from [BUILDING.md](../../../../docs/guides/BUILDING.md) to setup the Matter environment - Follow instruction from - [Getting Started Guide](https://docs.zephyrproject.org/3.7.0/develop/getting_started/index.html) + [Getting Started Guide](https://docs.zephyrproject.org/4.0.0/develop/getting_started/index.html) to setup a Zephyr workspace, however, the west init command to use is as follows: ```shell -$ west init zephyrproject -m https://github.com/nxp-zephyr/nxp-zsdk.git --mr nxp-v3.7.0 +$ west init zephyrproject -m https://github.com/nxp-zephyr/nxp-zsdk.git --mr nxp-v4.0.0 ``` > **Note**: While some of NXP platforms are supported in Zephyr upstream, we @@ -64,10 +65,10 @@ $ west init zephyrproject -m https://github.com/nxp-zephyr/nxp-zsdk.git --mr nxp > not upstream yet. While you can decide to use nxp-zsdk top of tree, we > recommend using a proper release tag delivered by NXP. This will ensure a > certain level of quality of the nxp-zsdk in use. Currently, we highly -> recommend using the `nxp-v3.7.0` tag, based on Zephyr 3.7 LTS release. Reach -> to your NXP contact for more details. +> recommend using the `nxp-v4.0.0` tag, based on Zephyr 4.0 release. Reach to +> your NXP contact for more details. -Steps to build the example, targeting `rd_rw612_bga` board: +Steps to build the example: 1. Activate your Matter env: @@ -84,7 +85,13 @@ source /zephyr-env.sh 3. Run west build command: ```shell -west build -b rd_rw612_bga -p auto -d build_zephyr +west build -b -p auto -d build_zephyr +``` + +As an example with the `frdm_rw612` board: + +```shell +west build -b frdm_rw612 -p auto -d build_zephyr examples/all-clusters-app/nxp/zephyr ``` A folder `build_zephyr` will be created in the same folder you run the command @@ -102,7 +109,7 @@ You can get more details on `west build` with ### Flashing without debugging -`west` can be used to flash a target, as an example for `rd_rw612_bga` board: +`west` can be used to flash a target: ```shell west flash -i @@ -132,30 +139,30 @@ To debug a Matter with Zephyr application, you could use several methods: NXP Zephyr examples are not using factory data support by default. Please refer the the section below to build with factory data. -You may refer to `src/platform/nxp/zephyr/boards//.overlay` file -to obtain the memory region used by this partition. +You may refer to `.overlay` file in each examples boards folder to obtain +the memory region used by this partition. -For example, the factory data partition on `rd_rw612_bga` is reserved in the -last sector of the `flexspi` flash of `RD BGA` board, at `0x1BFFF000`. +For example, the factory data partition on `frdm_rw612` is reserved in the last +sector of the `flexspi` flash, at `0x1BFFF000`. ``` -&flexspi { - status = "okay"; +w25q512jvfiq: w25q512jvfiq@0 { + status = "okay"; + + partitions { + ... + factory_partition: partition@3FFF000 { + label = "factory-data"; + reg = <0x03FFF000 DT_SIZE_K(4)>; + }; - mx25u51245g: mx25u51245g@0 { - ... - factory_partition: partition@3FFF000 { - label = "factory-data"; - reg = <0x03FFF000 DT_SIZE_K(4)>; - }; - }; + }; }; ``` -> **Note**: You may also refer to -> `src/platform/nxp/zephyr/boards//.overlay` file to check other -> memory partitions used by the platform, such as the file system partition -> mentioned with the `storage` label. +> **Note**: You may also refer to `.overlay` file in each NXP Zephyr +> examples folder to check other memory partitions used by the platform, such as +> the file system partition mentioned with the `storage` label. ### Build with factory data support @@ -165,7 +172,7 @@ To build the example with factory data support, you can add Example: ```bash -west build -b rd_rw612_bga -p -- -DFILE_SUFFIX=fdata +west build -b -p -- -DFILE_SUFFIX=fdata ``` `prj_fdata.conf` configuration file will enable `CONFIG_CHIP_FACTORY_DATA` @@ -201,14 +208,14 @@ the partition address: please refer to `factory_partition` defined in #### Manually See -[Guide for writing manufacturing data on NXP devices](../../../../docs/guides/nxp/nxp_manufacturing_flow.md) +[Guide for writing manufacturing data on NXP devices](../../../../docs/platforms/nxp/nxp_manufacturing_flow.md) ## OTA Software Update See -[Guide for OTA Software Update on NXP devices using Zephyr SDK](../../../../docs/guides/nxp/nxp_zephyr_ota_software_update.md) +[Guide for OTA Software Update on NXP devices using Zephyr SDK](../../../../docs/platforms/nxp/nxp_zephyr_ota_software_update.md) @@ -233,13 +240,14 @@ configured for the example. The binding `zephyr,console` is used to print the logs, while the binding `zephyr,shell-uart` is used for the CLI. If the logs and the CLI are split among two serial interfaces, you will have to open both ports. -As an example, the Matter CLI on `rd_rw612_bga` is configured to be output on +As an example, the Matter CLI on `frdm_rw612` is configured to be output on `flexcomm3` with a baudrate of `115200`. The logs are configured to be output on `flexcomm0` with a baudrate of `115200`. -> **Note**: `flexcomm3` is wired to the USB `FTDI` port of the `RD BGA` board by -> default. `flexcomm0` is wired to `GPIO2` (RX) and `GPIO3` (TX). Those pins are -> accessible on `HD2` pin header. +> **Note**: `frdm_rw612` and ` frdm_rw612``flexcomm3 ` is wired to the USB +> `MCULINK` port of the board by default. `rd_rw612_bga` `flexcomm0` is wired to +> `GPIO2` (RX) and `GPIO3` (TX). Those pins are accessible on `HD2` pin header. +> `frdm_rw612` `flexcomm0` is wired to RX and TX pins located at `J5 mikroBUS`. To access the CLI console, use a serial terminal emulator of your choice, like Minicom or GNU Screen. Use the baud rate set to `115200`. diff --git a/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.conf b/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.conf new file mode 100644 index 00000000000..0ae729f051f --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.conf @@ -0,0 +1,18 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Workaround for nxp-zsdk v4.0.0 release +CONFIG_FLASH_LOAD_SIZE=0 \ No newline at end of file diff --git a/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.overlay b/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.overlay new file mode 100644 index 00000000000..1da48cb0fc3 --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.overlay @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 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. + */ + +/ { + chosen { + zephyr,console = &flexcomm0; + zephyr,shell-uart = &flexcomm3; + }; +}; + +&flexcomm0 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm0_usart>; + pinctrl-names = "default"; +}; + +&flexcomm3 { + compatible = "nxp,lpc-usart"; + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_flexcomm3_usart>; + pinctrl-names = "default"; +}; + +/delete-node/ &sram_data; +/delete-node/ &sram_code; +/delete-node/ &boot_partition; +/delete-node/ &slot0_partition; +/delete-node/ &slot1_partition; +/delete-node/ &storage_partition; + +&sram { + #address-cells = <1>; + #size-cells = <1>; + + sram_data: memory@0 { + compatible = "mmio-sram"; + reg = <0x0 DT_SIZE_K(1216)>; + }; +}; + +&flexspi { + status = "okay"; + + w25q512jvfiq: w25q512jvfiq@0 { + status = "okay"; + + partitions { + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(128)>; + }; + + slot0_partition: partition@20000 { + label = "image-0"; + reg = <0x00020000 0x440000>; + }; + + slot1_partition: partition@460000 { + label = "image-1"; + reg = <0x00460000 0x440000>; + }; + + storage_partition: partition@3FEF000 { + label = "storage"; + reg = <0x03FEF000 DT_SIZE_K(64)>; + }; + + factory_partition: partition@3FFF000 { + label = "factory-data"; + reg = <0x03FFF000 DT_SIZE_K(4)>; + }; + + }; + }; +}; diff --git a/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612_fdata.conf b/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612_fdata.conf new file mode 100644 index 00000000000..0d26dcedfe6 --- /dev/null +++ b/examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612_fdata.conf @@ -0,0 +1,26 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CONFIG_SETTINGS_NVS_SECTOR_COUNT=16 + +# 0xA226 +CONFIG_CHIP_DEVICE_PRODUCT_ID=41510 +CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/frdm-development-board-for-rw612-wi-fi-6-plus-bluetooth-low-energy-plus-802-15-4-tri-radio-wireless-mcu:FRDM-RW612" +CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612" +CONFIG_CHIP_DEVICE_PART_NUMBER="RW612" + +# Workaround for nxp-zsdk v4.0.0 release +CONFIG_FLASH_LOAD_SIZE=0 \ No newline at end of file diff --git a/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay b/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay index 41ba4fc5cd3..816de4d38b8 100644 --- a/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay +++ b/examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay @@ -38,21 +38,23 @@ pinctrl-names = "default"; }; +/delete-node/ &sram_data; +/delete-node/ &sram_code; +/delete-node/ &boot_partition; +/delete-node/ &slot0_partition; +/delete-node/ &slot1_partition; +/delete-node/ &storage_partition; + &sram { #address-cells = <1>; #size-cells = <1>; - sram_data: memory@40000 { + sram_data: memory@0 { compatible = "mmio-sram"; - reg = <0x40000 DT_SIZE_K(1216)>; + reg = <0x0 DT_SIZE_K(1216)>; }; }; -/delete-node/ &boot_partition; -/delete-node/ &slot0_partition; -/delete-node/ &slot1_partition; -/delete-node/ &fw_storage; -/delete-node/ &storage_partition; &flexspi { status = "okay"; diff --git a/examples/all-clusters-app/openiotsdk/README.md b/examples/all-clusters-app/openiotsdk/README.md index 269411f9f59..661c331f37d 100644 --- a/examples/all-clusters-app/openiotsdk/README.md +++ b/examples/all-clusters-app/openiotsdk/README.md @@ -11,7 +11,7 @@ You can use this example as a reference for creating your own application. For information on how to build, run, test and debug this example and further information about the platform it is run on see -[Open IoT SDK examples](../../../docs/guides/openiotsdk_examples.md). +[Open IoT SDK examples](../../../docs/platforms/openiotsdk/openiotsdk_examples.md). The example name to use in the scripts is `all-clusters-app`. @@ -31,7 +31,7 @@ follow traces in the terminal. ### Commissioning Read the -[Open IoT SDK commissioning guide](../../../docs/guides/openiotsdk_commissioning.md) +[Open IoT SDK commissioning guide](../../../docs/platforms/openiotsdk/openiotsdk_commissioning.md) to see how to use the Matter controller to commission and control the application. diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 332b03cbeba..59aac222816 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -53,6 +53,7 @@ source_set("chip-all-clusters-common") { deps = [ "${chip_root}/examples/all-clusters-app/all-clusters-common", "${chip_root}/examples/platform/tizen:app-main", + "${chip_root}/src/app:attribute-persistence", "${chip_root}/src/lib/shell:shell_core", ] diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 3fa32d226a4..e7c61c1c308 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -1557,6 +1557,7 @@ cluster GeneralCommissioning = 48 { provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6; provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7; provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8; + provisional readonly attribute access(read: administer) optional int32u TCUpdateDeadline = 9; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1964,7 +1965,7 @@ cluster GeneralDiagnostics = 51 { /** Take a snapshot of system time and epoch time. */ command TimeSnapshot(): TimeSnapshotResponse = 1; /** Request a variable length payload response. */ - command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; + command access(invoke: manage) PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; } /** The Software Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ @@ -2878,7 +2879,7 @@ provisional cluster ScenesManagement = 98 { /** Get an unused scene identifier when no commissioning tool is in the network, or for a commissioning tool to get the used scene identifiers within a certain group */ fabric command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6; /** Allows a client to efficiently copy scenes from one group/scene identifier pair to another group/scene identifier pair. */ - fabric command CopyScene(CopySceneRequest): CopySceneResponse = 64; + fabric command access(invoke: manage) CopyScene(CopySceneRequest): CopySceneResponse = 64; } /** An interface to a generic way to secure a door */ @@ -6274,7 +6275,6 @@ endpoint 0 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -6295,7 +6295,6 @@ endpoint 0 { callback attribute accessControlEntriesPerFabric; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; callback attribute clusterRevision; @@ -6320,7 +6319,6 @@ endpoint 0 { callback attribute maxPathsPerInvoke; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 3; @@ -6345,7 +6343,6 @@ endpoint 0 { callback attribute supportedLocales; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -6355,7 +6352,6 @@ endpoint 0 { persist attribute hourFormat default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -6364,7 +6360,6 @@ endpoint 0 { server cluster UnitLocalization { callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -6377,7 +6372,6 @@ endpoint 0 { callback attribute endpointList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 2; @@ -6391,7 +6385,6 @@ endpoint 0 { callback attribute supportsConcurrentConnection; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -6418,7 +6411,6 @@ endpoint 0 { callback attribute threadVersion; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 2; ram attribute clusterRevision default = 1; @@ -6448,7 +6440,6 @@ endpoint 0 { callback attribute testEventTriggersEnabled; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -6519,7 +6510,6 @@ endpoint 0 { callback attribute adminVendorId; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -6537,7 +6527,6 @@ endpoint 0 { callback attribute currentFabricIndex; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -6563,7 +6552,6 @@ endpoint 0 { callback attribute maxGroupKeysPerFabric; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -6606,7 +6594,6 @@ endpoint 1 { ram attribute identifyType default = 0x0; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -6619,7 +6606,6 @@ endpoint 1 { ram attribute nameSupport; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -6644,7 +6630,6 @@ endpoint 1 { persist attribute startUpOnOff default = 0xFF; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 5; @@ -6683,7 +6668,6 @@ endpoint 1 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -6709,7 +6693,6 @@ endpoint 1 { callback attribute endpointList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 2; @@ -6772,7 +6755,6 @@ endpoint 1 { callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 1; ram attribute clusterRevision default = 1; @@ -7180,7 +7162,6 @@ endpoint 2 { ram attribute identifyType default = 0x00; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -7193,7 +7174,6 @@ endpoint 2 { ram attribute nameSupport; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 4; @@ -7218,7 +7198,6 @@ endpoint 2 { ram attribute startUpOnOff; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0x0000; ram attribute clusterRevision default = 5; @@ -7238,7 +7217,6 @@ endpoint 2 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -7251,7 +7229,6 @@ endpoint 2 { callback attribute endpointList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 2; @@ -7263,7 +7240,6 @@ endpoint 2 { callback attribute fabricSceneInfo; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 1; ram attribute clusterRevision default = 1; @@ -7302,7 +7278,6 @@ endpoint 65534 { callback attribute partsList; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; @@ -7319,7 +7294,6 @@ endpoint 65534 { callback attribute lastConnectErrorValue; callback attribute generatedCommandList; callback attribute acceptedCommandList; - callback attribute eventList; callback attribute attributeList; callback attribute featureMap default = 0; callback attribute clusterRevision default = 1; diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index b120d9c4bfe..731168b86a6 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:81 + $ docker pull ghcr.io/project-chip/chip-build-ameba:97 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:81 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:97 ``` - Setup build environment: diff --git a/examples/all-clusters-minimal-app/ameba/chip_main.cmake b/examples/all-clusters-minimal-app/ameba/chip_main.cmake index a2d1e364d63..d60f4f58994 100755 --- a/examples/all-clusters-minimal-app/ameba/chip_main.cmake +++ b/examples/all-clusters-minimal-app/ameba/chip_main.cmake @@ -128,9 +128,9 @@ endif (matter_enable_ota_requestor) list( APPEND ${list_chip_main_sources} - ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/bridged-actions-stub.cpp - ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/smco-stub.cpp - ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/static-supported-modes-manager.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp + ${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp @@ -176,6 +176,7 @@ target_include_directories( ${chip_dir}/examples/all-clusters-app/all-clusters-common ${chip_dir}/examples/all-clusters-app/all-clusters-common/include ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/include + ${chip_dir}/examples/platform/ameba/observer ${chip_dir_output}/gen/include ${chip_dir}/src/include/ ${chip_dir}/src/lib/ diff --git a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp index 61f7db147f8..8f18742ca5b 100644 --- a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp @@ -17,6 +17,7 @@ #include +#include "AmebaObserver.h" #include "CHIPDeviceManager.h" #include "DeviceCallbacks.h" #include "Globals.h" @@ -31,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -157,6 +159,11 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); + + static AmebaObserver sAmebaObserver; + initParams.appDelegate = &sAmebaObserver; + chip::Server::GetInstance().Init(initParams); // Initialize device attestation config @@ -173,6 +180,7 @@ static void InitServer(intptr_t context) PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); } Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); + chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAmebaObserver); } extern "C" void ChipTest(void) diff --git a/examples/all-clusters-minimal-app/asr/README.md b/examples/all-clusters-minimal-app/asr/README.md index 5160ef5d4d5..2a411c728a9 100755 --- a/examples/all-clusters-minimal-app/asr/README.md +++ b/examples/all-clusters-minimal-app/asr/README.md @@ -14,7 +14,7 @@ control on ASR platform. ## Building and Commissioning Please refer -[Building and Commissioning](../../../docs/guides/asr_getting_started_guide.md#building-the-example-application) +[Building and Commissioning](../../../docs/platforms/asr/asr_getting_started_guide.md#building-the-example-application) guides to get started ``` diff --git a/examples/all-clusters-minimal-app/esp32/README.md b/examples/all-clusters-minimal-app/esp32/README.md index 6cb3f9093da..4b5ca4ea729 100644 --- a/examples/all-clusters-minimal-app/esp32/README.md +++ b/examples/all-clusters-minimal-app/esp32/README.md @@ -4,16 +4,16 @@ A prototype application that demonstrates device commissioning and cluster control. Please -[setup ESP-IDF and CHIP Environment](../../../docs/guides/esp32/setup_idf_chip.md) +[setup ESP-IDF and CHIP Environment](../../../docs/platforms/esp32/setup_idf_chip.md) and refer -[building and commissioning](../../../docs/guides/esp32/build_app_and_commission.md) +[building and commissioning](../../../docs/platforms/esp32/build_app_and_commission.md) guides to get started. --- - [Cluster control](#cluster-control) -- [Matter OTA guide](../../../docs/guides/esp32/ota.md) -- [RPC console and Device Tracing](../../../docs/guides/esp32/rpc_console.md) +- [Matter OTA guide](../../../docs/platforms/esp32/ota.md) +- [RPC console and Device Tracing](../../../docs/platforms/esp32/rpc_console.md) --- diff --git a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt index f82f301e3ae..b3f1dc90484 100644 --- a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt @@ -16,95 +16,39 @@ # # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) -# The list of src and include dirs must be in sync with that in all-clusters-minimal-app/esp32/main/component.mk -set(PRIV_INCLUDE_DIRS_LIST - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/include" - "${CMAKE_CURRENT_LIST_DIR}/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" + +get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) +get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH) +get_filename_component(ENERGY_MANAGEMENT_COMMON_DIR ${CHIP_ROOT}/examples/energy-management-app/energy-management-common/ REALPATH) +get_filename_component(APP_COMMON_GEN_DIR ${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated REALPATH) + +set(PRIV_INCLUDE_DIRS_LIST "${ALL_CLUSTERS_COMMON_DIR}/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/common/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/include" + "${ENERGY_MANAGEMENT_COMMON_DIR}/energy-reporting/include" + "${CMAKE_CURRENT_LIST_DIR}/include" + "${CHIP_ROOT}/examples/providers" + "${CHIP_ROOT}/examples/platform/esp32" ) -set(SRC_DIRS_LIST - "${CMAKE_CURRENT_LIST_DIR}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/application-basic-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/account-login-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/application-launcher-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/audio-output-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/window-covering-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/color-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/content-launch-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/media-input-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/mode-select-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/low-power-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/keypad-input-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/media-playback-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/target-navigator-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/channel-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/smoke-co-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/device-energy-management-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/energy-evse-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/resource-monitoring-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" +set(SRC_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}" + "${APP_COMMON_GEN_DIR}/attributes" + "${APP_COMMON_GEN_DIR}" + "${CHIP_ROOT}/examples/platform/esp32/ota" + "${CHIP_ROOT}/examples/platform/esp32/common" + "${CHIP_ROOT}/examples/platform/esp32/shell_extension" + "${CHIP_ROOT}/examples/providers" + "${ALL_CLUSTERS_COMMON_DIR}/src" ) if(CONFIG_ENABLE_PW_RPC) # Append additional directories for RPC build set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/pw_sys_io/public" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support" + "${CHIP_ROOT}/examples/platform/esp32/pw_sys_io/public" + "${CHIP_ROOT}/examples/common" + "${CHIP_ROOT}/examples/common/pigweed" + "${CHIP_ROOT}/examples/common/pigweed/esp32" + "${CHIP_ROOT}/src/lib/support" ) if(${IDF_VERSION_MAJOR} LESS 5) @@ -114,21 +58,20 @@ if(CONFIG_ENABLE_PW_RPC) endif() set(SRC_DIRS_LIST "${SRC_DIRS_LIST}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" + "${CHIP_ROOT}/examples/platform/esp32" + "${CHIP_ROOT}/examples/common/pigweed" + "${CHIP_ROOT}/examples/common/pigweed/esp32" ) endif(CONFIG_ENABLE_PW_RPC) idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST} SRC_DIRS ${SRC_DIRS_LIST}) -get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) -include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake") - -chip_app_component_codegen("${CHIP_ROOT}/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter") -chip_app_component_zapgen("${CHIP_ROOT}/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap") +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) +chip_configure_data_model(${COMPONENT_LIB} + ZAP_FILE ${CHIP_ROOT}/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +) set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/all-clusters-minimal-app/esp32/main/main.cpp b/examples/all-clusters-minimal-app/esp32/main/main.cpp index 4972e775bd6..6066b21032f 100644 --- a/examples/all-clusters-minimal-app/esp32/main/main.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/main.cpp @@ -186,7 +186,6 @@ extern "C" void app_main() ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed : %" CHIP_ERROR_FORMAT, error.Format()); } - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); } diff --git a/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults b/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults index c551c966de3..ef68a68f15a 100644 --- a/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults +++ b/examples/all-clusters-minimal-app/esp32/sdkconfig.defaults @@ -19,14 +19,6 @@ # Some useful defaults for the demo app configuration. # - -# Default to 921600 baud when flashing and monitoring device -CONFIG_ESPTOOLPY_BAUD_921600B=y -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 - #enable BT CONFIG_BT_ENABLED=y CONFIG_BT_NIMBLE_ENABLED=y diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/README.md b/examples/all-clusters-minimal-app/infineon/psoc6/README.md index 80b8e1ceb66..7dc9fccf009 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/README.md +++ b/examples/all-clusters-minimal-app/infineon/psoc6/README.md @@ -126,4 +126,4 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode. For the description of Software Update process with infineon PSoC6 example applications see -[Infineon PSoC6 OTA Software Update](../../../../docs/guides/infineon_psoc6_software_update.md) +[Infineon PSoC6 OTA Software Update](../../../../docs/platforms/infineon/infineon_psoc6_software_update.md) diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp index 56327c56dd9..1c0008b63bb 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -127,6 +128,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); chip::Server::GetInstance().Init(initParams); // We only have network commissioning on endpoint 0. diff --git a/examples/all-clusters-minimal-app/linux/AppOptions.cpp b/examples/all-clusters-minimal-app/linux/AppOptions.cpp index c3f80a2302a..617d1f5fa30 100644 --- a/examples/all-clusters-minimal-app/linux/AppOptions.cpp +++ b/examples/all-clusters-minimal-app/linux/AppOptions.cpp @@ -25,19 +25,13 @@ using chip::ArgParser::OptionDef; using chip::ArgParser::OptionSet; using chip::ArgParser::PrintArgError; -constexpr uint16_t kOptionDacProviderFilePath = 0xFF01; constexpr uint16_t kOptionMinCommissioningTimeout = 0xFF02; -static chip::Credentials::Examples::TestHarnessDACProvider mDacProvider; - bool AppOptions::HandleOptions(const char * program, OptionSet * options, int identifier, const char * name, const char * value) { bool retval = true; switch (identifier) { - case kOptionDacProviderFilePath: - mDacProvider.Init(value); - break; case kOptionMinCommissioningTimeout: { auto & commissionMgr = chip::Server::GetInstance().GetCommissioningWindowManager(); commissionMgr.OverrideMinCommissioningTimeout(chip::System::Clock::Seconds16(static_cast(atoi(value)))); @@ -55,23 +49,14 @@ bool AppOptions::HandleOptions(const char * program, OptionSet * options, int id OptionSet * AppOptions::GetOptions() { static OptionDef optionsDef[] = { - { "dac_provider", chip::ArgParser::kArgumentRequired, kOptionDacProviderFilePath }, { "min_commissioning_timeout", chip::ArgParser::kArgumentRequired, kOptionMinCommissioningTimeout }, {}, }; static OptionSet options = { AppOptions::HandleOptions, optionsDef, "PROGRAM OPTIONS", - " --dac_provider \n" - " A json file with data used by the example dac provider to validate device attestation procedure.\n" " --min_commissioning_timeout \n" " The minimum time in seconds during which commissioning session establishment is allowed by the Node.\n" }; - return &options; } - -chip::Credentials::DeviceAttestationCredentialsProvider * AppOptions::GetDACProvider() -{ - return &mDacProvider; -} diff --git a/examples/all-clusters-minimal-app/linux/AppOptions.h b/examples/all-clusters-minimal-app/linux/AppOptions.h index 3073c661763..e8088429ad3 100644 --- a/examples/all-clusters-minimal-app/linux/AppOptions.h +++ b/examples/all-clusters-minimal-app/linux/AppOptions.h @@ -20,13 +20,10 @@ #include "AppMain.h" -#include - class AppOptions { public: static chip::ArgParser::OptionSet * GetOptions(); - static chip::Credentials::DeviceAttestationCredentialsProvider * GetDACProvider(); private: static bool HandleOptions(const char * program, chip::ArgParser::OptionSet * options, int identifier, const char * name, diff --git a/examples/all-clusters-minimal-app/linux/BUILD.gn b/examples/all-clusters-minimal-app/linux/BUILD.gn index ea25284906d..e7e76e1c246 100644 --- a/examples/all-clusters-minimal-app/linux/BUILD.gn +++ b/examples/all-clusters-minimal-app/linux/BUILD.gn @@ -34,7 +34,6 @@ source_set("chip-all-clusters-common") { deps = [ "${chip_root}/examples/all-clusters-minimal-app/all-clusters-common", "${chip_root}/examples/platform/linux:app-main", - "${chip_root}/src/app/tests/suites/credentials:dac_provider", "${chip_root}/src/lib", ] diff --git a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp index b1736826ef3..4e6b3902258 100644 --- a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp @@ -17,6 +17,7 @@ #include "AppMain.h" #include +#include using namespace chip; using namespace chip::DeviceLayer; @@ -43,6 +44,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize) // ChipLinuxAppMainLoop blocks, and we don't want that here. static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); ApplicationInit(); diff --git a/examples/all-clusters-minimal-app/linux/main.cpp b/examples/all-clusters-minimal-app/linux/main.cpp index 766a5820d0e..493a497e1bc 100644 --- a/examples/all-clusters-minimal-app/linux/main.cpp +++ b/examples/all-clusters-minimal-app/linux/main.cpp @@ -31,8 +31,6 @@ int main(int argc, char * argv[]) ChipLinuxAppInit(argc, argv, AppOptions::GetOptions(), chip::MakeOptional(kNetworkCommissioningEndpointSecondary)) == 0); VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR); - LinuxDeviceOptions::GetInstance().dacProvider = AppOptions::GetDACProvider(); - ChipLinuxAppMainLoop(); return 0; } diff --git a/examples/all-clusters-minimal-app/mbed/README.md b/examples/all-clusters-minimal-app/mbed/README.md index d4096cbde2f..86226548a95 100644 --- a/examples/all-clusters-minimal-app/mbed/README.md +++ b/examples/all-clusters-minimal-app/mbed/README.md @@ -225,7 +225,8 @@ traces in the terminal. ### CHIP Tools -Read the [MbedCommissioning](../../../docs/guides/mbedos_commissioning.md) to +Read the +[MbedCommissioning](../../../docs/platforms/mbedos/mbedos_commissioning.md) to see how to use different CHIP tools to commission and control the application within a WiFi network. @@ -239,7 +240,7 @@ within a WiFi network. - More details and guidelines about porting new hardware into the Matter project with Mbed OS can be found in - [MbedNewTarget](../../../docs/guides/mbedos_add_new_target.md) + [MbedNewTarget](../../../docs/platforms/mbedos/mbedos_add_new_target.md) - Some useful information about HW platform specific settings can be found in `all-clusters-minimal-app/mbed/mbed_app.json`. Information about this file syntax and its meaning in mbed-os project can be diff --git a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp index eb1188b93aa..81f5f15a59c 100644 --- a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp @@ -19,12 +19,13 @@ #include "AppTask.h" #include "LEDWidget.h" #include -#include #include +#include #include #include #include +#include #include #include @@ -67,7 +68,8 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - error = Server::GetInstance().Init(initParams); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); + error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Server initialization failed: %s", error.AsString()); diff --git a/examples/all-clusters-minimal-app/nrfconnect/README.md b/examples/all-clusters-minimal-app/nrfconnect/README.md index 932db10a2f2..b9d44a889f1 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/README.md +++ b/examples/all-clusters-minimal-app/nrfconnect/README.md @@ -41,7 +41,7 @@ This example is running on the nRF Connect platform, which is based on Nordic Semiconductor's [nRF Connect SDK](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/index.html) and [Zephyr RTOS](https://zephyrproject.org/). Visit Matter's -[nRF Connect platform overview](../../../docs/guides/nrfconnect_platform_overview.md) +[nRF Connect platform overview](../../../docs/platforms/nrf/nrfconnect_platform_overview.md) to read more about the platform structure and dependencies. By default, the Matter accessory device has IPv6 networking disabled. You must @@ -144,7 +144,7 @@ for the predefined period of time (15 minutes by default). **SEGGER J-Link USB port** can be used to get logs from the device or communicate with it using the -[command line interface](../../../docs/guides/nrfconnect_examples_cli.md). +[command line interface](../../../docs/platforms/nrf/nrfconnect_examples_cli.md).
@@ -371,7 +371,7 @@ depending on the selected board: those platforms support the DFU. For more information, see the -[Configuring nRF Connect SDK examples](../../../docs/guides/nrfconnect_examples_configuration.md) +[Configuring nRF Connect SDK examples](../../../docs/platforms/nrf/nrfconnect_examples_configuration.md) page.
@@ -406,19 +406,20 @@ to read more about flashing on the nRF52840 Dongle. ## Testing the example -Check the [CLI tutorial](../../../docs/guides/nrfconnect_examples_cli.md) to -learn how to use command-line interface of the application. +Check the [CLI tutorial](../../../docs/platforms/nrf/nrfconnect_examples_cli.md) +to learn how to use command-line interface of the application. ### Testing using Linux CHIPTool -Read the [CHIP Tool user guide](../../../docs/guides/chip_tool_guide.md) to see -how to use [CHIP Tool for Linux or mac OS](../../chip-tool/README.md) to +Read the +[CHIP Tool user guide](../../../docs/development_controllers/chip-tool/chip_tool_guide.md) +to see how to use [CHIP Tool for Linux or mac OS](../../chip-tool/README.md) to commission and control the application within a Matter-enabled Thread network. ### Testing using Android CHIPTool Read the -[Android commissioning guide](../../../docs/guides/nrfconnect_android_commissioning.md) +[Android commissioning guide](../../../docs/platforms/nrf/nrfconnect_android_commissioning.md) to see how to use [CHIPTool](../../../examples/android/CHIPTool/README.md) for Android smartphones to commission and control the application within a Matter-enabled Thread network. diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index be858eae561..64331a3200c 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -173,6 +174,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); @@ -406,10 +408,10 @@ void AppTask::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* arg */ switch (event->Type) { case DeviceEventType::kCHIPoBLEAdvertisingChange: -#ifdef CONFIG_CHIP_NFC_COMMISSIONING +#ifdef CONFIG_CHIP_NFC_ONBOARDING_PAYLOAD if (event->CHIPoBLEAdvertisingChange.Result == kActivity_Started) { - if (NFCMgr().IsTagEmulationStarted()) + if (NFCOnboardingPayloadMgr().IsTagEmulationStarted()) { LOG_INF("NFC Tag emulation is already started"); } @@ -420,7 +422,7 @@ void AppTask::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* arg */ } else if (event->CHIPoBLEAdvertisingChange.Result == kActivity_Stopped) { - NFCMgr().StopTagEmulation(); + NFCOnboardingPayloadMgr().StopTagEmulation(); } #endif sHaveBLEConnections = ConnectivityMgr().NumBLEConnections() != 0; diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp index 400f9b30e0d..77d7bd785f9 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp @@ -33,9 +33,9 @@ static int InitUSB() { int err = usb_enable(nullptr); - if (err) + if ((err != 0) && (err != -EALREADY)) { - LOG_ERR("Failed to initialize USB device"); + LOG_ERR("Failed to initialize USB device %d", err); return err; } diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj.conf b/examples/all-clusters-minimal-app/nrfconnect/prj.conf index 58dae15804f..9e738ba64d1 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj.conf @@ -55,3 +55,6 @@ CONFIG_CHIP_QSPI_NOR=n # Enable Factory Data feature CONFIG_CHIP_FACTORY_DATA=y CONFIG_CHIP_FACTORY_DATA_BUILD=y + +# Increase the settings partition +CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000 diff --git a/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md b/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md index e20ff1065d3..01941f58e74 100644 --- a/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md +++ b/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md @@ -1,4 +1,4 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) +[README document](../../../../../docs/platforms/nxp/nxp_imx8m_linux_examples.md) for details. diff --git a/examples/all-clusters-minimal-app/tizen/.gn b/examples/all-clusters-minimal-app/tizen/.gn deleted file mode 100644 index edd34d34bd1..00000000000 --- a/examples/all-clusters-minimal-app/tizen/.gn +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/build.gni") - -# The location of the build configuration file. -buildconfig = "${build_root}/config/BUILDCONFIG.gn" - -# CHIP uses angle bracket includes. -check_system_includes = true - -default_args = { - target_os = "tizen" - - import("//args.gni") -} diff --git a/examples/all-clusters-minimal-app/tizen/BUILD.gn b/examples/all-clusters-minimal-app/tizen/BUILD.gn deleted file mode 100644 index 99f857e8630..00000000000 --- a/examples/all-clusters-minimal-app/tizen/BUILD.gn +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/chip.gni") -import("//build_overrides/tizen.gni") - -import("${chip_root}/build/chip/tools.gni") -import("${chip_root}/src/app/common_flags.gni") - -import("${tizen_sdk_build_root}/tizen_sdk.gni") -assert(chip_build_tools) - -source_set("chip-all-clusters-common") { - sources = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - ] - - deps = [ - "${chip_root}/examples/all-clusters-minimal-app/all-clusters-common", - "${chip_root}/examples/platform/tizen:app-main", - "${chip_root}/src/lib/shell:shell_core", - ] - - include_dirs = - [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ] -} - -executable("chip-all-clusters-minimal-app") { - sources = [ - "include/CHIPProjectAppConfig.h", - "src/main.cpp", - ] - - deps = [ - ":chip-all-clusters-common", - "${chip_root}/examples/all-clusters-minimal-app/all-clusters-common", - "${chip_root}/examples/platform/tizen:app-main", - "${chip_root}/src/lib", - ] - - include_dirs = [ - "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "include", - ] - - output_dir = root_out_dir -} - -tizen_sdk_package("chip-all-clusters-minimal-app:tpk") { - deps = [ - ":chip-all-clusters-minimal-app", - "${chip_root}/examples/platform/tizen:author-certificate-CHIP", - ] - manifest = "tizen-manifest.xml" - sign_security_profile = "CHIP" -} - -group("tizen") { - deps = [ ":chip-all-clusters-minimal-app" ] -} - -group("tizen:tpk") { - deps = [ ":chip-all-clusters-minimal-app:tpk" ] -} - -group("default") { - deps = [ ":tizen" ] -} diff --git a/examples/all-clusters-minimal-app/tizen/args.gni b/examples/all-clusters-minimal-app/tizen/args.gni deleted file mode 100644 index bf1ef5219e5..00000000000 --- a/examples/all-clusters-minimal-app/tizen/args.gni +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/chip.gni") - -import("${chip_root}/config/standalone/args.gni") - -chip_device_project_config_include = "" -chip_project_config_include = "" -chip_system_project_config_include = "" - -chip_project_config_include_dirs = - [ "${chip_root}/examples/all-clusters-minimal-app/tizen/include" ] -chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] diff --git a/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h b/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h deleted file mode 100644 index cecc041dc2d..00000000000 --- a/examples/all-clusters-minimal-app/tizen/include/CHIPProjectAppConfig.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * Copyright (c) 2020 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. - */ - -/** - * @file - * Example project configuration file for CHIP. - * - * This is a place to put application or project-specific overrides - * to the default configuration values for general CHIP features. - * - */ - -#pragma once - -// include the CHIPProjectConfig from config/standalone -#include diff --git a/examples/all-clusters-minimal-app/tizen/src/main.cpp b/examples/all-clusters-minimal-app/tizen/src/main.cpp deleted file mode 100644 index 2d37747fe82..00000000000 --- a/examples/all-clusters-minimal-app/tizen/src/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright (c) 2020 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 -#include -#include - -#include -#include - -using namespace chip; -using namespace chip::app; -using namespace chip::DeviceLayer; - -// Network commissioning -namespace { -constexpr EndpointId kNetworkCommissioningEndpointMain = 0; -constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; - -NetworkCommissioning::TizenEthernetDriver sEthernetDriver; -Clusters::ModeSelect::StaticSupportedModesManager sStaticSupportedModesManager; -Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver); -} // namespace - -void ApplicationInit() -{ - // Enable secondary endpoint only when we need it. - emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); - - sEthernetNetworkCommissioningInstance.Init(); - Clusters::ModeSelect::setSupportedModesManager(&sStaticSupportedModesManager); -} - -void ApplicationShutdown(){}; - -int main(int argc, char * argv[]) -{ - TizenServiceAppMain app; - VerifyOrDie(app.Init(argc, argv) == 0); - - VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR); - - return app.RunMainLoop(); -} diff --git a/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml b/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml deleted file mode 100644 index cbd365aec78..00000000000 --- a/examples/all-clusters-minimal-app/tizen/tizen-manifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - http://tizen.org/privilege/bluetooth - http://tizen.org/privilege/internet - http://tizen.org/privilege/network.get - http://tizen.org/privilege/network.set - http://tizen.org/privilege/network.profile - - true - true - true - true - true - diff --git a/examples/android/CHIPTest/BUILD.gn b/examples/android/CHIPTest/BUILD.gn index c8ccb2e614c..7dee07e6f69 100644 --- a/examples/android/CHIPTest/BUILD.gn +++ b/examples/android/CHIPTest/BUILD.gn @@ -39,6 +39,7 @@ shared_library("jni") { "${chip_root}/src/platform/android:java", "${chip_root}/src/platform/android:logging", "${chip_root}/src/platform/tests:tests", + "${chip_root}/src/pw_backends/assert:assert.impl", "${chip_root}/third_party/inipp", "${chip_root}/third_party/nlfaultinjection:nlfaultinjection", ] diff --git a/examples/android/CHIPTest/args.gni b/examples/android/CHIPTest/args.gni index df7c34af9c2..04ba876aeb7 100644 --- a/examples/android/CHIPTest/args.gni +++ b/examples/android/CHIPTest/args.gni @@ -28,8 +28,8 @@ chip_monolithic_tests = false pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" -pw_assert_BACKEND = "$dir_pw_assert_log" -pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "${chip_root}/src/pw_backends/assert" +pw_log_BACKEND = "${chip_root}/src/pw_backends/log" pw_unit_test_BACKEND = "$dir_pw_unit_test:light" diff --git a/examples/android/CHIPTool/README.md b/examples/android/CHIPTool/README.md index cbd0caa5989..415dc467d86 100644 --- a/examples/android/CHIPTool/README.md +++ b/examples/android/CHIPTool/README.md @@ -15,4 +15,5 @@ CHIPTool offers the following features: > pairing is implemented. For information about how to build the application, see the -[Building Android CHIPTool](../../../docs/guides/android_building.md) guide. +[Building Android CHIPTool](../../../docs/platforms/android/android_building.md) +guide. diff --git a/examples/android/CHIPTool/app/src/main/AndroidManifest.xml b/examples/android/CHIPTool/app/src/main/AndroidManifest.xml index 0526dc5a781..efd089817ef 100644 --- a/examples/android/CHIPTool/app/src/main/AndroidManifest.xml +++ b/examples/android/CHIPTool/app/src/main/AndroidManifest.xml @@ -46,6 +46,15 @@ + + + diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt index 69bfdc10991..09c3f85a454 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt @@ -72,9 +72,11 @@ class SelectActionFragment : Fragment() { binding.provisionCustomFlowBtn.setOnClickListener { handleProvisionCustomFlowClicked() } binding.wildcardBtn.setOnClickListener { handleWildcardClicked() } binding.unpairDeviceBtn.setOnClickListener { handleUnpairDeviceClicked() } + binding.diagnosticLogBtn.setOnClickListener { handleDiagnosticLogClicked() } binding.groupSettingBtn.setOnClickListener { handleGroupSettingClicked() } binding.otaProviderBtn.setOnClickListener { handleOTAProviderClicked() } binding.icdBtn.setOnClickListener { handleICDClicked() } + binding.modeSelectBtn.setOnClickListener { handleModeSelectClicked() } return binding.root } @@ -225,6 +227,10 @@ class SelectActionFragment : Fragment() { showFragment(OtaProviderClientFragment.newInstance()) } + private fun handleDiagnosticLogClicked() { + showFragment(DiagnosticLogFragment.newInstance()) + } + /** Notifies listener of provision-WiFi-credentials button click. */ private fun handleProvisionWiFiCredentialsClicked() { getCallback()?.setNetworkType(ProvisionNetworkType.WIFI) @@ -250,6 +256,10 @@ class SelectActionFragment : Fragment() { showFragment(ICDFragment.newInstance()) } + private fun handleModeSelectClicked() { + showFragment(ModeSelectClientFragment.newInstance()) + } + companion object { @JvmStatic fun newInstance() = SelectActionFragment() diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/DiagnosticLogFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/DiagnosticLogFragment.kt new file mode 100644 index 00000000000..ea7d5438d24 --- /dev/null +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/DiagnosticLogFragment.kt @@ -0,0 +1,172 @@ +package com.google.chip.chiptool.clusterclient + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.os.Environment +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ArrayAdapter +import androidx.core.content.FileProvider +import androidx.fragment.app.Fragment +import androidx.lifecycle.lifecycleScope +import chip.devicecontroller.ChipDeviceController +import chip.devicecontroller.DiagnosticLogType +import chip.devicecontroller.DownloadLogCallback +import com.google.chip.chiptool.ChipClient +import com.google.chip.chiptool.R +import com.google.chip.chiptool.databinding.DiagnosticLogFragmentBinding +import java.io.File +import java.io.FileOutputStream +import java.io.IOException +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch + +class DiagnosticLogFragment : Fragment() { + private val deviceController: ChipDeviceController + get() = ChipClient.getDeviceController(requireContext()) + + private lateinit var scope: CoroutineScope + + private lateinit var addressUpdateFragment: AddressUpdateFragment + + private var _binding: DiagnosticLogFragmentBinding? = null + private val binding + get() = _binding!! + + private val timeout: Long + get() = binding.timeoutEd.text.toString().toULongOrNull()?.toLong() ?: 0L + + private val diagnosticLogTypeList = DiagnosticLogType.values() + private val diagnosticLogType: DiagnosticLogType + get() = diagnosticLogTypeList[binding.diagnosticTypeSp.selectedItemPosition] + + private var mDownloadFile: File? = null + private var mDownloadFileOutputStream: FileOutputStream? = null + + private var mReceiveFileLen = 0U + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = DiagnosticLogFragmentBinding.inflate(inflater, container, false) + scope = viewLifecycleOwner.lifecycleScope + + addressUpdateFragment = + childFragmentManager.findFragmentById(R.id.addressUpdateFragment) as AddressUpdateFragment + + binding.getDiagnosticLogBtn.setOnClickListener { scope.launch { getDiagnosticLogClick() } } + + binding.diagnosticTypeSp.adapter = + ArrayAdapter( + requireContext(), + android.R.layout.simple_spinner_dropdown_item, + diagnosticLogTypeList + ) + + return binding.root + } + + override fun onDestroyView() { + super.onDestroyView() + _binding = null + } + + inner class ChipDownloadLogCallback : DownloadLogCallback { + override fun onError(fabricIndex: Int, nodeId: Long, errorCode: Long) { + Log.d(TAG, "onError: $fabricIndex, ${nodeId.toULong()}, $errorCode") + showMessage("Downloading Failed") + mDownloadFileOutputStream?.flush() ?: return + } + + override fun onSuccess(fabricIndex: Int, nodeId: Long) { + Log.d(TAG, "onSuccess: $fabricIndex, ${nodeId.toULong()}") + mDownloadFileOutputStream?.flush() ?: return + showMessage("Downloading Completed") + mDownloadFile?.let { showNotification(it) } ?: return + } + + override fun onTransferData(fabricIndex: Int, nodeId: Long, data: ByteArray): Boolean { + Log.d(TAG, "onTransferData : ${data.size}") + if (mDownloadFileOutputStream == null) { + Log.d(TAG, "mDownloadFileOutputStream or mDownloadFile is null") + return false + } + return addData(mDownloadFileOutputStream!!, data) + } + + private fun addData(outputStream: FileOutputStream, data: ByteArray): Boolean { + try { + outputStream.write(data) + } catch (e: IOException) { + Log.d(TAG, "IOException", e) + return false + } + mReceiveFileLen += data.size.toUInt() + showMessage("Receive Data Size : $mReceiveFileLen") + return true + } + } + + private fun getDiagnosticLogClick() { + mDownloadFile = + createLogFile( + deviceController.fabricIndex.toUInt(), + addressUpdateFragment.deviceId.toULong(), + diagnosticLogType + ) + mDownloadFileOutputStream = FileOutputStream(mDownloadFile) + deviceController.downloadLogFromNode( + addressUpdateFragment.deviceId, + diagnosticLogType, + timeout, + ChipDownloadLogCallback() + ) + } + + private fun isExternalStorageWritable(): Boolean { + return Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED + } + + private fun createLogFile(fabricIndex: UInt, nodeId: ULong, type: DiagnosticLogType): File? { + if (!isExternalStorageWritable()) { + return null + } + val now = System.currentTimeMillis() + val fileName = "${type}_${fabricIndex}_${nodeId}_$now.txt" + mReceiveFileLen = 0U + return File(requireContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS), fileName) + } + + private fun showNotification(file: File) { + val intent = + Intent(Intent.ACTION_VIEW).apply { + setDataAndType(getFileUri(file), "text/plain") + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + } + + requireActivity().startActivity(intent) + } + + private fun getFileUri(file: File): Uri { + return FileProvider.getUriForFile( + requireContext(), + "${requireContext().packageName}.provider", + file + ) + } + + private fun showMessage(msg: String) { + requireActivity().runOnUiThread { binding.diagnosticLogTv.text = msg } + } + + companion object { + private const val TAG = "DiagnosticLogFragment" + + fun newInstance(): DiagnosticLogFragment = DiagnosticLogFragment() + } +} diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/ModeSelectClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/ModeSelectClientFragment.kt new file mode 100644 index 00000000000..e19e0fe0a58 --- /dev/null +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/ModeSelectClientFragment.kt @@ -0,0 +1,297 @@ +package com.google.chip.chiptool.clusterclient + +import android.os.Bundle +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ArrayAdapter +import android.widget.EditText +import android.widget.TextView +import android.widget.Toast +import androidx.fragment.app.Fragment +import androidx.lifecycle.lifecycleScope +import chip.devicecontroller.ChipClusters +import chip.devicecontroller.ChipDeviceController +import chip.devicecontroller.ClusterIDMapping +import chip.devicecontroller.ClusterIDMapping.ModeSelect +import chip.devicecontroller.ReportCallback +import chip.devicecontroller.WriteAttributesCallback +import chip.devicecontroller.cluster.structs.ModeSelectClusterModeOptionStruct +import chip.devicecontroller.model.AttributeState +import chip.devicecontroller.model.AttributeWriteRequest +import chip.devicecontroller.model.ChipAttributePath +import chip.devicecontroller.model.ChipEventPath +import chip.devicecontroller.model.ChipPathId +import chip.devicecontroller.model.NodeState +import chip.devicecontroller.model.Status +import com.google.chip.chiptool.ChipClient +import com.google.chip.chiptool.R +import com.google.chip.chiptool.databinding.ModeSelectFragmentBinding +import java.util.Optional +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch +import matter.tlv.AnonymousTag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ModeSelectClientFragment : Fragment() { + private val deviceController: ChipDeviceController + get() = ChipClient.getDeviceController(requireContext()) + + private lateinit var scope: CoroutineScope + + private lateinit var addressUpdateFragment: AddressUpdateFragment + + private var _binding: ModeSelectFragmentBinding? = null + + private val startUpMode: UInt + get() = binding.startUpModeEd.text.toString().toUIntOrNull() ?: 0U + + private val onMode: UInt + get() = binding.onModeEd.text.toString().toUIntOrNull() ?: 0U + + private val currentMode: Int + get() = binding.supportedModesSp.selectedItem.toString().split("-")[0].toInt() + + private val binding + get() = _binding!! + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + _binding = ModeSelectFragmentBinding.inflate(inflater, container, false) + scope = viewLifecycleOwner.lifecycleScope + + addressUpdateFragment = + childFragmentManager.findFragmentById(R.id.addressUpdateFragment) as AddressUpdateFragment + + binding.readAttributeBtn.setOnClickListener { scope.launch { readAttributeBtnClick() } } + binding.changeToModeBtn.setOnClickListener { scope.launch { changeToModeBtnClick() } } + binding.onModeWriteBtn.setOnClickListener { + scope.launch { writeAttributeBtnClick(ClusterIDMapping.ModeSelect.Attribute.OnMode, onMode) } + } + binding.startUpModeWriteBtn.setOnClickListener { + scope.launch { + writeAttributeBtnClick(ClusterIDMapping.ModeSelect.Attribute.StartUpMode, startUpMode) + } + } + + return binding.root + } + + private suspend fun readAttributeBtnClick() { + val endpointId = addressUpdateFragment.endpointId + val clusterId = ModeSelect.ID + val attributeId = ChipPathId.forWildcard().id + val path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.readAttributePath( + object : ReportCallback { + override fun onError( + attributePath: ChipAttributePath?, + eventPath: ChipEventPath?, + e: Exception + ) { + requireActivity().runOnUiThread { + Toast.makeText( + requireActivity(), + R.string.ota_provider_invalid_attribute, + Toast.LENGTH_SHORT + ) + .show() + } + } + + override fun onReport(nodeState: NodeState?) { + val attributeStates = + nodeState?.getEndpointState(endpointId)?.getClusterState(clusterId)?.attributeStates + ?: return + + requireActivity().runOnUiThread { + val description = attributeStates[ClusterIDMapping.ModeSelect.Attribute.Description.id] + binding.descriptionEd.setText(description?.value?.toString()) + + val standardNamespace = + attributeStates[ClusterIDMapping.ModeSelect.Attribute.StandardNamespace.id] + binding.standardNamespaceEd.setText(standardNamespace?.value?.toString()) + + val currentMode = attributeStates[ClusterIDMapping.ModeSelect.Attribute.CurrentMode.id] + binding.currentModeEd.setText(currentMode?.value?.toString()) + + setVisibility( + attributeStates[ClusterIDMapping.ModeSelect.Attribute.StartUpMode.id], + binding.startUpModeEd, + binding.startUpModeTv, + binding.startUpModeWriteBtn + ) + setVisibility( + attributeStates[ClusterIDMapping.ModeSelect.Attribute.OnMode.id], + binding.onModeEd, + binding.onModeTv, + binding.onModeWriteBtn + ) + + val supportedModesTlv = + attributeStates[ClusterIDMapping.ModeSelect.Attribute.SupportedModes.id]?.tlv + + supportedModesTlv?.let { + setSupportedModeSpinner(it, currentMode?.value?.toString()?.toUInt()) + } + } + } + }, + devicePtr, + listOf(path), + 0 + ) + } + + private fun setVisibility( + attribute: AttributeState?, + modeEd: EditText, + modeTv: TextView, + writeBtn: TextView + ) { + val modeVisibility = + if (attribute != null) { + modeEd.setText(attribute.value?.toString() ?: "NULL") + View.VISIBLE + } else { + View.GONE + } + modeEd.visibility = modeVisibility + modeTv.visibility = modeVisibility + writeBtn.visibility = modeVisibility + } + + private fun setSupportedModeSpinner(supportedModesTlv: ByteArray, currentModeValue: UInt?) { + var pos = 0 + var currentItemId = 0 + val modeOptionStructList: List + TlvReader(supportedModesTlv).also { + modeOptionStructList = buildList { + it.enterArray(AnonymousTag) + while (!it.isEndOfContainer()) { + val struct = ModeSelectClusterModeOptionStruct.fromTlv(AnonymousTag, it) + add(struct) + if (currentModeValue != null && struct.mode == currentModeValue) { + currentItemId = pos + } + pos++ + } + it.exitContainer() + } + binding.supportedModesSp.adapter = + ArrayAdapter( + requireContext(), + android.R.layout.simple_spinner_dropdown_item, + modeOptionStructList.map { it.show() } + ) + binding.supportedModesSp.setSelection(currentItemId) + binding.currentModeEd.setText(binding.supportedModesSp.selectedItem.toString()) + } + } + + private suspend fun changeToModeBtnClick() { + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + ChipClusters.ModeSelectCluster(devicePtr, addressUpdateFragment.endpointId) + .changeToMode( + object : ChipClusters.DefaultClusterCallback { + override fun onError(error: java.lang.Exception?) { + Log.d(TAG, "onError", error) + showMessage("Error : ${error.toString()}") + } + + override fun onSuccess() { + showMessage("Change Success") + scope.launch { readAttributeBtnClick() } + } + }, + currentMode + ) + } + + private suspend fun writeAttributeBtnClick(attribute: ModeSelect.Attribute, value: UInt) { + val clusterId = ModeSelect.ID + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.write( + object : WriteAttributesCallback { + override fun onError(attributePath: ChipAttributePath?, ex: java.lang.Exception?) { + showMessage("Write ${attribute.name} failure $ex") + Log.e(TAG, "Write ${attribute.name} failure", ex) + } + + override fun onResponse(attributePath: ChipAttributePath, status: Status) { + showMessage("Write ${attribute.name} response: $status") + } + }, + devicePtr, + listOf( + AttributeWriteRequest.newInstance( + addressUpdateFragment.endpointId, + clusterId, + attribute.id, + TlvWriter().put(AnonymousTag, value).getEncoded(), + Optional.empty() + ) + ), + 0, + 0 + ) + } + + private fun ModeSelectClusterModeOptionStruct.show(): String { + val value = this + return StringBuilder() + .apply { + append("${value.mode}-${value.label}") + append("[") + for (semanticTag in value.semanticTags) { + append("${semanticTag.value}:${semanticTag.mfgCode}") + append(",") + } + append("]") + } + .toString() + } + + override fun onDestroyView() { + super.onDestroyView() + deviceController.finishOTAProvider() + _binding = null + } + + private fun showMessage(msg: String) { + requireActivity().runOnUiThread { binding.commandStatusTv.text = msg } + } + + companion object { + private const val TAG = "ModeSelectClientFragment" + + fun newInstance(): ModeSelectClientFragment = ModeSelectClientFragment() + } +} diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt index 13caa7b50ea..779ab2550e4 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt @@ -63,6 +63,9 @@ class OtaProviderClientFragment : Fragment() { private val vendorId: Int get() = binding.vendorIdEd.text.toString().toInt() + private val softwareVersion: Long + get() = binding.softwareVersionEd.text.toString().toLongOrNull() ?: 0L + private val otaProviderCallback = OtaProviderCallback() private val binding get() = _binding!! @@ -471,8 +474,8 @@ class OtaProviderClientFragment : Fragment() { } private fun updateOTAStatusBtnClick() { - val version = 2L - val versionString = "2.0" + val version = softwareVersion + val versionString = softwareVersion.toString() val filename = binding.firmwareFileTv.text.toString() Log.d(TAG, "updateOTAStatusBtnClick : $filename") @@ -648,6 +651,7 @@ class OtaProviderClientFragment : Fragment() { bufferedInputStream?.close() inputStream = null bufferedInputStream = null + showMessage("BDXTransfer End! - ErrorCode: $errorCode") } override fun handleBDXQuery( diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt index 97b25768270..f7049b68eaa 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/DeviceProvisioningFragment.kt @@ -289,7 +289,7 @@ class DeviceProvisioningFragment : Fragment() { override fun onICDRegistrationInfoRequired() { Log.d(TAG, "onICDRegistrationInfoRequired") deviceController.updateCommissioningICDRegistrationInfo( - ICDRegistrationInfo.newBuilder().build() + ICDRegistrationInfo.newBuilder().setICDStayActiveDurationMsec(30000L).build() ) } diff --git a/examples/android/CHIPTool/app/src/main/res/layout/diagnostic_log_fragment.xml b/examples/android/CHIPTool/app/src/main/res/layout/diagnostic_log_fragment.xml new file mode 100644 index 00000000000..56b770a645b --- /dev/null +++ b/examples/android/CHIPTool/app/src/main/res/layout/diagnostic_log_fragment.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + +