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

[K32W0] Add platform changes and features #22896

Merged
merged 18 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ accessor
AccountLogin
acdbc
ack
ACK
ACKed
ACL
ACLs
Expand Down Expand Up @@ -156,7 +155,6 @@ bootable
Bootloader
BorderRouterAP
bouffalolab
Bouffalolab
BRD
breakpoint
bredr
Expand Down Expand Up @@ -332,6 +330,7 @@ cxx
CY
CYW
DAC
DACs
dadbdcdddedf
DAP
DAPLINK
Expand Down Expand Up @@ -449,6 +448,7 @@ dryrun
DS
duplicative
DUT
DUTS
DV
DVK
dynload
Expand Down Expand Up @@ -596,9 +596,9 @@ GPL
GPLv
Gradle
gradlew
Groupcast
GroupId
GroupKeyManagement
Groupcast
groupKeySecurityPolicy
groupKeySetID
groupsettings
Expand Down Expand Up @@ -652,7 +652,6 @@ ignoreQueryImage
ihex
IlluminanceMeasurement
IM
IsInitiator
imager
imagetool
imageUri
Expand Down Expand Up @@ -990,6 +989,7 @@ PAAs
PacketBuffer
PAI
PairDevice
PAIs
PAKE
palletsprojects
pankore
Expand Down Expand Up @@ -1376,13 +1376,14 @@ uint
ULA
UNBLUR
uncommissioned
Unencrypted
unfocus
Unicast
UniFlash
UnitLocalization
Unencrypted
unpair
unprovisioned
Unsecure
untrusted
updateAvailable
updateNotAvailable
Expand All @@ -1400,7 +1401,6 @@ userConsentState
userguide
USERINTERFACE
UserLabel
Unsecure
usermod
usr
UTF
Expand All @@ -1419,6 +1419,7 @@ ver
Verifier
Verifiers
VID
vids
virtualenv
visualstudio
vlatest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples-k32w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-k32w:0.5.99
image: connectedhomeip/chip-build-k32w:0.6.02
andrei-menzopol marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
1 change: 1 addition & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ exclude:
- "examples/chef/zzz_generated/**/*"
- "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm" # https://github.com/project-chip/connectedhomeip/issues/20236
- "src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h" # https://github.com/project-chip/connectedhomeip/issues/20236
- "examples/platform/nxp/k32w/k32w0/scripts/demo_generated_certs/**/*"


changed_paths:
Expand Down
16 changes: 5 additions & 11 deletions examples/lighting-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ k32w0_executable("light_app") {
"main/main.cpp",
]

public = [ "${chip_root}/src/platform/nxp/k32w/k32w0/DefaultTestEventTriggerDelegate.h" ]

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/lighting-app/lighting-common/",
"${chip_root}/examples/lighting-app/nxp/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
Expand Down Expand Up @@ -113,16 +116,7 @@ k32w0_executable("light_app") {
"-Wl,--defsym",
"-Wl,__app_load_address__=0x4000",
"-Wl,--defsym",
"-Wl,__app_stated_size__=0x99A00",
]
}

if (chip_enable_ota_requestor) {
ldflags += [
"-Wl,--defsym",
"-Wl,__app_load_address__=0x4000",
"-Wl,--defsym",
"-Wl,__app_stated_size__=0x99A00",
"-Wl,__app_stated_size__=0x99200",
]
}

Expand Down
57 changes: 35 additions & 22 deletions examples/lighting-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ network.
- [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous)
- [Device UI](#device-ui)
- [Building](#building)
- [Known issues](#building-issues)
- [Manufacturing data](#manufacturing)
- [Flashing and debugging](#flashdebug)
- [Pigweed Tokenizer](#tokenizer)
- [Detokenizer script](#detokenizer)
Expand Down Expand Up @@ -193,18 +195,15 @@ effects:
In order to build the Project CHIP example, we recommend using a Linux
distribution (the demo-application was compiled on Ubuntu 20.04).

- Download [K32W0 SDK 2.6.6 for Project CHIP](https://mcuxpresso.nxp.com/).
Creating an nxp.com account is required before being able to download the
SDK. Once the account is created, login and follow the steps for downloading
SDK_2_6_6_K32W061DK6 (required for K32W061 flavor). The SDK Builder UI
selection should be similar with the one from the image below.
![MCUXpresso SDK Download](../../../../platform/nxp/k32w/k32w0/doc/images/mcux-sdk-download.JPG)
- Download
[K32W0 SDK 2.6.7](https://cache.nxp.com/lgfiles/bsps/SDK_2_6_7_K32W061DK6.zip).

- Start building the application either with Secure Element or without
- without Secure Element

```
user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/home/user/Desktop/SDK_2_6_6_K32W061DK6/
user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W0_SDK_ROOT=/home/user/Desktop/SDK_2_6_7_K32W061DK6/
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/nxp/k32w/k32w0
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w0$ gn gen out/debug --args="k32w0_sdk_root=\"${NXP_K32W0_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"tinycrypt\" chip_with_se05x=0 chip_pw_tokenizer_logging=true mbedtls_repo=\"//third_party/connectedhomeip/third_party/nxp/libs/mbedtls\""
Expand Down Expand Up @@ -246,6 +245,20 @@ pycryptodome 3.9.8

The resulting output file can be found in out/debug/chip-k32w0x-light-example.

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

## Known issues

- When using Secure element and cross-compiling on Linux, log messages from
the Plug&Trust middleware stack may not echo to the console.

<a name="manufacturing"></a>

## Manufacturing data

See
[Guide for writing manufacturing data on NXP devices](../../../../platform/nxp/doc/manufacturing_flow.md).

<a name="flashdebug"></a>

## Flashing and debugging
Expand Down Expand Up @@ -414,14 +427,14 @@ Here is the interpretation of the fields:
Second, image directory 1 must be written:

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

Here is the interpretation of the fields:

```
00400000 -> start address 0x00004000
CD04 -> 0x4CD pages of 512-bytes (= 614,5kB)
CD04 -> 0x4C9 pages of 512-bytes (= 612,5kB)
01 -> bootable flag
01 -> image type for the application
```
Expand Down Expand Up @@ -482,42 +495,42 @@ used for connecting the RPis to WiFi.
Build the Linux OTA provider application:

```
doru@computer1:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota-provider-app chip_config_network_layer_ble=false
user@computer1:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota-provider-app chip_config_network_layer_ble=false
```

Build OTA image and start the OTA Provider Application:

```
doru@computer1:~/connectedhomeip$ : ./src/app/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 1 -vs "1.0" -da sha256 chip-k32w0x-light-example.bin chip-k32w0x-light-example.ota
doru@computer1:~/connectedhomeip$ : rm -rf /tmp/chip_*
doru@computer1:~/connectedhomeip$ : ./out/ota-provider-app/chip-ota-provider-app -f chip-k32w0x-light-example.ota
user@computer1:~/connectedhomeip$ : ./src/app/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 1 -vs "1.0" -da sha256 chip-k32w0x-light-example.bin chip-k32w0x-light-example.ota
user@computer1:~/connectedhomeip$ : rm -rf /tmp/chip_*
user@computer1:~/connectedhomeip$ : ./out/ota-provider-app/chip-ota-provider-app -f chip-k32w0x-light-example.ota
```

Build Linux chip-tool:

```
doru@computer1:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/chip-tool out/chip-tool-app
user@computer1:~/connectedhomeip$ : ./scripts/examples/gn_build_example.sh examples/chip-tool out/chip-tool-app
```

Provision the OTA provider application and assign node id _1_. Also, grant ACL
entries to allow OTA requestors:

```
doru@computer1:~/connectedhomeip$ : rm -rf /tmp/chip_*
doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing onnetwork 1 20202021
doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0
user@computer1:~/connectedhomeip$ : rm -rf /tmp/chip_*
user@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing onnetwork 1 20202021
user@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0
```

Provision the device and assign node id _2_:

```
doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing ble-thread 2 hex:<operationalDataset> 20202021 3840
user@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool pairing ble-thread 2 hex:<operationalDataset> 20202021 3840
```

Start the OTA process:

```
doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0
user@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0
```

<a name="otaissues"></a>
Expand All @@ -537,16 +550,16 @@ doru@computer1:~/connectedhomeip$ : ./out/chip-tool-app/chip-tool otasoftwareupd
command:

```
doru@computer1:~/connectedhomeip$ : sudo docker kill $container_id
user@computer1:~/connectedhomeip$ : sudo docker kill $container_id
```

- In order to avoid MDNS issues, only one interface should be active at one
time. E.g.: if WiFi is used then disable the Ethernet interface and also
disable multicast on that interface:

```
doru@computer1:~/connectedhomeip$ sudo ip link set dev eth0 down
doru@computer1:~/connectedhomeip$ sudo ifconfig eth0 -multicast
user@computer1:~/connectedhomeip$ sudo ip link set dev eth0 down
user@computer1:~/connectedhomeip$ sudo ifconfig eth0 -multicast
```

- If OTBR Docker image is used, then the "-B" parameter should point to the
Expand Down