Skip to content

Commit

Permalink
[NXP][Zephyr] Migrate to nxp-zsdk v4.0.0 (#36749)
Browse files Browse the repository at this point in the history
- Kconfigs/CMake updates for nxp-zsdk v4.0.0 (Zephyr 4.0 base)
- Add ThreadMetrics support for Zephyr platforms
- Add missing WiFi Diagnostic support for NXP Zephyr
- Add Matter over WiFi support for frdm_rw612
- Update and fix memory overlays

Restyled by clang-format

Restyled by prettier-markdown

Co-authored-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
  • Loading branch information
axelnxp and yeaissa authored Dec 9, 2024
1 parent 84fb78f commit af8d173
Show file tree
Hide file tree
Showing 24 changed files with 630 additions and 91 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/examples-nxp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions config/nxp/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
66 changes: 37 additions & 29 deletions examples/all-clusters-app/nxp/zephyr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The example supports:
The supported boards are:

- `rd_rw612_bga`
- `frdm_rw612`

<a name="building"></a>

Expand All @@ -51,23 +52,23 @@ 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
> recommend using nxp-zsdk downstream to get access to all NXP features that are
> 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:

Expand All @@ -84,7 +85,13 @@ source <path to zephyr repo>/zephyr-env.sh
3. Run west build command:

```shell
west build -b rd_rw612_bga -p auto -d build_zephyr <path to example folder>
west build -b <board> -p auto -d build_zephyr <path to example folder>
```

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
Expand All @@ -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 <J-Link serial number>
Expand Down Expand Up @@ -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/<board>/<board>.overlay` file
to obtain the memory region used by this partition.
You may refer to `<board>.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/<board>/<board>.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 `<board>.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

Expand All @@ -165,7 +172,7 @@ To build the example with factory data support, you can add
Example:

```bash
west build -b rd_rw612_bga -p <path to example folder> -- -DFILE_SUFFIX=fdata
west build -b <board> -p <path to example folder> -- -DFILE_SUFFIX=fdata
```

`prj_fdata.conf` configuration file will enable `CONFIG_CHIP_FACTORY_DATA`
Expand Down Expand Up @@ -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`.
Expand Down
18 changes: 18 additions & 0 deletions examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.conf
Original file line number Diff line number Diff line change
@@ -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
92 changes: 92 additions & 0 deletions examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612.overlay
Original file line number Diff line number Diff line change
@@ -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)>;
};

};
};
};
26 changes: 26 additions & 0 deletions examples/all-clusters-app/nxp/zephyr/boards/frdm_rw612_fdata.conf
Original file line number Diff line number Diff line change
@@ -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
16 changes: 9 additions & 7 deletions examples/all-clusters-app/nxp/zephyr/boards/rd_rw612_bga.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
18 changes: 18 additions & 0 deletions examples/laundry-washer-app/nxp/zephyr/boards/frdm_rw612.conf
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit af8d173

Please sign in to comment.