Skip to content

Commit 2d0c529

Browse files
nxptestcrlonxprestyled-commits
authored
Added MW320 to all-clusters-app. (project-chip#19302)
* Added MW320 to all-clusters-app. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Added draft README for MW320 all clusters app. Removed some unused files. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Update README.md Added basic and building information. * Updated MW320 SDK to commit 3d93e61. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Added image file for README. Image used to show bring up messages of MW320. * Update README.md Added flashing information. * Update README.md * Update README.md Added "$" for commands. * Update README.md * Add the private emberAfExternalAttributeReadCallback() to fix the read commission_info error in pairing Signed-off-by: Chin-Ran Lo <chin-ran.lo@nxp.com> * Update README.md * Enable Matter console messages on mw320 * Add binding function to mw320 * Update README.md * Fixed compile error. Functin prototype is changed. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Fixed misspelling. Changed default SSID too. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Added platform "mw320" for MW320 SDK submodule. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * - Enhance the parameter checking - Change to return the correct value in the exception condition - Add the comment for casting the data type Signed-off-by: Chin-Ran Lo <chin-ran.lo@nxp.com> * Added mw320 to ALL_PLATFORMS. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Fixed issue on KeyValueStoreManagerImpl::_Get. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Removed unused code. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Fixed remaining issue on KeyValueStoreManagerImpl::_Get. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Restyled by clang-format * Removed unused image. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Fixed checking error by Lint Action. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Removed unused code. Signed-off-by: David Lin <yu-hao.lin@nxp.com> * Fixed merge error. Signed-off-by: David Lin <yu-hao.lin@nxp.com> Co-authored-by: Chin-Ran Lo <chin-ran.lo@nxp.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 8a4c025 commit 2d0c529

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+7077
-8
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@
237237
url = https://github.com/bouffalolab/bl_iot_sdk_matter.git
238238
branch = bl602_release
239239
platforms = bl602
240+
[submodule "third_party/nxp/mw320_sdk/repo"]
241+
path = third_party/nxp/mw320_sdk/repo
242+
url = https://github.com/nxptest/mw320_sdk
243+
platforms = mw320
240244
[submodule "third_party/nxp/libs/mbedtls/repo"]
241245
path = third_party/nxp/libs/mbedtls/repo
242246
url = https://github.com/NXPmicro/mbedtls.git

BUILD.gn

+12
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
203203

204204
# Set this to true to enable bl602 builds by default.
205205
enable_bl602_builds = false
206+
207+
# Set this to true to enable mw320 builds by default.
208+
enable_mw320_builds = false
206209
}
207210

208211
declare_args() {
@@ -291,6 +294,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
291294
# Build the bl602 lighting app example.
292295
enable_bl602_lighting_app_build = enable_bl602_builds
293296

297+
# Build the mw320 shell app example.
298+
enable_mw320_shell_build = enable_mw320_builds
299+
294300
enable_fake_tests = enable_default_builds && host_os == "linux"
295301

296302
enable_tizen_lighting_app = enable_tizen_builds
@@ -484,6 +490,12 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
484490
}
485491
}
486492

493+
if (enable_mw320_shell_build) {
494+
group("mw320_shell") {
495+
deps = [ "${chip_root}/examples/shell/mw320(${chip_root}/config/mw320/toolchain:mw320_shell)" ]
496+
}
497+
}
498+
487499
group("default") {
488500
deps = []
489501
if (enable_host_clang_build) {

build/config/BUILDCONFIG.gn

+1-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ if (_chip_defaults.custom_toolchain != "") {
110110
"${_build_overrides.build_root}/toolchain/tizen:tizen_${target_cpu}"
111111
} else if (target_os == "webos") {
112112
if (target_cpu == "arm" || target_cpu == "arm64") {
113-
_default_toolchain =
114-
"${_build_overrides.build_root}/toolchain/webos"
113+
_default_toolchain = "${_build_overrides.build_root}/toolchain/webos"
115114
} else {
116115
assert(false,
117116
"Unsupported target_cpu: ${current_cpu}. Shall be arm for webOS")

build_overrides/mw320_sdk.gni

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for MW320 SDK.
17+
mw320_sdk_build_root = "//third_party/mw320_sdk"
18+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# The location of the build configuration file.
16+
buildconfig = "//build/config/BUILDCONFIG.gn"
17+
18+
# CHIP uses angle bracket includes.
19+
check_system_includes = true
20+
21+
default_args = {
22+
target_cpu = "arm"
23+
target_os = "freertos"
24+
25+
import("//args.gni")
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
import("//build_overrides/lwip.gni")
18+
import("//build_overrides/mw320_sdk.gni")
19+
20+
import("${mw320_sdk_build_root}/mw320_executable.gni")
21+
import("${mw320_sdk_build_root}/mw320_sdk.gni")
22+
23+
assert(current_os == "freertos")
24+
25+
examples_plat_dir = "${chip_root}/examples/platform/nxp/mw320"
26+
27+
mw320_sdk("sdk") {
28+
include_dirs = [
29+
"${chip_root}/src/platform/nxp/mw320",
30+
"${examples_plat_dir}/app/project_include",
31+
"${chip_root}/src/app/util",
32+
"${chip_root}/examples/all-clusters-app/nxp/mw320/include",
33+
]
34+
35+
sources = [
36+
"include/CHIPProjectConfig.h",
37+
"include/FreeRTOSConfig.h",
38+
]
39+
40+
defines = []
41+
42+
if (is_debug) {
43+
defines += [ "BUILD_RELEASE=0" ]
44+
} else {
45+
defines += [ "BUILD_RELEASE=1" ]
46+
}
47+
}
48+
49+
mw320_executable("shell_mw320") {
50+
include_dirs = []
51+
defines = []
52+
output_name = "all-cluster-mw320.out"
53+
54+
public_deps = [
55+
":sdk",
56+
"${chip_root}/examples/all-clusters-app/all-clusters-common",
57+
"${chip_root}/examples/shell/shell_common:shell_common",
58+
"${chip_root}/src/lib",
59+
"${chip_root}/src/lib/shell",
60+
"${chip_root}/src/setup_payload",
61+
]
62+
63+
include_dirs = [
64+
"${chip_root}/src/platform/nxp/mw320",
65+
"${examples_plat_dir}/app/project_include",
66+
"${chip_root}/src/app/util",
67+
"${chip_root}/examples/all-clusters-app/all-clusters-common/include",
68+
"${chip_root}/examples/all-clusters-app/nxp/mw320/include",
69+
]
70+
sources = [
71+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
72+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
73+
"${chip_root}/src/lib/shell/streamer_mw320.cpp",
74+
"binding-handler.cpp",
75+
"include/CHIPProjectConfig.h",
76+
"include/FreeRTOSConfig.h",
77+
"main.cpp",
78+
]
79+
80+
output_dir = root_out_dir
81+
82+
ldscript = "${examples_plat_dir}/app/ldscripts/88MW320_xx_xxxx_flash.ld"
83+
84+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
85+
defines = [
86+
"MW320_SHELL_STREAMER",
87+
"SHELL_STREAMER_APP_SPECIFIC",
88+
]
89+
}
90+
91+
group("mw320") {
92+
deps = [ ":shell_mw320" ]
93+
}
94+
95+
group("default") {
96+
deps = [ ":mw320" ]
97+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Matter MW320 All Clusters Example Application
2+
3+
The example is based on
4+
[Matter](https://github.com/project-chip/connectedhomeip) and the NXP MW320 SDK
5+
to demonstrates device commissioning and cluster control over a low-power, WiFi
6+
802.11n network.
7+
8+
<hr>
9+
10+
- [Matter MW320 All Clusters Example Application](#matter-mw320-all-clusters-example-application)
11+
- [Introduction](#introduction)
12+
- [Building](#building)
13+
- [Flashing](#flashing)
14+
- [Testing the example](#testing-the-example)
15+
16+
<hr>
17+
18+
<a name="intro"></a>
19+
20+
## Introduction
21+
22+
![MW320](../../../platform/nxp/mw320/doc/images/mw320.jpg)
23+
24+
The example targets the
25+
[NXP MW320 WiFi Micro controller Soc](https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth/88mw32x-802-11n-wi-fi-microcontroller-soc:88MW32X)
26+
development kit.
27+
28+
<a name="building"></a>
29+
30+
## Building
31+
32+
Building the example application is quite straightforward. It can be done via
33+
following commands:
34+
35+
```
36+
$ git submodule update --init
37+
$ source third_party/connectedhomeip/scripts/activate.sh
38+
$ gn gen out/debug
39+
$ ninja -v -C out/debug
40+
```
41+
42+
Example application binary file "all-cluster-mw320.bin" will be generated under
43+
directory "out/debug".
44+
45+
Note:
46+
47+
1. "git submodule update --init" only needs to be issued for the first time in
48+
order to download MW320 SDK for Matter.
49+
2. "source third_party/connectedhomeip/scripts/activate.sh" can be omitted if
50+
your environment is already setup without issues.
51+
52+
<a name="flashdebug"></a>
53+
54+
## Flashing
55+
56+
Connect MW320 to Ubuntu USB port and open Linux text-based serial port
57+
communications program at second USB interface (/dev/ttyUSB1):
58+
59+
```
60+
$ TERM=linux minicom -D /dev/ttyUSB1 -b 115200
61+
```
62+
63+
Prepare MW320 download firmware image:
64+
65+
```
66+
$ ln -sf third_party/connectedhomeip/third_party/nxp/mw320_sdk/repo mw320_sdk
67+
$ mw320_sdk/tools/mw_img_conv/bin/mw_img_conv mcufw out/debug/all-cluster-mw320.bin out/debug/all-cluster-mw320.mcufw.bin 0x1F010000
68+
$ cp out/debug/all-cluster-mw320.mcufw.bin mw320_sdk/mw320_matter_flash/Matter/.
69+
```
70+
71+
Install OpenOCD (Open On-Chip Debugger):
72+
73+
```
74+
$ sudo apt-get install openocd
75+
```
76+
77+
Flashing firmware image to MW320:
78+
79+
```
80+
$ cd mw320_sdk/mw320_matter_flash
81+
$ sudo python2 flashprog.py -l Matter/layout-4m.txt --boot2 Matter/boot2.bin --wififw Matter/mw32x_uapsta_W14.88.36.p172.bin --mcufw Matter/all-cluster-mw320.mcufw.bin -r
82+
```
83+
84+
After MW320 is reset, console will allow you to enter commands:
85+
86+
![MW320_CONSOLE](../../../platform/nxp/mw320/doc/images/mw320_console.jpg)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
import("${chip_root}/examples/platform/nxp/mw320/args.gni")
17+
18+
mw320_sdk_target = get_label_info(":sdk", "label_no_toolchain")
19+
20+
declare_args() {
21+
chip_enable_ota_requestor = true
22+
}

0 commit comments

Comments
 (0)