Skip to content

Commit 2725771

Browse files
authored
Merge branch 'master' into jtung/darwin-mtrdevice-attribute-storage-write-optimization
2 parents 8c0085a + eb515e1 commit 2725771

File tree

176 files changed

+7508
-3398
lines changed

Some content is hidden

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

176 files changed

+7508
-3398
lines changed

.github/workflows/examples-linux-tv-casting-app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
run: |
6868
./scripts/run_in_build_env.sh \
6969
"python3 ./scripts/tests/run_tv_casting_test.py"
70-
timeout-minutes: 1
70+
timeout-minutes: 2 # Comment this out to debug if GitHub Action times out.
7171

7272
- name: Uploading Size Reports
7373
uses: ./.github/actions/upload-size-reports

.github/workflows/examples-qpg.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ jobs:
6363
--enable-flashbundle \
6464
--target qpg-qpg6105-lock \
6565
--target qpg-qpg6105-light \
66-
--target qpg-qpg6105-shell \
67-
--target qpg-qpg6105-persistent-storage \
6866
--target qpg-qpg6105-light-switch \
6967
--target qpg-qpg6105-thermostat \
7068
build \

.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+
}

config/qpg/chip-gn/build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ env
2323
GN_ROOT_TARGET=$(dirname "$0")
2424
CHIP_ROOT=$GN_ROOT_TARGET/../../../
2525
OUTDIR=$CHIP_ROOT/out
26+
GN_ARGS="qpg_target_ic=\"qpg6105\" qpg_flavour=\"_ext_flash\""
2627

2728
mkdir -p "$OUTDIR"
2829
gn \
@@ -33,6 +34,7 @@ gn \
3334
--export-compile-commands \
3435
gen \
3536
--check \
37+
--args="$GN_ARGS" \
3638
--fail-on-unused-args \
3739
"$OUTDIR"
3840
ninja -C "$OUTDIR"

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/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/CHIPDeviceDetailsFragment.kt

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class CHIPDeviceDetailsFragment : Fragment() {
6161
binding.discriminatorEd.setText(deviceInfo.discriminator.toString())
6262
binding.serialNumberEd.setText(deviceInfo.serialNumber)
6363
binding.discoveryCapabilitiesTv.text = "${deviceInfo.discoveryCapabilities}"
64-
6564
if (deviceInfo.optionalQrCodeInfoMap.isEmpty()) {
6665
binding.vendorTagsLabelTv.visibility = View.GONE
6766
binding.vendorTagsContainer.visibility = View.GONE

examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/CHIPDeviceInfo.kt

+10-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import kotlinx.parcelize.Parcelize
2424
import matter.onboardingpayload.DiscoveryCapability
2525
import matter.onboardingpayload.OnboardingPayload
2626
import matter.onboardingpayload.OnboardingPayloadException
27+
import matter.onboardingpayload.OptionalQRCodeInfoType
2728

2829
/** Class to hold the CHIP device information. */
2930
@Parcelize
@@ -57,6 +58,13 @@ data class CHIPDeviceInfo(
5758
if (serialNumber.isNotEmpty()) {
5859
onboardingPayload.addSerialNumber(serialNumber)
5960
}
61+
optionalQrCodeInfoMap.forEach { (_, info) ->
62+
if (info.type == OptionalQRCodeInfoType.TYPE_STRING && info.data != null) {
63+
onboardingPayload.addOptionalVendorData(info.tag, info.data)
64+
} else {
65+
onboardingPayload.addOptionalVendorData(info.tag, info.intDataValue)
66+
}
67+
}
6068
return onboardingPayload
6169
}
6270

@@ -78,8 +86,8 @@ data class CHIPDeviceInfo(
7886
setupPayload.getLongDiscriminatorValue(),
7987
setupPayload.setupPinCode,
8088
setupPayload.commissioningFlow,
81-
setupPayload.optionalQRCodeInfo.mapValues { (_, info) ->
82-
QrCodeInfo(info.tag, info.type, info.data, info.int32)
89+
setupPayload.getAllOptionalVendorData().associate { info ->
90+
info.tag to QrCodeInfo(info.tag, info.type, info.data, info.int32)
8391
},
8492
setupPayload.discoveryCapabilities,
8593
setupPayload.hasShortDiscriminator,

examples/android/CHIPTool/app/src/main/res/layout/chip_device_info_fragment.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@
151151
android:layout_width="wrap_content"
152152
android:layout_height="wrap_content"
153153
android:layout_marginBottom="8dp"
154-
android:layout_below="@id/vendorTagsLabelTv"
154+
android:layout_below="@id/vendorTagsContainer"
155155
android:layout_alignParentStart="true"
156156
android:textSize="20sp"/>
157157
<EditText
158158
android:id="@+id/discoveryCapabilitiesEd"
159159
android:layout_width="wrap_content"
160160
android:layout_height="wrap_content"
161161
android:layout_marginStart="16dp"
162-
android:layout_below="@id/vendorTagsLabelTv"
162+
android:layout_below="@id/vendorTagsContainer"
163163
android:layout_toEndOf="@id/discoveryCapabilitiesLabelTv"
164164
android:layout_alignParentEnd="true"
165165
android:textSize="11sp"
@@ -260,6 +260,6 @@
260260
android:layout_below="@id/showQRCodeUriBtn"
261261
android:layout_alignParentBottom="true"
262262
android:layout_alignParentStart="true"
263-
android:textSize="20sp"/>
263+
android:textSize="12sp"/>
264264
</RelativeLayout>
265265
</ScrollView>

examples/chef/chef.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -696,11 +696,20 @@ def main() -> int:
696696
if options.build_target == "esp32":
697697
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}/esp32")
698698
if options.enable_ipv4:
699-
shell.run_cmd(
700-
"sed -i 's/CONFIG_DISABLE_IPV4=y/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/g' sdkconfig ")
699+
if sys.platform == "darwin":
700+
shell.run_cmd(
701+
"sed -i '' 's/CONFIG_DISABLE_IPV4=y/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/g' sdkconfig ")
702+
else:
703+
shell.run_cmd(
704+
"sed -i 's/CONFIG_DISABLE_IPV4=y/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/g' sdkconfig ")
701705
else:
702-
shell.run_cmd(
703-
"sed -i 's/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/CONFIG_DISABLE_IPV4=y/g' sdkconfig ")
706+
if sys.platform == "darwin":
707+
shell.run_cmd(
708+
"sed -i '' 's/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/CONFIG_DISABLE_IPV4=y/g' sdkconfig ")
709+
else:
710+
shell.run_cmd(
711+
"sed -i 's/#\\ CONFIG_DISABLE_IPV4\\ is\\ not\\ set/CONFIG_DISABLE_IPV4=y/g' sdkconfig ")
712+
704713
shell.run_cmd("idf.py build")
705714
shell.run_cmd("idf.py build flashing_script")
706715
shell.run_cmd(

examples/chef/esp32/sdkconfig.defaults

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ CONFIG_MBEDTLS_HKDF_C=y
6262

6363
# IRAM optimizations
6464
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
65+
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
6566

6667
# Increase LwIP IPv6 address number
6768
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6

examples/chef/esp32/sdkconfig_rpc.defaults

+1
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ CONFIG_MBEDTLS_HKDF_C=y
6161

6262
# IRAM optimizations
6363
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
64+
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
6465

6566
CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP=y

examples/common/pigweed/rpc_services/BooleanState.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
namespace chip {
2929
namespace rpc {
3030

31-
class BooleanState final : public pw_rpc::nanopb::BooleanState::Service<BooleanState>
31+
class BooleanState : public pw_rpc::nanopb::BooleanState::Service<BooleanState>
3232
{
3333
public:
3434
virtual ~BooleanState() = default;

examples/common/pigweed/rpc_services/Locking.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
namespace chip {
2828
namespace rpc {
2929

30-
class Locking final : public pw_rpc::nanopb::Locking::Service<Locking>
30+
class Locking : public pw_rpc::nanopb::Locking::Service<Locking>
3131
{
3232
public:
3333
virtual ~Locking() = default;

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/light-switch-app/qpg/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ qpg_executable("light_switch_app") {
137137
}
138138
}
139139

140-
ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}/QorvoStack_${qpg_target_ic}.ld"
140+
ldscript = "${qpg_sdk_root}/Libraries/Qorvo/QorvoStack/gen/QorvoStack_${qpg_target_ic}${qpg_flavour}/QorvoStack_${qpg_target_ic}${qpg_flavour}.ld"
141141

142142
inputs = [ ldscript ]
143143

examples/light-switch-app/qpg/args.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ chip_enable_icd_lit = true
3030
chip_stack_lock_tracking = "none"
3131

3232
matter_device_vid = "0xFFF1"
33-
matter_device_pid = "0x8006"
33+
matter_device_pid = "0x8004"
3434

3535
pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip"
3636
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"

0 commit comments

Comments
 (0)