Skip to content

Commit 63a7685

Browse files
committed
Merge branch 'master' into imdm/2-ember-iterate
2 parents 22e9df0 + b5d13a7 commit 63a7685

File tree

109 files changed

+6393
-3133
lines changed

Some content is hidden

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

109 files changed

+6393
-3133
lines changed

.github/workflows/examples-stm32.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
uses: ./.github/actions/checkout-submodules-and-bootstrap
5151
with:
5252
platform: stm32
53-
53+
extra-submodule-parameters: --recursive
5454
- name: Set up environment for size reports
5555
uses: ./.github/actions/setup-size-reports
5656
if: ${{ !env.ACT }}

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
[submodule "third_party/st/STM32CubeWB"]
314314
path = third_party/st/STM32CubeWB
315315
url = https://github.com/STMicroelectronics/STM32CubeWB.git
316-
branch = v1.17.0
316+
branch = v1.18.0
317317
platforms = stm32
318318
[submodule "p6/lwip-network-interface-integration"]
319319
path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration

.gn

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ script_executable = "python3"
2525

2626
default_args = {
2727
pw_unit_test_AUTOMATIC_RUNNER = "$dir_pigweed/targets/host/run_test"
28+
pw_unit_test_CONFIG = "//config/pw_unit_test:define_overrides"
2829

2930
pw_build_PIP_CONSTRAINTS = [ "//scripts/setup/constraints.txt" ]
3031
pw_build_PIP_REQUIREMENTS = [ "//scripts/setup/requirements.build.txt" ]

config/pw_unit_test/BUILD.gn

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2024 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/pigweed.gni")
18+
19+
import("${chip_root}/build/chip/tests.gni")
20+
21+
import("$dir_pw_build/target_types.gni")
22+
pw_source_set("define_overrides") {
23+
public_configs = [ ":define_options" ]
24+
}
25+
26+
config("define_options") {
27+
if (chip_fake_platform && chip_link_tests) {
28+
defines = [ "PW_UNIT_TEST_CONFIG_MEMORY_POOL_SIZE=65536" ]
29+
} else {
30+
defines = [ "PW_UNIT_TEST_CONFIG_MEMORY_POOL_SIZE=16384" ]
31+
}
32+
}

docs/getting_started/first_example.md

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# An SDK example
2+
3+
The SDK provides a number of example devices and controllers that can be used to
4+
familiarize yourself with the SDK and the Matter ecosystem.
5+
6+
## Example Devices
7+
8+
The example devices (occasionally referred to as "apps") are located in the
9+
[examples](../../examples/) directory. The examples often implement one
10+
particular device type. Some have implementations for various platforms.
11+
12+
The linux platform examples are provided as examples, and are used in the CI.
13+
These can be used for preliminary testing.
14+
15+
The all-clusters-app is used by the QA team for testing. This app implements
16+
nearly all the available clusters and does not conform to a specific device
17+
type. This app is not a good starting place for product development.
18+
19+
## Example Controllers
20+
21+
The SDK has two example controllers that can be used to interact with devices
22+
for testing.
23+
24+
[chip-tool](../../examples/chip-tool/) is a C++ command line controller with an
25+
interactive shell. More information on chip-tool can be found in the
26+
[chip-tool guide](../guides/chip_tool_guide.md).
27+
28+
[chip-repl](../../src/controller/python/chip-repl.py) is a shell for the python
29+
controller. The chip-repl is part of the python controller framework, often used
30+
for testing. More information about the python controller can be found in the
31+
[python testing](../testing/python.md) documentation.
32+
33+
## Building your first demo app (lighting)
34+
35+
The examples directory contains a set of apps using an example device
36+
composition \.zap file. For more information about device composition and zap,
37+
see [ZAP documentation](./zap.md).
38+
39+
This quick start guide will walk you through
40+
41+
- Building an app (lighting app) for the host platform
42+
- Interacting with the app using chip\-tool \(controller\)
43+
44+
### Building the lighting app
45+
46+
- Install prerequisites from docs/guides/BUILDING\.md
47+
- Run bootstrap or activate to install all the required tools etc.
48+
- `. scripts/bootstrap.sh` \- run this first\, or if builds fail
49+
- `. scripts/activate.sh` \- faster\, use if you’ve already bootstrapped
50+
and are just starting a new terminal
51+
52+
The build system we use is Ninja / GN. You can use a standard gn gen / ninja to
53+
build as normal, or use the scripts to build specific variants. More information
54+
about the build system can be found at [BUILDING.md](../guides/BUILDING.md). The
55+
official quickstart guide for the build system is located ag
56+
https://gn.googlesource.com/gn/+/master/docs/quick_start.md and a full reference
57+
can be found at https://gn.googlesource.com/gn/+/main/docs/reference.md.
58+
59+
To build with the scripts, use scripts/build/build_examples\.py -
60+
`scripts/build/build_examples.py targets` -
61+
`scripts/build/build_examples.py --target <your target> build` - builds to
62+
`out/<target_name>/`
63+
64+
Scripts can be used to build both the lighting app and chip tool
65+
66+
- Lighting app \(device\)
67+
- `./scripts/build/build_examples.py --target linux-x64-light-no-ble build`
68+
- This will build an executable to
69+
`./out/linux-x64-light-no-ble/chip-lighting-app`
70+
71+
* NOTE that the host name (linux-x64 here) may be different on different
72+
systems ex. darwin
73+
74+
- chip-tool (controller)
75+
- `./scripts/build/build_examples.py --target linux-x64-chip-tool build`
76+
- This will build an executable to `./out/linux-x64-chip-tool/chip-tool`
77+
78+
### Building / Interacting with Matter Examples
79+
80+
The first thing you need to do is to commission the device. First start up the
81+
app in one terminal. By default it will start up with the default discriminator
82+
(3840) and passcode (20202021) and save its non-volatile information in a KVS in
83+
/temp/chip_kvs. You can change these, and multiple other options on the command
84+
line. For a full description, use the `--help` command.
85+
86+
Start the lighting app in one terminal using
87+
88+
`./out/linux-x64-light-no-ble/chip-lighting-app`
89+
90+
The lighting app will print out all its setup information. You can get the setup
91+
codes, discriminator and passcode from the logs.
92+
93+
Open a new terminal to use chip tool. Commission the device using:
94+
95+
`./out/linux-x64-chip-tool/chip-tool pairing code 0x12344321 MT:-24J0AFN00KA0648G0`
96+
97+
NOTE: pairing is the old name for commissioning. 0x12344321 is the node ID you
98+
want to assign to the node. 0x12344321 is the default for testing.
99+
MT:-24J0AFN00KA0648G0 is the QR code for a device with the default discriminator
100+
and passcode. If you have changed these, the code will be different.
101+
102+
#### Basic device interactions - Sending a command
103+
104+
`./chip-tool onoff on 0x12344321 1`
105+
106+
where:
107+
108+
- onoff is the cluster name
109+
- on is the command name
110+
- 0x12344321 is the node ID you used for commissioning
111+
- 1 is the endpoint
112+
113+
#### Basic device interactions - Reading an attribute
114+
115+
`./chip-tool onoff read on-off 0x12344321 1`
116+
117+
where:
118+
119+
- onoff is the cluster name
120+
- read is the desired action
121+
- on is the attribute name
122+
- 0x12344321 is the node ID you used for commissioning
123+
- 1 is the endpoint

docs/getting_started/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The following docs are a brief introduction to SDK development.
1111
1212
```
1313

14+
- [Running your first example](./first_example.md)
1415
- [SDK Basics](./SDKBasics.md)
1516
- [ZAP](./zap.md)
1617
- [Discover from a host computer](./discovery_from_a_host_computer.md)

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+2-2
Original file line numberDiff line numberDiff line change
@@ -3752,7 +3752,7 @@ cluster ActivatedCarbonFilterMonitoring = 114 {
37523752
}
37533753

37543754
/** This cluster is used to configure a boolean sensor. */
3755-
provisional cluster BooleanStateConfiguration = 128 {
3755+
cluster BooleanStateConfiguration = 128 {
37563756
revision 1;
37573757

37583758
bitmap AlarmModeBitmap : bitmap8 {
@@ -3810,7 +3810,7 @@ provisional cluster BooleanStateConfiguration = 128 {
38103810
}
38113811

38123812
/** This cluster is used to configure a valve. */
3813-
provisional cluster ValveConfigurationAndControl = 129 {
3813+
cluster ValveConfigurationAndControl = 129 {
38143814
revision 1;
38153815

38163816
enum StatusCodeEnum : enum8 {

examples/kotlin-matter-controller/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ the top Matter directory:
109109
```
110110

111111
The Java executable file `kotlin-matter-controller` will be generated at
112-
`out/android-x86-kotlin-matter-controller/bin/`
112+
`out/linux-x64-kotlin-matter-controller/bin/`
113113

114114
Run the kotlin-matter-controller
115115

examples/lighting-app/stm32/BUILD.gn

+19-17
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,22 @@ if (stm32_board == "STM32WB5MM-DK") {
5454
}
5555

5656
stm32_sdk("sdk") {
57-
if (stm32_board == "STM32WB5MM-DK") {
58-
sources = [
59-
"${examples_plat_dir}/config_files/STM32WB5/FreeRTOSConfig.h",
60-
"${examples_plat_dir}/config_files/STM32WB5/matter_config.h",
61-
"${stm32_project_dir}/include/STM32WB5/CHIPProjectConfig.h",
62-
]
63-
}
64-
6557
include_dirs = [
6658
"${chip_root}/src/platform/stm32",
6759
"${examples_plat_dir}",
60+
"${stm32_project_dir}/include/STM32WB5",
6861
"${chip_root}/src/lib",
6962
]
7063

7164
if (stm32_board == "STM32WB5MM-DK") {
65+
sources = [
66+
"${examples_plat_dir}/config_files/STM32WB5/FreeRTOSConfig.h",
67+
"${examples_plat_dir}/config_files/STM32WB5/matter_config.h",
68+
"${stm32_project_dir}/include/STM32WB5/CHIPProjectConfig.h",
69+
]
70+
7271
include_dirs += [
7372
"${stm32_project_dir}/include/STM32WB5",
74-
"${examples_plat_dir}/config_files/STM32WB5",
7573
"${chip_root}/src/include",
7674
]
7775
}
@@ -100,25 +98,29 @@ stm32_executable("lighting_app") {
10098
"${stm32_board_src}/STM32_WPAN/App/app_matter.c",
10199
"${stm32_board_src}/STM32_WPAN/App/app_thread.c",
102100
"${stm32_board_src}/STM32_WPAN/App/custom_stm.c",
101+
102+
#"${stm32_board_src}/STM32_WPAN/Target/hw_ipcc.c",
103103
"${stm32_board_src}/Src/app_entry.cpp",
104104
"${stm32_board_src}/Src/main.cpp",
105+
"${stm32_board_src}/Src/ota.cpp",
105106
"src/STM32WB5/AppTask.cpp",
107+
"src/STM32WB5/IdentifierEffect.cpp",
106108
"src/STM32WB5/LightingManager.cpp",
107109
"src/STM32WB5/ZclCallbacks.cpp",
108110
]
111+
112+
deps = [
113+
":sdk",
114+
"${chip_root}/examples/lighting-app/lighting-common",
115+
"${chip_root}/examples/providers:device_info_provider",
116+
"${chip_root}/src/lib",
117+
"${chip_root}/src/setup_payload",
118+
]
109119
}
110120

111121
# Add the startup file to the target
112122
sources += [ "${examples_plat_dir}/startup_files/startup_${stm32_mcu}.s" ]
113123

114-
deps = [
115-
":sdk",
116-
"${chip_root}/examples/lighting-app/lighting-common",
117-
"${chip_root}/examples/providers:device_info_provider",
118-
"${chip_root}/src/lib",
119-
"${chip_root}/src/setup_payload",
120-
]
121-
122124
defines += [
123125
"DEBUG",
124126
"USE_HAL_DRIVER",

examples/lighting-app/stm32/include/STM32WB5/AppTask.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "LightingManager.h"
2727
#include "app_entry.h"
2828

29+
#include <DeviceInfoProviderImpl.h>
2930
#include <platform/CHIPDeviceLayer.h>
3031
#include <platform/stm32/FactoryDataProvider.h>
3132
#define APP_NAME "Lighting-app"
@@ -55,9 +56,10 @@ class AppTask
5556
static void FunctionHandler(AppEvent * aEvent);
5657
static void LightingActionEventHandler(AppEvent * aEvent);
5758
static void TimerEventHandler(TimerHandle_t xTimer);
58-
static void DelayNvmHandler(TimerHandle_t xTimer);
5959
static void MatterEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
60+
#if (OTA_SUPPORT == 0)
6061
static void UpdateLCD(void);
62+
#endif
6163
static void UpdateNvmEventHandler(AppEvent * aEvent);
6264

6365
enum Function_t

examples/lighting-app/stm32/include/STM32WB5/CHIPProjectConfig.h

+40-2
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,26 @@
2323
*/
2424
#ifndef CHIPPROJECTCONFIG_H
2525
#define CHIPPROJECTCONFIG_H
26+
#include "app_conf.h"
2627

2728
// Use a default pairing code if one hasn't been provisioned in flash.
28-
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
2929
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
30-
#endif
3130

3231
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR
3332
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
3433
#endif
3534

35+
// Use a default pairing code if one hasn't been provisioned in flash.
36+
#define CHIP_DEVICE_CONFIG_USE_TEST_PAIRING_CODE "CHIPUS"
37+
38+
// For convenience, Chip Security Test Mode can be enabled and the
39+
// requirement for authentication in various protocols can be disabled.
40+
//
41+
// WARNING: These options make it possible to circumvent basic Chip security functionality,
42+
// including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS.
43+
//
44+
#define CHIP_CONFIG_SECURITY_TEST_MODE 0
45+
3646
/**
3747
* CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
3848
*
@@ -73,6 +83,25 @@
7383
*/
7484
#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0
7585

86+
/**
87+
* CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY
88+
*
89+
* Enables the use of a hard-coded default Chip device id and credentials if no device id
90+
* is found in Chip NV storage.
91+
*
92+
* This option is for testing only and should be disabled in production releases.
93+
*/
94+
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 34
95+
96+
// For convenience, enable Chip Security Test Mode and disable the requirement for
97+
// authentication in various protocols.
98+
//
99+
// WARNING: These options make it possible to circumvent basic Chip security functionality,
100+
// including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS.
101+
//
102+
#define CHIP_CONFIG_SECURITY_TEST_MODE 0
103+
#define CHIP_CONFIG_REQUIRE_AUTH 1
104+
76105
/**
77106
* CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
78107
*
@@ -84,6 +113,15 @@
84113
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1"
85114
#endif
86115

116+
/**
117+
* CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
118+
*
119+
* A monothonic number identifying the software version running on the device.
120+
*/
121+
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
122+
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1
123+
#endif
124+
87125
/**
88126
* CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
89127
*

0 commit comments

Comments
 (0)