From a8fe0cf09e3a1b999895e98355e6e13bcf59fa43 Mon Sep 17 00:00:00 2001 From: Gatien Chapon <43855183+chapongatien@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:33:33 +0200 Subject: [PATCH] [NXP] Fixing Matter over thread support on rw61x platform (#34074) * [NXP] Adding new GN file to reference openthread version from ot-nxp * [NXP][common] Replace Optional class with std::optional to fix BR build Signed-off-by: Gatien Chapon * [NXP] Updating ot-nxp submodule version to latest NXP release Signed-off-by: Gatien Chapon * [NXP][workflows] Adding thread and thread + wifi build checks Signed-off-by: Gatien Chapon * [NXP][rw61x] Updating workflow to allow to indicate to checkout all nxp submodules Signed-off-by: Gatien Chapon * [NXP][rw61x] Updating workflow to add --recursive submodule update option Signed-off-by: Gatien Chapon --------- Signed-off-by: Gatien Chapon --- .github/workflows/examples-rw61x.yaml | 9 ++++++++- examples/all-clusters-app/nxp/rt/rw61x/.gn | 3 +++ examples/laundry-washer-app/nxp/rt/rw61x/.gn | 3 +++ examples/platform/nxp/common/gn/args.gni | 16 ++++++++++++++++ examples/thermostat/nxp/rt/rw61x/.gn | 3 +++ scripts/build/builders/rw61x.py | 2 ++ src/platform/nxp/common/DnssdImpl.cpp | 4 ++-- third_party/openthread/ot-nxp | 2 +- 8 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 examples/platform/nxp/common/gn/args.gni diff --git a/.github/workflows/examples-rw61x.yaml b/.github/workflows/examples-rw61x.yaml index eed41f209ed61d..15c25699f72284 100644 --- a/.github/workflows/examples-rw61x.yaml +++ b/.github/workflows/examples-rw61x.yaml @@ -48,7 +48,8 @@ jobs: - name: Checkout submodules & Bootstrap uses: ./.github/actions/checkout-submodules-and-bootstrap with: - platform: rw61x + platform: nxp + extra-submodule-parameters: --recursive - name: Set up environment for size reports uses: ./.github/actions/setup-size-reports @@ -61,6 +62,8 @@ jobs: scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target rw61x-all-clusters-app-wifi \ + --target rw61x-all-clusters-app-thread \ + --target rw61x-all-clusters-app-thread-wifi \ build \ --copy-artifacts-to out/artifacts \ " @@ -70,6 +73,8 @@ jobs: scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target rw61x-thermostat-wifi \ + --target rw61x-thermostat-thread \ + --target rw61x-thermostat-thread-wifi \ build \ --copy-artifacts-to out/artifacts \ " @@ -79,6 +84,8 @@ jobs: scripts/run_in_build_env.sh "\ ./scripts/build/build_examples.py \ --target rw61x-laundry-washer-wifi \ + --target rw61x-laundry-washer-thread \ + --target rw61x-laundry-washer-thread-wifi \ build \ --copy-artifacts-to out/artifacts \ " diff --git a/examples/all-clusters-app/nxp/rt/rw61x/.gn b/examples/all-clusters-app/nxp/rt/rw61x/.gn index c0a26c2dc77832..cbbec24fe8c308 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/.gn +++ b/examples/all-clusters-app/nxp/rt/rw61x/.gn @@ -28,6 +28,9 @@ default_args = { 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/rw61x/args.gni") } diff --git a/examples/laundry-washer-app/nxp/rt/rw61x/.gn b/examples/laundry-washer-app/nxp/rt/rw61x/.gn index c0a26c2dc77832..cbbec24fe8c308 100644 --- a/examples/laundry-washer-app/nxp/rt/rw61x/.gn +++ b/examples/laundry-washer-app/nxp/rt/rw61x/.gn @@ -28,6 +28,9 @@ default_args = { 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/rw61x/args.gni") } diff --git a/examples/platform/nxp/common/gn/args.gni b/examples/platform/nxp/common/gn/args.gni new file mode 100644 index 00000000000000..a730fe7ad65c90 --- /dev/null +++ b/examples/platform/nxp/common/gn/args.gni @@ -0,0 +1,16 @@ +# 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. + +openthread_root = + "//third_party/connectedhomeip/third_party/openthread/ot-nxp/openthread" diff --git a/examples/thermostat/nxp/rt/rw61x/.gn b/examples/thermostat/nxp/rt/rw61x/.gn index c0a26c2dc77832..cbbec24fe8c308 100644 --- a/examples/thermostat/nxp/rt/rw61x/.gn +++ b/examples/thermostat/nxp/rt/rw61x/.gn @@ -28,6 +28,9 @@ default_args = { 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/rw61x/args.gni") } diff --git a/scripts/build/builders/rw61x.py b/scripts/build/builders/rw61x.py index b0c67dcbac68b1..47a6d27b51aaba 100644 --- a/scripts/build/builders/rw61x.py +++ b/scripts/build/builders/rw61x.py @@ -99,6 +99,8 @@ def GnBuildArgs(self): if self.enable_thread: args.append('chip_enable_openthread=true chip_inet_config_enable_ipv4=false') + if self.enable_wifi: + args.append('openthread_root=\"//third_party/connectedhomeip/third_party/openthread/ot-nxp/openthread-br\"') if self.enable_factory_data: args.append('chip_with_factory_data=1') diff --git a/src/platform/nxp/common/DnssdImpl.cpp b/src/platform/nxp/common/DnssdImpl.cpp index 17116f21fc277f..743e4ab30cafa1 100644 --- a/src/platform/nxp/common/DnssdImpl.cpp +++ b/src/platform/nxp/common/DnssdImpl.cpp @@ -440,7 +440,7 @@ CHIP_ERROR FromSrpCacheToMdnsData(const otSrpServerService * service, const otSr mdnsService.mInterface = ConnectivityManagerImpl().GetThreadInterface(); mdnsService.mAddressType = Inet::IPAddressType::kIPv6; - mdnsService.mAddress = MakeOptional(ToIPAddress(*ip6AddrPtr)); + mdnsService.mAddress = std::optional(ToIPAddress(*ip6AddrPtr)); // Extract TXT record SRP service txtStringPtr = otSrpServerServiceGetTxtData(service, &txtDataLen); @@ -547,7 +547,7 @@ CHIP_ERROR FromOtDnsResponseToMdnsData(otDnsServiceInfo & serviceInfo, const cha if (!otIp6IsAddressUnspecified(&serviceInfo.mHostAddress)) { mdnsService.mAddressType = Inet::IPAddressType::kIPv6; - mdnsService.mAddress = MakeOptional(ToIPAddress(serviceInfo.mHostAddress)); + mdnsService.mAddress = std::optional(ToIPAddress(serviceInfo.mHostAddress)); } // Check if TXT record was included in DNS response. diff --git a/third_party/openthread/ot-nxp b/third_party/openthread/ot-nxp index b8471857ab7b2c..f45fe4dd8687f0 160000 --- a/third_party/openthread/ot-nxp +++ b/third_party/openthread/ot-nxp @@ -1 +1 @@ -Subproject commit b8471857ab7b2c843c9ec5bc5d7e7711b2cd30a4 +Subproject commit f45fe4dd8687f0feddf063a33214c2196b463d3e