Skip to content

Commit

Permalink
NXP folder architecture improvement (#33987)
Browse files Browse the repository at this point in the history
* [NXP] Adding nxp_matter_support submodule

Adding a reference to the nxp_matter_support repo that would be used to get NXP SDK support files.

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>

* [NXP] Moving NXP Matter SDK support files to a dedicated nxp_matter_support repo

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>

* [NXP][script] Adding an update nxp sdk script allowing to initialize all nxp SDK with west for all platform

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>

* [NXP][doc][k32w0] Updating nxp sdk update steps to use new update_nxp_sdk.py script

+ updating environement setup documentation

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>

* [NXP][k32w0] Updating default sdk path to nxp_matter_support

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>

* Restyled by gn

* Restyled by prettier-markdown

* [NXP][script] Updating update_nxp_sdk script to clean force update processing

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>

* Updating nxp_sdk update script after code review

- dataclass is now used
- subprocess dependencies on cwd removed with possible (for west update and west forall cwd is still required)
- python logging module is now used

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>

---------

Signed-off-by: Gatien Chapon <gatien.chapon@nxp.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
chapongatien and restyled-commits committed Jul 5, 2024
1 parent f779369 commit 82b1e1b
Show file tree
Hide file tree
Showing 74 changed files with 271 additions and 8,087 deletions.
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,8 @@
url = https://github.com/Infineon/optiga-trust-m.git
branch = matter_support
platforms = infineon
[submodule "third_party/nxp/nxp_matter_support"]
path = third_party/nxp/nxp_matter_support
url = https://github.com/NXP/nxp_matter_support.git
branch = master
platforms = nxp
6 changes: 5 additions & 1 deletion build_overrides/nxp_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@

declare_args() {
# Root directory for NXP SDKs.
nxp_sdk_build_root = "//third_party/nxp"
nxp_sdk_matter_support_root = "//third_party/nxp/nxp_matter_support"
}

declare_args() {
nxp_sdk_build_root = "${nxp_sdk_matter_support_root}/gn_build"
}
3 changes: 2 additions & 1 deletion examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ declare_args() {
setup_discriminator = 3840
}

example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}"
example_platform_dir =
"${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}"
common_example_dir = "${chip_root}/examples/platform/nxp/common"

if (tcp_download == true && wifi_connect == true) {
Expand Down
7 changes: 6 additions & 1 deletion examples/build_overrides/nxp_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@

declare_args() {
# Root directory for NXP SDKs.
nxp_sdk_build_root = "//third_party/connectedhomeip/third_party/nxp"
nxp_sdk_matter_support_root =
"//third_party/connectedhomeip/third_party/nxp/nxp_matter_support"
}

declare_args() {
nxp_sdk_build_root = "${nxp_sdk_matter_support_root}/gn_build"
}
123 changes: 66 additions & 57 deletions examples/contact-sensor-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,42 @@ network.

<hr>

- [CHIP K32W0 Contact Sensor Example Application](#chip-k32w061-contact-sensor-example-application)
- [Introduction](#introduction)
- [Bluetooth LE Advertising](#bluetooth-le-advertising)
- [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous)
- [Device UI](#device-ui)
- [Building](#building)
- [Overwrite board config files](#overwrite-board-config-files)
- [Known issues building](#known-issues-building)
- [Long Idle Time ICD Support](#long-idle-time-icd-support)
- [Manufacturing data](#manufacturing-data)
- [Flashing and debugging](#flashing-and-debugging)
- [Pigweed Tokenizer](#pigweed-tokenizer)
- [Detokenizer script](#detokenizer-script)
- [Notes](#notes)
- [Known issues tokenizer](#known-issues-tokenizer)
- [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library)
- [Building steps](#building-steps)
- [Tinycrypt ECC library](#tinycrypt-ecc-library)
- [Building steps](#building-steps-1)
- [OTA](#ota)
- [Writing the SSBL](#writing-the-ssbl)
- [Writing the PSECT](#writing-the-psect)
- [Writing the application](#writing-the-application)
- [OTA Testing](#ota-testing)
- [Known issues ota](#known-issues-ota)
- [Low power](#low-power)
- [Known issues low power](#known-issues-low-power)
- [Removing SSBL Upgrade region](#removing-ssbl-upgrade-region)

</hr>
- [CHIP K32W061 Contact Sensor Example Application](#chip-k32w061-contact-sensor-example-application)
- [Introduction](#introduction)
- [SE051H Secure Element](#se051h-secure-element)
- [Bluetooth LE Advertising](#bluetooth-le-advertising)
- [LIT ICD Active Mode](#lit-icd-active-mode)
- [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous)
- [Thread Provisioning](#thread-provisioning)
- [Device UI](#device-ui)
- [No expansion board](#no-expansion-board)
- [Building](#building)
- [Long Idle Time ICD Support](#long-idle-time-icd-support)
- [Overwrite board config files](#overwrite-board-config-files)
- [Known issues building](#known-issues-building)
- [Rotating device id](#rotating-device-id)
- [Manufacturing data](#manufacturing-data)
- [Flashing and debugging](#flashing-and-debugging)
- [Pigweed tokenizer](#pigweed-tokenizer)
- [Detokenizer script](#detokenizer-script)
- [Notes](#notes)
- [Known issues tokenizer](#known-issues-tokenizer)
- [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library)
- [Building steps](#building-steps)
- [Tinycrypt ECC library](#tinycrypt-ecc-library)
- [Building steps](#building-steps-1)
- [OTA](#ota)
- [Writing the SSBL](#writing-the-ssbl)
- [Features](#features)
- [Multi image](#multi-image)
- [Simple hash verification](#simple-hash-verification)
- [Writing the PSECT](#writing-the-psect)
- [Writing the application](#writing-the-application)
- [OTA Testing](#ota-testing)
- [Known issues ota](#known-issues-ota)
- [Low power](#low-power)
- [Known issues low power](#known-issues-low-power)
- [Removing SSBL Upgrade Region](#removing-ssbl-upgrade-region)

## Introduction

Expand Down Expand Up @@ -179,44 +185,47 @@ contact status.
## Building

In order to build the Project CHIP example, we recommend using a Linux
distribution (the demo-application was compiled on Ubuntu 20.04).
distribution (supported Operating Systems are listed in
[BUILDING.md](../../../../../docs/guides/BUILDING.md#tested-operating systems)).

Activate the Matter environment:
- Make sure that below prerequisites are correctly installed (as described in
[BUILDING.md](../../../../../docs/guides/BUILDING.md#prerequisites)))

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
```
sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \
libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \
python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev
```

To bring the SDK in the environment, the user can:
- Step 1: checkout NXP specific submodules only

- download it with west tool, in which case it will be handled automatically
by gn:
```
user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive
```

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update
```
- Step 2: activate local environment

In case there are local modification to the already installed github NXP
SDK, use the below `west forall` command instead of the `west init` command
to reset the west workspace. Warning: all local changes will be lost after
running this command.
```
user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh
```

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west forall -c "git reset --hard && git clean -xdf" -a
```
If the script says the environment is out of date, you can update it by running
the following command:

- set up a custom path to the SDK, in which case
`k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\"` must be added to the `gn gen`
command:
```
user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh
```

```
user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/custom/path/to/SDK
```
- Step 3: Init NXP SDK(s)

```
user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/setup/nxp/update_nxp_sdk.py --platform k32w0
```

Note: By default setup/nxp/update_nxp_sdk.py will try to initialize all NXP
SDKs. Arg "-- help" could be used to view all available options.

Start building the application:
- Start building the application:

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/contact-sensor-app/nxp/k32w/k32w0
Expand Down
3 changes: 2 additions & 1 deletion examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ declare_args() {
setup_discriminator = 3840
}

example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}"
example_platform_dir =
"${nxp_sdk_matter_support_root}/examples/platform/${nxp_platform}"
common_example_dir = "${chip_root}/examples/platform/nxp/common"

if (tcp_download == true && wifi_connect == true) {
Expand Down
110 changes: 60 additions & 50 deletions examples/lighting-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,37 @@ network.
<hr>

- [CHIP K32W061 Lighting Example Application](#chip-k32w061-lighting-example-application)
- [Introduction](#introduction)
- [Bluetooth LE Advertising](#bluetooth-le-advertising)
- [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous)
- [Device UI](#device-ui)
- [Building](#building)
- [Overwrite board config files](#overwrite-board-config-files)
- [Introduction](#introduction)
- [SE051H Secure Element](#se051h-secure-element)
- [Bluetooth LE Advertising](#bluetooth-le-advertising)
- [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous)
- [Thread Provisioning](#thread-provisioning)
- [Device UI](#device-ui)
- [No expansion board](#no-expansion-board)
- [Identify cluster LED state](#identify-cluster-led-state)
- [Building](#building)
- [Overwrite board config files](#overwrite-board-config-files)
- [Known issues building](#known-issues-building)
- [Manufacturing data](#manufacturing-data)
- [Flashing and debugging](#flashing-and-debugging)
- [Pigweed Tokenizer](#pigweed-tokenizer)
- [Detokenizer script](#detokenizer-script)
- [Notes](#notes)
- [Known issues tokenizer](#known-issues-tokenizer)
- [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library)
- [Building steps](#building-steps)
- [Tinycrypt ECC library](#tinycrypt-ecc-library)
- [Building steps](#building-steps-1)
- [OTA](#ota)
- [Writing the SSBL](#writing-the-ssbl)
- [Writing the PSECT](#writing-the-psect)
- [Writing the application](#writing-the-application)
- [OTA Testing](#ota-testing)
- [Known issues OTA](#known-issues-ota)
</hr>
- [Rotating device id](#rotating-device-id)
- [Manufacturing data](#manufacturing-data)
- [Flashing and debugging](#flashing-and-debugging)
- [Pigweed tokenizer](#pigweed-tokenizer)
- [Detokenizer script](#detokenizer-script)
- [Notes](#notes)
- [Known issues tokenizer](#known-issues-tokenizer)
- [NXP Ultrafast P256 ECC Library](#nxp-ultrafast-p256-ecc-library)
- [Building steps](#building-steps)
- [Tinycrypt ECC library](#tinycrypt-ecc-library)
- [Building steps](#building-steps-1)
- [OTA](#ota)
- [Writing the SSBL](#writing-the-ssbl)
- [Features](#features)
- [Multi image](#multi-image)
- [Simple hash verification](#simple-hash-verification)
- [Writing the PSECT](#writing-the-psect)
- [Writing the application](#writing-the-application)
- [OTA Testing](#ota-testing)
- [Known issues ota](#known-issues-ota)

## Introduction

Expand Down Expand Up @@ -190,44 +197,47 @@ effects:
## Building

In order to build the Project CHIP example, we recommend using a Linux
distribution (the demo-application was compiled on Ubuntu 20.04).
distribution (supported Operating Systems are listed in
[BUILDING.md](../../../../../docs/guides/BUILDING.md#tested-operating systems)).

Activate the Matter environment:
- Make sure that below prerequisites are correctly installed (as described in
[BUILDING.md](../../../../../docs/guides/BUILDING.md#prerequisites)))

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
```
sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \
libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \
python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev
```

To bring the SDK in the environment, the user can:
- Step 1: checkout NXP specific submodules only

- download it with west tool, in which case it will be handled automatically
by gn:
```
user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive
```

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west init -l manifest --mf west.yml
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west update
```
- Step 2: activate local environment

In case there are local modification to the already installed github NXP
SDK, use the below `west forall` command instead of the `west init` command
to reset the west workspace. Warning: all local changes will be lost after
running this command.
```
user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh
```

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ cd third_party/nxp/k32w0_sdk/repo
user@ubuntu:~/Desktop/git/connectedhomeip/third_party/nxp/k32w0_sdk/repo$ west forall -c "git reset --hard && git clean -xdf" -a
```
If the script says the environment is out of date, you can update it by running
the following command:

- set up a custom path to the SDK, in which case
`k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\"` must be added to the `gn gen`
command:
```
user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh
```

- Step 3: Init NXP SDK(s)

```
user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/setup/nxp/update_nxp_sdk.py --platform k32w0
```

```
user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/custom/path/to/SDK
```
Note: By default setup/nxp/update_nxp_sdk.py will try to initialize all NXP
SDKs. Arg "-- help" could be used to view all available options.

Start building the application:
- Start building the application:

```bash
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/nxp/k32w/k32w0
Expand Down
Loading

0 comments on commit 82b1e1b

Please sign in to comment.