Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NXP] Update k32w0 folder structure #34772

Merged
merged 11 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .restyled.yaml
Original file line number Diff line number Diff line change
@@ -72,7 +72,6 @@ exclude:
- "scripts/tools/zap/tests/outputs/**/*" # Matches generated output 1:1
- "examples/chef/sample_app_util/test_files/*.yaml"
- "examples/chef/zzz_generated/**/*"
- "examples/platform/nxp/k32w/k32w0/scripts/demo_generated_certs/**/*"
- "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/*" # zap-generated files
- "integrations/cloudbuild/*.yaml" # uglier long command line content
- "scripts/run_codegen_targets.sh" # shellharden breaks for loops over command outputs
6 changes: 3 additions & 3 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -689,23 +689,23 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {

if (enable_k32w_lighting_app_build) {
group("k32w_lighting_app") {
deps = [ "${chip_root}/examples/lighting-app/nxp/k32w/k32w0/(${chip_root}/config/k32w/toolchain:k32w_lighting_app)" ]
deps = [ "${chip_root}/examples/lighting-app/nxp/k32w0/(${chip_root}/config/k32w/toolchain:k32w_lighting_app)" ]
}

extra_build_deps += [ ":k32w_lighting_app" ]
}

if (enable_k32w_lock_app_build) {
group("k32w_lock_app") {
deps = [ "${chip_root}/examples/lock-app/nxp/k32w/k32w0/(${chip_root}/config/k32w/toolchain:k32w_lock_app)" ]
deps = [ "${chip_root}/examples/lock-app/nxp/k32w0/(${chip_root}/config/k32w/toolchain:k32w_lock_app)" ]
}

extra_build_deps += [ ":k32w_lock_app" ]
}

if (enable_k32w_shell_app_build) {
group("k32w_shell_app") {
deps = [ "${chip_root}/examples/shell/nxp/k32w/k32w0/(${chip_root}/config/k32w/toolchain:k32w_shell_app)" ]
deps = [ "${chip_root}/examples/shell/nxp/k32w0/(${chip_root}/config/k32w/toolchain:k32w_shell_app)" ]
}

extra_build_deps += [ ":k32w_shell_app" ]
8 changes: 4 additions & 4 deletions config/k32w/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -20,27 +20,27 @@ import("${build_root}/toolchain/arm_gcc/arm_toolchain.gni")
arm_toolchain("k32w_lighting_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/lighting-app/nxp/k32w/k32w0/args.gni")
import("${chip_root}/examples/lighting-app/nxp/k32w0/args.gni")
}
}

arm_toolchain("k32w_lock_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/lock-app/nxp/k32w/k32w0/args.gni")
import("${chip_root}/examples/lock-app/nxp/k32w0/args.gni")
}
}

arm_toolchain("k32w_contact_sensor_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/contact-sensor-app/nxp/k32w/k32w0/args.gni")
import("${chip_root}/examples/contact-sensor-app/nxp/k32w0/args.gni")
}
}

arm_toolchain("k32w_shell_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/shell/nxp/k32w/k32w0/args.gni")
import("${chip_root}/examples/shell/nxp/k32w0/args.gni")
}
}
8 changes: 4 additions & 4 deletions docs/QUICK_START.md
Original file line number Diff line number Diff line change
@@ -17,10 +17,10 @@ and platforms.
Use one of the controllers listed above and then a Border Router and Node
combination listed below.

| <div style="width:200px">Border Router</div> | <div style="width:200px">Node</div> | Description |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**ot-br**](https://openthread.io/guides/border-router/build)<br>Thread Border Router <li>RasPi <li>BeagleBone | **lighting-app** <li>[Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nrfconnect/README.md) <li> [NXP K32W](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nxp/k32w/k32w0/README.md) <li> [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/qpg) <li> [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/silabs/README.md) | The Lighting example is supported by many of the available Thread platforms. See the chip-tool controller instructions for how to actuate the light on/off cluster. |
| [**ot-br**](https://openthread.io/guides/border-router/build)<br>Thread Border Router <li>RasPi <li>BeagleBone | **lock-app** <li>[Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/nrfconnect/README.md) <li> [NXP K32W](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/nxp/k32w/k32w0/README.md) <li> [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/qpg) <li> [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/efr32/README.md) <li> [TI CC13x2x7](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/cc13x2x7_26x2x7/README.md) | The Lock example is supported by many of the available Thread and Wi-Fi platforms. |
| <div style="width:200px">Border Router</div> | <div style="width:200px">Node</div> | Description |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**ot-br**](https://openthread.io/guides/border-router/build)<br>Thread Border Router <li>RasPi <li>BeagleBone | **lighting-app** <li>[Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nrfconnect/README.md) <li> [NXP K32W](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nxp/k32w0/README.md) <li> [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/qpg) <li> [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/silabs/README.md) | The Lighting example is supported by many of the available Thread platforms. See the chip-tool controller instructions for how to actuate the light on/off cluster. |
| [**ot-br**](https://openthread.io/guides/border-router/build)<br>Thread Border Router <li>RasPi <li>BeagleBone | **lock-app** <li>[Nordic nRF5x](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/nrfconnect/README.md) <li> [Qorvo QPG6100](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/qpg) <li> [Silicon Labs EFR32](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/efr32/README.md) <li> [TI CC13x2x7](https://github.com/project-chip/connectedhomeip/tree/master/examples/lock-app/cc13x2x7_26x2x7/README.md) | The Lock example is supported by many of the available Thread and Wi-Fi platforms. |

## Controllers

232 changes: 232 additions & 0 deletions docs/guides/nxp/nxp_k32w0_ota_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# NXP K32W0x1 OTA guide

## The Secondary Stage Bootloader (SSBL)

There are multiple SSBL binaries provided by the SDK:

| description | github SDK path | package SDK path |
| ------------------------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| Default SSBL | NA | `boards/k32w061dk6/wireless_examples/framework/ssbl/binary/ssbl.bin` |
| SSBL with PDM in external flash | `examples/k32w061dk6/wireless_examples/framework/ssbl/binary/ssbl_ext_flash_pdm_support.bin` | `boards/k32w061dk6/wireless_examples/framework/ssbl/binary/ssbl_ext_flash_pdm_support.bin` |

The SSBL is also built alongside the reference application and it can be
configured according to the following table:

| gn arg | default | description |
| --------------------------------- | --------------------------- | ---------------------------------------------------------------------------------------- |
| `ssbl_pdm_external_flash` | true | Enable/disable PDM in external flash |
| `ssbl_multi_image_support` | true | Enable/disable multi-image OTA feature |
| `ssbl_ota_entry_storage` | "OTACustomStorage_ExtFlash" | Configure custom OTA entry storage type |
| `ssbl_simple_hash_verification` | false | Enable/disable simple hash verification alternative to secure boot |
| `ssbl_optimize_spifi_flash` | false | Optimize `SPIFI` flash driver size |
| `ssbl_spifi_dual_mode` | false | Enable/disable `SPIFI` dual mode support (e.g. used by K32W041AM variant) |
| `ssbl_version` | 0 | Set SSBL version |
| `ssbl_use_redlib` | false | Enable/disable usage of `redlib` NXP library. If false, the build will use `newlib` nano |
| `ssbl_ota_data_in_external_flash` | false | Enable/disable OTA support for application with sections stored in external flash |

## Simple hash verification

When secure boot is not used, a simple hash can be appended at the end of the
image for integrity check. Applications should be built with
`chip_simple_hash_verification=1`.

## Writing the SSBL

Before writing the SSBL, it it recommanded to fully erase the internal flash.

Using DK6Programmer utility from Windows:

```
DK6Programmer.exe -V 5 -P 1000000 -s <COM_PORT> -e Flash
```

Using `dk6prog` from `SPSDK`:

```
$ dk6prog listdev
This is an experimental utility. Use with caution!

List of available devices:
DEVICE ID: DN038ZH3, VID: 0x403, PID: 0x6015, Serial number: DN038ZH3, Description: DK6 Carrier Board, Address: 9, Backend: Backend.PYFTDI
$ dk6prog -d DN038ZH3 erase 0 0x9de00

This is an experimental utility. Use with caution!

Erasing memory [####################################] 100%
```

`chip-k32w0x-ssbl.bin` must be written at address 0 in the internal flash:

Using DK6Programmer utility from Windows:

```
DK6Programmer.exe -V2 -s <COM_PORT> -P 1000000 -Y -p FLASH@0x00="chip-k32w0x-ssbl.bin"
```

Using `dk6prog` from `SPSDK`:

```
$ dk6prog -d DN038ZH3 write 0 ~/path/to/bin/chip-k32w0x-ssbl.bin

This is an experimental utility. Use with caution!

Writing memory [####################################] 100%
Written 7890 bytes to memory ID 0 at address 0x0
```

### Writing the PSECT

This is the list of all supported partitions:

```
0000000010000000 : SSBL partition

00000000 -----------> Start Address
1000 ---------------> 0x0010 Number of 512-bytes pages
00 -----------------> 0x00 Bootable flag
00 -----------------> 0x00 Image type (0x00 = SSBL)

00400000c9040101: Application partition

00400000 -----------> 0x00004000 Start Address
c904 ---------------> 0x04c9 Number of 512-bytes pages
01 -----------------> 0x01 Bootable flag
01 -----------------> 0x01 Image type (0x01 = Application)

00000010800000fe: Ext Flash text partition

00000010 -----------> 0x10000000 Start Address (external flash)
8000 ---------------> 0x0080 Number of 512-bytes pages
00 -----------------> 0x00 Bootable flag
fe -----------------> 0xFE Image type (0xFE = Ext Flash text)

00000110300200fc : OTA Image partition

00000110 -----------> 0x10010000 Start Address
3002----------------> 0x0230 Number of 512-bytes pages
00 -----------------> 0x00 Bootable flag
fc -----------------> 0xFC Image type (0xFC = OTA partition)

00000510100000fd: NVM partition

00000510 -----------> 0x10050000 Start Address
1000 ---------------> 0x0010 Number of 512-bytes pages
00 -----------------> 0x00 Bootable flag
fd -----------------> 0xFD Image type (0xFD = NVM partition)
```

First, image directory 0 (SSBL partition) must be written:

Using DK6Programmer utility from Windows:

```
DK6Programmer.exe -V5 -s <COM port> -P 1000000 -w image_dir_0=0000000010000000
```

Using `dk6prog` from `SPSDK`:

```
$ dk6prog -d DN038ZH3 write 0x160 [[0000000010000000]] 8 PSECT

This is an experimental utility. Use with caution!

Writing memory [####################################] 100%
Written 8 bytes to memory ID PSECT at address 0x160
```

Here is the interpretation of the fields:

```
00000000 -> start address 0x00000000
1000 -> size = 0x0010 pages of 512-bytes (= 8kB)
00 -> not bootable (only used by the SSBL to support SSBL update)
00 -> SSBL Image Type
```

Second, image directory 1 (application partition) must be written:

Using DK6Programmer utility from Windows:

```
DK6Programmer.exe -V5 -s <COM port> -P 1000000 -w image_dir_1=00400000C9040101
```

Using `dk6prog` from `SPSDK`:

```
$ dk6prog -d DN038ZH3 write 0x168 [[00400000C9040101]] 8 PSECT

This is an experimental utility. Use with caution!

Writing memory [####################################] 100%
Written 8 bytes to memory ID PSECT at address 0x168
```

Here is the interpretation of the fields:

```
00400000 -> start address 0x00004000
C904 -> 0x4C9 pages of 512-bytes (= 612.5kB)
01 -> bootable flag
01 -> image type for the application
```

Please note the user can write additional partitions by writing
`image_dir_2/3/4` with the wanted configuration. In case of using the `SPSDK`
tool, the appropriate offset must be calculated

## Removing SSBL Upgrade Region

The example also offers the possibility to remove SSBL upgrade region, for
reserving more space for application level.

A new flag `chip_reduce_ssbl_size` is introduced. In order to remove the SSBL
upgrade region, `chip_reduce_ssbl_size=true` must be provided to the build
system

The programming method will change:

- Writing image directory 1 should change to Using DK6Programmer utility from
Windows:

```
DK6Programmer.exe -V5 -s <COM port> -P 1000000 -w image_dir_1=00200000D9040101
```

Using `dk6prog` from `SPSDK`:

```
$ dk6prog -d DN038ZH3 write 0x168 [[00200000D9040101]] 8 PSECT

This is an experimental utility. Use with caution!

Writing memory [####################################] 100%
Written 8 bytes to memory ID PSECT at address 0x168
```

Here is the interpretation of the fields:

```
00200000 -> start address 0x00002000
D904 -> 0x4D9 pages of 512-bytes (= 620.5kB)
01 -> bootable flag
01 -> image type for the application
```

- Matter application offset address should change to Using DK6Programmer
utility from Windows:

```
DK6Programmer.exe -V2 -s <COM_PORT> -P 1000000 -Y -p FLASH@0x2000="chip-k32w0x-contact-example.bin"
```

Using `dk6prog` from `SPSDK`:

```
$ dk6prog -d DN038ZH3 write 0x2000 ~/path/to/bin/chip-k32w0x-contact-example.bin

This is an experimental utility. Use with caution!

Writing memory [####################################] 100%
Written 596450 bytes to memory ID 0 at address 0x2000
```
Loading
Loading