Skip to content

Commit 574ed96

Browse files
Chin-Ran Lodvagner
Chin-Ran Lo
authored andcommitted
[nxp noup][example][cooksurface-app] Add the cooksurface-app for Zephyr platform
Signed-off-by: Chin-Ran Lo <nxf57500@lsv051039.swis.nl-cdc01.nxp.com>
1 parent 8490c6f commit 574ed96

16 files changed

+6581
-0
lines changed

examples/cooksurface-app/nxp/zap/cooksurface-app-wifi-noicd.matter

+1,744
Large diffs are not rendered by default.

examples/cooksurface-app/nxp/zap/cooksurface-app-wifi-noicd.zap

+4,308
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
cmake_minimum_required(VERSION 3.13.1)
17+
18+
get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH)
19+
get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH)
20+
get_filename_component(ALL_CLUSTERS_COMMON_DIR ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH)
21+
get_filename_component(COOKSURFACE_NXP_COMMON_DIR ${CHIP_ROOT}/examples/cooksurface-app/nxp/common REALPATH)
22+
get_filename_component(EXAMPLE_PLATFORM_NXP_COMMON_DIR ${CHIP_ROOT}/examples/platform/nxp/common REALPATH)
23+
get_filename_component(EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR ${CHIP_ROOT}/examples/platform/nxp/zephyr REALPATH)
24+
25+
# Perform common operations like detecting extra overlays in the platform folder for the target board
26+
# This must be called before find_package(Zephyr)
27+
include(${CHIP_ROOT}/config/nxp/app/pre-zephyr.cmake)
28+
29+
list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/nxp/chip-module)
30+
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
31+
32+
# -Wmaybe-uninitialized has too many false positives, including on std::optional
33+
# and chip::Optional. Make it nonfatal.
34+
#
35+
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
36+
target_compile_options(app PRIVATE -Werror -Wno-error=maybe-uninitialized)
37+
target_compile_options(app PRIVATE -Werror PRIVATE -Wno-error=format)
38+
39+
project(chip-nxp-all-clusters-app-example)
40+
41+
include(${CHIP_ROOT}/config/nxp/app/enable-gnu-std.cmake)
42+
include(${CHIP_ROOT}/src/app/chip_data_model.cmake)
43+
44+
target_include_directories(app
45+
PRIVATE
46+
${COOKSURFACE_NXP_COMMON_DIR}/main/include
47+
${COOKSURFACE_NXP_COMMON_DIR}/Zephyr/include
48+
${ALL_CLUSTERS_COMMON_DIR}/include
49+
${GEN_DIR}/app-common
50+
${GEN_DIR}/all-clusters-app
51+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/include
52+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/include
53+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/include
54+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/factory_data/include
55+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/include
56+
)
57+
58+
target_sources(app
59+
PRIVATE
60+
main/main.cpp
61+
${COOKSURFACE_NXP_COMMON_DIR}/main/AppTask.cpp
62+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_manager/source/CHIPDeviceManager.cpp
63+
${COOKSURFACE_NXP_COMMON_DIR}/main/DeviceCallbacks.cpp
64+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/device_callbacks/source/CommonDeviceCallbacks.cpp
65+
${COOKSURFACE_NXP_COMMON_DIR}/main/ZclCallbacks.cpp
66+
${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp
67+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskBase.cpp
68+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/app_task/source/AppTaskZephyr.cpp
69+
${EXAMPLE_PLATFORM_NXP_ZEPHYR_DIR}/factory_data/source/AppFactoryDataExample.cpp
70+
)
71+
72+
target_compile_definitions(app PUBLIC
73+
"EXTERNAL_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/zephyr/FactoryDataProviderImpl.h\""
74+
)
75+
76+
if(CONFIG_CHIP_OTA_REQUESTOR)
77+
target_sources(app PRIVATE
78+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorCommon.cpp
79+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/source/OTARequestorInitiatorZephyr.cpp
80+
)
81+
target_include_directories(app PRIVATE
82+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/ota_requestor/include/
83+
)
84+
endif()
85+
86+
chip_configure_data_model(app
87+
INCLUDE_SERVER
88+
ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/../../cooksurface-app/nxp/zap/cooksurface-app-wifi-noicd.zap
89+
)
90+
91+
if(CONFIG_CHIP_LIB_SHELL)
92+
target_compile_definitions(app PRIVATE ENABLE_CHIP_SHELL)
93+
target_include_directories(app PRIVATE
94+
${CHIP_ROOT}/examples/shell/shell_common/include
95+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/include
96+
)
97+
target_sources(app PRIVATE
98+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIBase.cpp
99+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/matter_cli/source/AppCLIZephyr.cpp
100+
${CHIP_ROOT}/examples/shell/shell_common/cmd_misc.cpp
101+
${CHIP_ROOT}/examples/shell/shell_common/cmd_otcli.cpp
102+
${CHIP_ROOT}/examples/shell/shell_common/cmd_server.cpp
103+
)
104+
endif()
105+
106+
target_sources(app
107+
PRIVATE
108+
${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp
109+
${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp
110+
${EXAMPLE_PLATFORM_NXP_COMMON_DIR}/icd/source/ICDUtil.cpp
111+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
mainmenu "Matter NXP Cooksurface Example Application"
17+
18+
rsource "../../../../config/nxp/chip-module/Kconfig.features"
19+
rsource "../../../../config/nxp/chip-module/Kconfig.defaults"
20+
source "Kconfig.zephyr"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CHIP NXP Zephyr Cooksurface Application
2+
3+
All instructions describing how to use a Matter application on NXP Zephyr can be found in [README.md](../../../all-clusters-app/nxp/zephyr/README.md) root readme
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
CONFIG_SETTINGS_NVS_SECTOR_COUNT=16
18+
19+
# 0xA226
20+
CONFIG_CHIP_DEVICE_PRODUCT_ID=41510
21+
CONFIG_CHIP_DEVICE_PRODUCT_URL="https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radio-1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612"
22+
CONFIG_CHIP_DEVICE_PRODUCT_LABEL="RW612"
23+
CONFIG_CHIP_DEVICE_PART_NUMBER="RW612"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http: //www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/ {
19+
chosen {
20+
zephyr,console = &flexcomm0;
21+
zephyr,shell-uart = &flexcomm3;
22+
};
23+
};
24+
25+
&flexcomm0 {
26+
compatible = "nxp,lpc-usart";
27+
status = "okay";
28+
current-speed = <115200>;
29+
pinctrl-0 = <&pinmux_flexcomm0_usart>;
30+
pinctrl-names = "default";
31+
};
32+
33+
&flexcomm3 {
34+
compatible = "nxp,lpc-usart";
35+
status = "okay";
36+
current-speed = <115200>;
37+
pinctrl-0 = <&pinmux_flexcomm3_usart>;
38+
pinctrl-names = "default";
39+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Board information
2+
3+
## Matter CLI
4+
5+
The Matter CLI is configured to be output on `flexcomm3` with a baudrate of `115200`.
6+
7+
`flexcomm3` is wired to the USB FTDI port of the RD BGA board by default.
8+
9+
## Logs
10+
11+
The logs are configured to be output on `flexcomm0` with a baudrate of `115200`.
12+
13+
`flexcomm0` is wired to `GPIO2` (RX) and `GPIO3` (TX).
14+
Those pins are accessible on `HD2` pin header.
15+
16+
## Factory data partition
17+
18+
The factory data partition is reserved in the last sector of the flexspi flash of RD BGA board, at `0x0BFFF000`
19+
20+
## File system partition
21+
22+
The file system partition used to store various settings for Matter and the application is reserved starting from
23+
`0x8A60000` and ending at `0xBFFEFFF` (right before the factory data partition).
24+
25+
>**Note**: This is subject to change when OTA will be supported on NXP Zephyr applications
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/**
19+
* @file
20+
* Example project configuration file for CHIP.
21+
*
22+
* This is a place to put application or project-specific overrides
23+
* to the default configuration values for general CHIP features.
24+
*
25+
*/
26+
27+
#pragma once
28+
29+
// Use a default pairing code if one hasn't been provisioned in flash.
30+
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE
31+
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR CONFIG_CHIP_DEVICE_DISCRIMINATOR
32+
33+
// All clusters app has 3 group endpoints. This needs to defined here so that
34+
// CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured.
35+
#define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2024 Project CHIP Authors
3+
* All rights reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "AppTask.h"
19+
20+
#include <zephyr/logging/log.h>
21+
22+
LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL);
23+
24+
using namespace ::chip;
25+
26+
int main()
27+
{
28+
CHIP_ERROR err = CHIP_NO_ERROR;
29+
30+
if (err == CHIP_NO_ERROR)
31+
{
32+
err = chip::NXP::App::GetAppTask().Start();
33+
}
34+
35+
LOG_ERR("Exited with code %" CHIP_ERROR_FORMAT, err.Format());
36+
return err == CHIP_NO_ERROR ? EXIT_SUCCESS : EXIT_FAILURE;
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
# This sample uses Kconfig.defaults to set options common for all
18+
# samples. This file should contain only options specific for this sample
19+
# or overrides of default values.
20+
21+
# Enable CHIP
22+
CONFIG_CHIP=y
23+
CONFIG_STD_CPP17=y
24+
CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h"
25+
CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
26+
27+
# Enable MbedTLS PSA - heavily experimental, not thread safe yet
28+
# CONFIG_CHIP_CRYPTO_PSA=y
29+
30+
# Bluetooth overrides
31+
CONFIG_BT_DEVICE_NAME="NXPAllClusters"
32+
33+
# enable Matter CLI
34+
CONFIG_CHIP_LIB_SHELL=y
35+
CONFIG_CHIP_STATISTICS=y
36+
37+
# Factory data configuration
38+
CONFIG_CHIP_DEVICE_VENDOR_ID=4151
39+
CONFIG_CHIP_DEVICE_DISCRIMINATOR=0xA00
40+
CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE=14014
41+
CONFIG_CHIP_DEVICE_PRODUCT_NAME="Cooksurface"
42+
CONFIG_CHIP_DEVICE_TYPE=115
43+
CONFIG_CHIP_DEVICE_MANUFACTURING_DATE="2023-01-01"
44+
CONFIG_CHIP_DEVICE_SERIAL_NUMBER="12345678"
45+
CONFIG_CHIP_DEVICE_PRODUCT_COLOR="Green"
46+
CONFIG_CHIP_DEVICE_PRODUCT_FINISH="Matte"
47+
48+
# Use factory data provider for device info
49+
CONFIG_CHIP_FACTORY_DATA=y
50+
# Generate factor data raw binary during the build process
51+
# CONFIG_CHIP_FACTORY_DATA_BUILD=y
52+
# Generate test certificates for factory data during the build process
53+
# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_GENERATED=y
54+
# Spake2p verifier will be generated during factory data generation
55+
# CONFIG_CHIP_FACTORY_DATA_GENERATE_SPAKE2_VERIFIER=y
56+
57+
# Example of using pre-generated certificates
58+
# CONFIG_CHIP_FACTORY_DATA_CERT_SOURCE_USER=y
59+
# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_CD_CERT="<path to certificates>/Chip-Test-CD-1037-A226.der"
60+
# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_CERT="<path to certificates>/Chip-DAC-NXP-1037-A226-Cert.der"
61+
# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_DAC_KEY="<path to certificates>/Chip-DAC-NXP-1037-A226-Key.der"
62+
# CONFIG_CHIP_FACTORY_DATA_USER_CERTS_PAI_CERT="<path to certificates>/Chip-PAI-NXP-1037-A226-Cert.der"
63+
64+
# Additional configs for debbugging experience.
65+
CONFIG_THREAD_NAME=y
66+
CONFIG_MPU_STACK_GUARD=y
67+
68+
CONFIG_DEBUG=y
69+
CONFIG_DEBUG_INFO=y
70+
CONFIG_DEBUG_THREAD_INFO=y
71+
# use this config if stepping during debug session is not consistent
72+
# CONFIG_NO_OPTIMIZATIONS=y
73+
CONFIG_EXCEPTION_STACK_TRACE=y
74+
CONFIG_ASSERT=y
75+
# by default west will generate the full assembly output, which can take several minutes when binaries are large
76+
CONFIG_OUTPUT_DISASSEMBLY=n
77+
# embedded thread analyzer with thread statistics (stack usage, cpu usage...)
78+
# CONFIG_THREAD_ANALYZER=y
79+
# CONFIG_THREAD_ANALYZER_USE_PRINTK=y
80+
# CONFIG_THREAD_ANALYZER_AUTO=y

0 commit comments

Comments
 (0)