diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index be423b04c039d7..08de9d63fb523c 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:93 + image: ghcr.io/project-chip/chip-build:94 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2539edcf6a82fa..47536167563dbb 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:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -139,7 +139,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -308,7 +308,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -371,7 +371,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -490,7 +490,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index c897952d45107c..b31ce2273360e8 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:93 + image: ghcr.io/project-chip/chip-build:94 options: --user root steps: @@ -57,7 +57,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:93 + image: ghcr.io/project-chip/chip-build-esp32:94 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:93 + image: ghcr.io/project-chip/chip-build-nrf-platform:94 options: --user root steps: @@ -99,7 +99,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:93 + image: ghcr.io/project-chip/chip-build-telink:94 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 8b29ee6b118ebe6eeec3224dbe343474e11403d8" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py ffdbfe7560c0b628e03ab487ab110eeed9bdc8c7" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/docker_img.yaml b/.github/workflows/docker_img.yaml index 8921a55cb2b9e0..663f9e037bb8fe 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 eb45f76f389779..11afa765111972 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:93 + image: ghcr.io/project-chip/chip-build-doxygen:94 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 2c1c2555e797e2..421a9516b0ed47 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:93 + image: ghcr.io/project-chip/chip-build-ameba:94 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index 61ac888ad415a6..07641d9b5893cf 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:93 + image: ghcr.io/project-chip/chip-build-asr:94 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index c0178a04c2cb48..7ff1c1c019a141 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:93 + image: ghcr.io/project-chip/chip-build-bouffalolab:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index 0aaec6d6cc3bf3..c6f41822bd366a 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:93 + image: ghcr.io/project-chip/chip-build-ti:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index c7615bc27de48f..cebb38ccc52d39 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:93 + image: ghcr.io/project-chip/chip-build-ti:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 8e40a0df999f4c..6ed2fa9c6ccecf 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:93 + image: ghcr.io/project-chip/chip-build-efr32:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 20ced0375b8f5d..3d3112d2972ecd 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:93 + image: ghcr.io/project-chip/chip-build-esp32:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -124,7 +124,7 @@ jobs: if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32:93 + image: ghcr.io/project-chip/chip-build-esp32:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 5b7ee30abe1828..7ee9f4554545ae 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:93 + image: ghcr.io/project-chip/chip-build-infineon:94 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 84a36addb83f94..b4c9ceb210e2dc 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:93 + image: ghcr.io/project-chip/chip-build-crosscompile:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 33098465c1cdcb..dfcb78bb52b41f 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:93 + image: ghcr.io/project-chip/chip-build-imx:94 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index b4ed1cd92d2d1d..a27921cc1f68d2 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:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index 4bc173f7cc9e64..780ceadc14d5c3 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:93 + image: ghcr.io/project-chip/chip-build:94 steps: - name: Checkout diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 5b2d082ff5e6f7..9611cd79d97dfa 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:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 0aff592c543da4..cd0d7c87d12547 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:93 + image: ghcr.io/project-chip/chip-build-nrf-platform:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index 63088ce8f78f53..ad93f339eb2e7e 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:93 + image: ghcr.io/project-chip/chip-build-nuttx:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 267045cca4d99d..2e97e891bf6ac3 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp:93 + image: ghcr.io/project-chip/chip-build-nxp:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -240,7 +240,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp-zephyr:93 + image: ghcr.io/project-chip/chip-build-nxp-zephyr:94 steps: - name: Checkout diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 2727b81b868621..6071dc358d96e8 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:93 + image: ghcr.io/project-chip/chip-build-openiotsdk:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 45e5b6a7436e68..e09b90dc94137b 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:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index e2ec5288adf19f..6e21c0c01a3b18 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:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 1b6fd20aa72260..b3730809abe90d 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:93 + image: ghcr.io/project-chip/chip-build-telink:94 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -58,7 +58,7 @@ 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 8b29ee6b118ebe6eeec3224dbe343474e11403d8" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py ffdbfe7560c0b628e03ab487ab110eeed9bdc8c7" - name: Build example Telink (B92 retention) Air Quality Sensor App # Run test for master and s07641069 PRs diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 56a018d533bc0d..968acafa93a829 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:93 + image: ghcr.io/project-chip/chip-build-tizen:94 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 4beb8d101e24cd..6abedd95f7bb65 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:93 + image: ghcr.io/project-chip/chip-build-android:94 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 2c8fa9d7f3d4c5..9d756b1e99b229 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:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 504cb865a9cc0b..dcee14f5659329 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:93 + image: ghcr.io/project-chip/chip-build-java:94 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -104,6 +104,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 +117,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 +130,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 +143,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 +156,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 +169,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 +182,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 +195,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 +207,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 +234,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 +247,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 +259,23 @@ jobs: --tool-args "onnetwork-long --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \ --factoryreset \ ' + - name: Run Pairing Onnetwork and get diagnostic log Test + # TODO: test below is disabled because it seems flaky (crashes on pool not being empty on app exit) + # See: https://github.com/project-chip/connectedhomeip/issues/36734 + 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 --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 +287,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 +300,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 +313,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 +326,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 731d047f288e6e..d15e6875285c9d 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:93 + image: ghcr.io/project-chip/chip-build:94 steps: - name: Checkout @@ -292,8 +292,8 @@ 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' \ diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index f933cd69df5531..9a2d132284e65b 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:93 + image: ghcr.io/project-chip/chip-build-minimal:94 steps: - name: Checkout @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:93 + image: ghcr.io/project-chip/chip-build-minimal:94 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 2a2d52f23a8c6c..f5868fa184ed24 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' && github.repository_owner == 'espressif' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:93 + image: ghcr.io/project-chip/chip-build-esp32-qemu:94 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -79,7 +79,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:93 + image: ghcr.io/project-chip/chip-build-tizen-qemu:94 options: --user root volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 161d123d9ec495..9fcd2d43e38707 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:93 + image: ghcr.io/project-chip/chip-build-esp32:94 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:93 + image: ghcr.io/project-chip/chip-build-efr32:94 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 114c072cbe30cd..1f4bb250ef3c96 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:93 + image: ghcr.io/project-chip/chip-build-android:94 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ceee20818defd8..ff8d4d9b37c881 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -50,7 +50,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:93 + image: ghcr.io/project-chip/chip-build:94 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -457,7 +457,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:93 + image: ghcr.io/project-chip/chip-build:94 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -496,6 +496,7 @@ jobs: --target linux-x64-network-manager-ipv6only-no-ble-no-wifi-tsan-clang-test \ --target linux-x64-fabric-admin-rpc-ipv6only-no-ble-no-wifi-clang \ --target linux-x64-fabric-bridge-rpc-ipv6only-no-ble-no-wifi-clang \ + --target linux-x64-fabric-sync-ipv6only-no-ble-no-wifi-clang \ --target linux-x64-light-data-model-no-unique-id-ipv6only-no-ble-no-wifi-clang \ --target linux-x64-python-bindings \ build \ @@ -513,6 +514,7 @@ jobs: 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-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 diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 449152bf21679c..29fc366d899162 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:93 + image: ghcr.io/project-chip/chip-build:94 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 0cba8cb97c2d17..83a3cde53ad882 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:93 + image: ghcr.io/project-chip/chip-build:94 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 6900886aed06bb..512295899e3aee 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:93 + image: ghcr.io/project-chip/chip-build:94 defaults: run: shell: sh diff --git a/build/chip/chip_test_suite.gni b/build/chip/chip_test_suite.gni index 19264b905104ee..553b963a74191d 100644 --- a/build/chip/chip_test_suite.gni +++ b/build/chip/chip_test_suite.gni @@ -93,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. diff --git a/config/nxp/chip-module/Kconfig.defaults b/config/nxp/chip-module/Kconfig.defaults index cd2dd74b91f788..3676d3eed6cd3e 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 @@ -354,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/credentials/generate-revocation-set.py b/credentials/generate-revocation-set.py index 4cdcfdbad1ae26..509eee56008132 100644 --- a/credentials/generate-revocation-set.py +++ b/credentials/generate-revocation-set.py @@ -32,6 +32,7 @@ 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 @@ -510,12 +511,12 @@ def main(use_main_net_dcld: str, use_test_net_dcld: str, use_main_net_http: bool "issuer_subject_key_id": certificate_akid_hex, "issuer_name": certificate_authority_name_b64, "revoked_serial_numbers": serialnumber_list, - "crl_signer_cert": revocation_point["crlSignerCertificate"], + "crl_signer_cert": base64.b64encode(crl_signer_certificate.public_bytes(serialization.Encoding.DER)).decode('utf-8'), } - if "crlSignerDelegator" in revocation_point: - entry["crl_signer_delegator"] = revocation_point["crlSignerDelegator"] - + if crl_signer_delegator_cert: + entry["crl_signer_delegator"] = base64.b64encode( + crl_signer_delegator_cert.public_bytes(serialization.Encoding.DER)).decode('utf-8'), logging.debug(f"Entry to append: {entry}") revocation_set.append(entry) diff --git a/docs/development_controllers/chip-tool/chip_tool_guide.md b/docs/development_controllers/chip-tool/chip_tool_guide.md index 81000368a47f0c..85b62dbc9dac74 100644 --- a/docs/development_controllers/chip-tool/chip_tool_guide.md +++ b/docs/development_controllers/chip-tool/chip_tool_guide.md @@ -9,6 +9,26 @@ the setup payload or performing discovery actions.
+## Table of Contents + +- [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) + ## Installation On Linux distributions diff --git a/docs/testing/fuzz_testing.md b/docs/testing/fuzz_testing.md index 68f08f4885c48e..7b5fd5683f612f 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 1db6ff779b8461..9bda585726d409 100644 --- a/docs/testing/python.md +++ b/docs/testing/python.md @@ -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)) ``` @@ -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) ``` @@ -577,13 +577,13 @@ 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 ``` @@ -592,7 +592,7 @@ subsequent setups as it is faster. Next build the python wheels and create / activate a venv -``` +```shell ./scripts/build_python.sh -i out/python_env source out/python_env/bin/activate ``` @@ -609,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 ``` @@ -617,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 ``` @@ -722,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 e3736d6272f1ab..0adeca43e55c1d 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 out/python_env -source py/bin/activate +source out/python_env/bin/activate ``` Compile chip-tool: diff --git a/docs/upgrading.md b/docs/upgrading.md index 517a83f6574dc9..e9e17239d50049 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -102,3 +102,8 @@ 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/examples/air-purifier-app/ameba/main/chipinterface.cpp b/examples/air-purifier-app/ameba/main/chipinterface.cpp index 72563f987efdbe..766197dec366ae 100644 --- a/examples/air-purifier-app/ameba/main/chipinterface.cpp +++ b/examples/air-purifier-app/ameba/main/chipinterface.cpp @@ -30,9 +30,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -135,7 +135,7 @@ 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.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); #if CONFIG_ENABLE_AMEBA_CRYPTO ChipLogProgress(DeviceLayer, "platform crypto enabled!"); static chip::AmebaPersistentStorageOperationalKeystore sAmebaPersistentStorageOpKeystore; diff --git a/examples/air-purifier-app/cc32xx/main/AppTask.cpp b/examples/air-purifier-app/cc32xx/main/AppTask.cpp index e7527ef338f05a..b604271d5f87b8 100644 --- a/examples/air-purifier-app/cc32xx/main/AppTask.cpp +++ b/examples/air-purifier-app/cc32xx/main/AppTask.cpp @@ -38,9 +38,9 @@ #include #include -#include #include #include +#include #include #include @@ -165,7 +165,7 @@ int AppTask::Init() PLAT_LOG("Initialize Server"); static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = CodegenDataModelProviderInstance(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 828dd567da7ee0..540f3281205022 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:93 + $ docker pull ghcr.io/project-chip/chip-build-ameba:94 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:94 - Setup build environment: diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 06ba9f01cd8256..80a98b9c3d4c69 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -31,10 +31,10 @@ #include #include -#include #include #include #include +#include #include #include @@ -150,7 +150,7 @@ static void InitServer(intptr_t context) initParams.appDelegate = &sAmebaObserver; initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = CodegenDataModelProviderInstance(); + 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 e27884810cbd8f..c9764e954189b2 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/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn index aeb1fa0b6feb4d..bc250abd5c6e90 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/src/AppTask.cpp b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp index 3b127091f13277..5c416f847d3293 100644 --- a/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-app/infineon/psoc6/src/AppTask.cpp @@ -25,7 +25,6 @@ #include "LEDWidget.h" #include #include -#include #include #include #include @@ -35,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -130,7 +130,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + 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/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 0e16c64c41de13..64dcf06e90736b 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -92,6 +92,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:attribute-persistence", "${chip_root}/src/app/tests/suites/credentials:dac_provider", "${chip_root}/src/lib", "${chip_root}/third_party/jsoncpp", diff --git a/examples/all-clusters-app/linux/fuzzing-main.cpp b/examples/all-clusters-app/linux/fuzzing-main.cpp index 5056f08cce65f4..2b41a2517a16bb 100644 --- a/examples/all-clusters-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-app/linux/fuzzing-main.cpp @@ -16,8 +16,8 @@ */ #include "AppMain.h" -#include #include +#include #include @@ -57,7 +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.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); ApplicationInit(); diff --git a/examples/all-clusters-app/mbed/main/AppTask.cpp b/examples/all-clusters-app/mbed/main/AppTask.cpp index 98b8597ba43e5f..3a6686b517a78a 100644 --- a/examples/all-clusters-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-app/mbed/main/AppTask.cpp @@ -72,7 +72,7 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) { diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 9dcd4238240111..44a0a056bf44f2 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -30,9 +30,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -227,7 +227,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = CodegenDataModelProviderInstance(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/all-clusters-app/nrfconnect/main/main.cpp b/examples/all-clusters-app/nrfconnect/main/main.cpp index 400f9b30e0dd01..77d7bd785f91e0 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/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index 89ba7f249719cc..73ea8cc02023ab 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/main.cpp b/examples/all-clusters-app/nxp/mw320/main.cpp index bf0d6a282e9373..a828706b0fa67f 100644 --- a/examples/all-clusters-app/nxp/mw320/main.cpp +++ b/examples/all-clusters-app/nxp/mw320/main.cpp @@ -32,12 +32,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -1069,7 +1069,7 @@ static void run_chip_srv(System::Layer * aSystemLayer, void * aAppState) static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = CodegenDataModelProviderInstance(); + 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/zephyr/README.md b/examples/all-clusters-app/nxp/zephyr/README.md index d9038b02dd9431..2424e2cd8a7987 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` @@ -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 00000000000000..0ae729f051f949 --- /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 00000000000000..1da48cb0fc3956 --- /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 00000000000000..0d26dcedfe687d --- /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 41ba4fc5cd304e..816de4d38b85c5 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/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 332b03cbebaf00..59aac2228161d4 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/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index 947a9ed09f0eb0..3b1600b3d7b705 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:93 + $ docker pull ghcr.io/project-chip/chip-build-ameba:94 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:93 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:94 ``` - Setup build environment: diff --git a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp index cec1c457e04f04..8f18742ca5b42d 100644 --- a/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp @@ -27,12 +27,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -159,7 +159,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = CodegenDataModelProviderInstance(); + initParams.dataModelProvider = CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); static AmebaObserver sAmebaObserver; initParams.appDelegate = &sAmebaObserver; 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 29ad68b74241f1..1c0008b63bb7cb 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp +++ b/examples/all-clusters-minimal-app/infineon/psoc6/src/AppTask.cpp @@ -25,7 +25,6 @@ #include "LEDWidget.h" #include #include -#include #include #include #include @@ -35,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -128,7 +128,7 @@ static void InitServer(intptr_t context) // Init ZCL Data Model static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + 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/fuzzing-main.cpp b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp index ccd2ffa782b4dd..4e6b390225819c 100644 --- a/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp +++ b/examples/all-clusters-minimal-app/linux/fuzzing-main.cpp @@ -16,8 +16,8 @@ */ #include "AppMain.h" -#include #include +#include using namespace chip; using namespace chip::DeviceLayer; @@ -44,7 +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.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); VerifyOrDie(Server::GetInstance().Init(initParams) == CHIP_NO_ERROR); ApplicationInit(); diff --git a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp index e516aee49e6e74..81f5f15a59c1e6 100644 --- a/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/mbed/main/AppTask.cpp @@ -20,12 +20,12 @@ #include "LEDWidget.h" #include -#include #include #include #include #include #include +#include #include #include @@ -68,7 +68,7 @@ int AppTask::Init() // Init ZCL Data Model and start server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); error = Server::GetInstance().Init(initParams); if (error != CHIP_NO_ERROR) { diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp index 8d9771fa593204..9254d52d270ee4 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp @@ -22,9 +22,9 @@ #include "LEDUtil.h" #include "binding-handler.h" -#include #include #include +#include #include #include @@ -174,7 +174,7 @@ CHIP_ERROR AppTask::Init() initParams.operationalKeystore = &sPSAOperationalKeystore; #endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); - initParams.dataModelProvider = app::CodegenDataModelProviderInstance(); + initParams.dataModelProvider = app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); ReturnErrorOnFailure(chip::Server::GetInstance().Init(initParams)); AppFabricTableDelegate::Init(); diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp b/examples/all-clusters-minimal-app/nrfconnect/main/main.cpp index 400f9b30e0dd01..77d7bd785f91e0 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/android/CHIPTool/app/src/main/AndroidManifest.xml b/examples/android/CHIPTool/app/src/main/AndroidManifest.xml index 0526dc5a78160d..efd089817efe68 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 69bfdc109912c9..fb8141e72d33a8 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,6 +72,7 @@ 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() } @@ -225,6 +226,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) 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 00000000000000..ea7d5438d247c3 --- /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/res/layout/diagnostic_log_fragment.xml b/examples/android/CHIPTool/app/src/main/res/layout/diagnostic_log_fragment.xml new file mode 100644 index 00000000000000..56b770a645b442 --- /dev/null +++ b/examples/android/CHIPTool/app/src/main/res/layout/diagnostic_log_fragment.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + +