Skip to content

Commit a1c44c1

Browse files
committed
[NXP][Zephyr] Add experimental Ethernet support to nxp zephyr platforms
* Enable Ethernet for RW61x platform * Add ethernet support in following examples: * All-clusters-app * Laudry washer * Thermostat * Support ethernet build with build_examples.py and add it to workflows Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
1 parent e6a6425 commit a1c44c1

32 files changed

+596
-24
lines changed

.github/workflows/examples-nxp.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ jobs:
274274
with:
275275
platform-name: RW61X
276276
zephyr:
277-
name: ZEPHYR_RW61X
277+
name: ZEPHYR
278278

279279
runs-on: ubuntu-latest
280280
if: github.actor != 'restyled-io[bot]'
@@ -290,12 +290,13 @@ jobs:
290290
with:
291291
platform: nxp
292292

293-
- name: Build RW61x Zephyr examples
293+
- name: Build NXP Zephyr examples
294294
run: |
295295
scripts/run_in_build_env.sh "\
296296
./scripts/build/build_examples.py \
297297
--target nxp-rw61x-zephyr-all-clusters \
298298
--target nxp-rw61x-zephyr-thermostat \
299299
--target nxp-rw61x-zephyr-laundry-washer-factory \
300+
--target nxp-rw61x_eth-zephyr-thermostat-ethernet \
300301
build \
301302
"

config/nxp/chip-module/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ endif()
123123

124124
if (CONFIG_NET_L2_OPENTHREAD)
125125
matter_add_gn_arg_string("chip_mdns" "platform")
126-
elseif(CONFIG_WIFI_NXP)
126+
elseif(CONFIG_WIFI_NXP OR CONFIG_CHIP_ETHERNET)
127127
matter_add_gn_arg_string("chip_mdns" "minimal")
128128
else()
129129
matter_add_gn_arg_string("chip_mdns" "none")

config/nxp/chip-module/Kconfig.defaults

+16-4
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,6 @@ choice SCHED_ALGORITHM
252252
default SCHED_MULTIQ
253253
endchoice
254254

255-
choice LIBC_IMPLEMENTATION
256-
default NEWLIB_LIBC
257-
endchoice
258-
259255
choice WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_CHOICE
260256
default WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF
261257
endchoice
@@ -326,6 +322,22 @@ config CHIP_MALLOC_SYS_HEAP_SIZE
326322

327323
endif
328324

325+
if CHIP_ETHERNET || CHIP_WIFI
326+
327+
choice LIBC_IMPLEMENTATION
328+
default NEWLIB_LIBC
329+
endchoice
330+
331+
endif
332+
333+
if CHIP_ETHERNET
334+
335+
choice NXP_ENET_DRIVER
336+
default ETH_NXP_ENET
337+
endchoice
338+
339+
endif
340+
329341
# Configure MBEDTLS lib
330342
config MBEDTLS
331343
default y

config/nxp/chip-module/Kconfig.features

+23
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,27 @@ config CHIP_WIFI_CONNECTION_RECOVERY_JITTER
7676
a random jitter interval is added to it to avoid periodicity. The random jitter is selected
7777
within range [-JITTER; +JITTER].
7878

79+
config CHIP_ETHERNET
80+
bool "Enable NXP Ethernet support"
81+
default n
82+
depends on !CHIP_WIFI
83+
select NET_MGMT_EVENT
84+
select NET_MGMT_EVENT_INFO
85+
select NET_L2_ETHERNET
86+
select NET_L2_ETHERNET_MGMT
87+
select NET_UDP
88+
select NET_IP
89+
select NET_CONFIG_SETTINGS
90+
select NET_MGMT
91+
select NET_IPV4
92+
select NET_DHCPV4
93+
select NET_NATIVE_IPV4
94+
select NET_NATIVE
95+
select NET_TCP
96+
select DNS_RESOLVER
97+
select MDNS_RESOLVER
98+
select MBEDTLS_PKCS5_C
99+
select MBEDTLS_HKDF_C
100+
select MBEDTLS_ECDSA_C
101+
select PSA_CRYPTO_ENABLE_ALL
79102
endif # CHIP

config/nxp/cmake/common.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_
4444
matter_add_gn_arg_bool ("chip_automation_logging" FALSE)
4545
matter_add_gn_arg_bool ("chip_malloc_sys_heap" CONFIG_CHIP_MALLOC_SYS_HEAP)
4646
matter_add_gn_arg_bool ("chip_enable_wifi" CONFIG_CHIP_WIFI)
47+
matter_add_gn_arg_bool ("chip_enable_ethernet" CONFIG_CHIP_ETHERNET)
4748
matter_add_gn_arg_bool ("chip_system_config_provide_statistics" CONFIG_CHIP_STATISTICS)
4849
matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT)
4950
matter_add_gn_arg_bool ("enable_eventlist_attribute" TRUE)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http: //www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "rd_rw612_bga.overlay"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
CONFIG_SETTINGS_NVS_SECTOR_COUNT=16
18+
19+
# 0xA226
20+
CONFIG_CHIP_DEVICE_PRODUCT_ID=41510
21+
CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radio-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612"
22+
CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612"
23+
CONFIG_CHIP_DEVICE_PART_NUMBER="RW612"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
# Options needed for Ethernet are located in this file
18+
19+
# ethernet discriminator
20+
CONFIG_CHIP_DEVICE_DISCRIMINATOR=0x700
21+
22+
CONFIG_CHIP_WIFI=n
23+
CONFIG_CHIP_ETHERNET=y
24+
25+
CONFIG_NET_DEFAULT_IF_WIFI=n
26+
CONFIG_BT=n
27+
CONFIG_BT_DEVICE_NAME=""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http: //www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "rd_rw612_bga.overlay"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
CONFIG_SETTINGS_NVS_SECTOR_COUNT=16
18+
19+
# 0xA226
20+
CONFIG_CHIP_DEVICE_PRODUCT_ID=41510
21+
CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radio-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612"
22+
CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612"
23+
CONFIG_CHIP_DEVICE_PART_NUMBER="RW612"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
# Options needed for Ethernet are located in this file
18+
19+
# ethernet discriminator
20+
CONFIG_CHIP_DEVICE_DISCRIMINATOR=0x700
21+
22+
CONFIG_CHIP_WIFI=n
23+
CONFIG_CHIP_ETHERNET=y
24+
25+
CONFIG_NET_DEFAULT_IF_WIFI=n
26+
CONFIG_BT=n
27+
CONFIG_BT_DEVICE_NAME=""

examples/platform/nxp/common/app_task/include/AppTaskBase.h

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ class AppTaskBase
149149
*/
150150
#if CONFIG_CHIP_WIFI || CHIP_DEVICE_CONFIG_ENABLE_WPA
151151
virtual chip::DeviceLayer::NetworkCommissioning::WiFiDriver * GetWifiDriverInstance(void) = 0;
152+
#elif CONFIG_CHIP_ETHERNET
153+
virtual chip::DeviceLayer::NetworkCommissioning::EthernetDriver * GetEthernetDriverInstance(void) = 0;
152154
#endif
153155

154156
/**

examples/platform/nxp/common/app_task/include/AppTaskZephyr.h

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class AppTaskZephyr : public AppTaskBase
5151
*/
5252
#if defined(CONFIG_CHIP_WIFI)
5353
virtual chip::DeviceLayer::NetworkCommissioning::WiFiDriver * GetWifiDriverInstance(void) override;
54+
#elif defined(CONFIG_CHIP_ETHERNET)
55+
virtual chip::DeviceLayer::NetworkCommissioning::EthernetDriver * GetEthernetDriverInstance(void) override;
5456
#endif
5557

5658
/**

examples/platform/nxp/common/app_task/source/AppTaskBase.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
115115
#if CONFIG_CHIP_WIFI || CHIP_DEVICE_CONFIG_ENABLE_WPA
116116
app::Clusters::NetworkCommissioning::Instance sNetworkCommissioningInstance(0,
117117
chip::NXP::App::GetAppTask().GetWifiDriverInstance());
118+
#elif CONFIG_CHIP_ETHERNET
119+
app::Clusters::NetworkCommissioning::Instance
120+
sNetworkCommissioningInstance(0, chip::NXP::App::GetAppTask().GetEthernetDriverInstance());
118121
#endif
119122

120123
#if CHIP_CONFIG_ENABLE_ICD_SERVER || (CONFIG_CHIP_TEST_EVENT && CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR)
@@ -288,6 +291,8 @@ CHIP_ERROR chip::NXP::App::AppTaskBase::Init()
288291
#ifdef ENABLE_CHIP_SHELL
289292
Shell::SetWiFiDriver(chip::NXP::App::GetAppTask().GetWifiDriverInstance());
290293
#endif
294+
#elif CONFIG_CHIP_ETHERNET
295+
sNetworkCommissioningInstance.Init();
291296
#endif
292297
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
293298
if (err == CHIP_NO_ERROR)

examples/platform/nxp/common/app_task/source/AppTaskZephyr.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
#include "AppCLIBase.h"
3737
#endif
3838

39+
#ifdef CONFIG_CHIP_ETHERNET
40+
#include <platform/nxp/zephyr/Ethernet/NxpEthDriver.h>
41+
#endif
42+
3943
#if CONFIG_CHIP_FACTORY_DATA
4044
#include <platform/nxp/common/factory_data/FactoryDataProvider.h>
4145
#else
@@ -69,7 +73,13 @@ chip::DeviceLayer::NetworkCommissioning::WiFiDriver * chip::NXP::App::AppTaskZep
6973
return static_cast<chip::DeviceLayer::NetworkCommissioning::WiFiDriver *>(
7074
&(NetworkCommissioning::ZephyrWifiDriver::Instance()));
7175
}
72-
#endif // CONFIG_CHIP_WIFI
76+
#elif defined(CONFIG_CHIP_ETHERNET)
77+
chip::DeviceLayer::NetworkCommissioning::EthernetDriver * chip::NXP::App::AppTaskZephyr::GetEthernetDriverInstance()
78+
{
79+
return static_cast<chip::DeviceLayer::NetworkCommissioning::EthernetDriver *>(
80+
&(NetworkCommissioning::NxpEthDriver::Instance()));
81+
}
82+
#endif
7383

7484
CHIP_ERROR chip::NXP::App::AppTaskZephyr::AppMatter_Register()
7585
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http: //www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "rd_rw612_bga.overlay"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
CONFIG_SETTINGS_NVS_SECTOR_COUNT=16
18+
19+
# 0xA226
20+
CONFIG_CHIP_DEVICE_PRODUCT_ID=41510
21+
CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radio-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612"
22+
CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612"
23+
CONFIG_CHIP_DEVICE_PART_NUMBER="RW612"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
# Options needed for Ethernet are located in this file
18+
19+
# ethernet discriminator
20+
CONFIG_CHIP_DEVICE_DISCRIMINATOR=0x700
21+
22+
CONFIG_CHIP_WIFI=n
23+
CONFIG_CHIP_ETHERNET=y
24+
25+
CONFIG_NET_DEFAULT_IF_WIFI=n
26+
CONFIG_BT=n
27+
CONFIG_BT_DEVICE_NAME=""

scripts/build/build/targets.py

+2
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ def BuildNxpTarget():
515515
TargetPart('k32w0', board=NxpBoard.K32W0),
516516
TargetPart('k32w1', board=NxpBoard.K32W1),
517517
TargetPart('rw61x', board=NxpBoard.RW61X),
518+
TargetPart('rw61x_eth', board=NxpBoard.RW61X_ETH),
518519
TargetPart('mcxw71', board=NxpBoard.MCXW71)
519520
])
520521

@@ -544,6 +545,7 @@ def BuildNxpTarget():
544545
target.AppendModifier(name="sw-v2", has_sw_version_2=True)
545546
target.AppendModifier(name="ota", enable_ota=True).ExceptIfRe('zephyr')
546547
target.AppendModifier(name="wifi", enable_wifi=True).OnlyIfRe('rw61x')
548+
target.AppendModifier(name="ethernet", enable_ethernet=True).OnlyIfRe('rw61x_eth-zephyr')
547549
target.AppendModifier(name="thread", enable_thread=True).ExceptIfRe('zephyr')
548550
target.AppendModifier(name="matter-shell", enable_shell=True).ExceptIfRe('k32w0|k32w1')
549551
target.AppendModifier('data-model-disabled', data_model_interface="disabled").ExceptIfRe('-data-model-enabled')

0 commit comments

Comments
 (0)