Skip to content

Commit b37e814

Browse files
Merge branch 'master' into metering-identification-cluster-test-scripts
2 parents 1dd299e + c0e580c commit b37e814

File tree

45 files changed

+1605
-703
lines changed

Some content is hidden

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

45 files changed

+1605
-703
lines changed

.github/workflows/chef.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ jobs:
5151
run: |
5252
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t linux"
5353
54+
chef_linux_all_devices:
55+
name: Chef - Linux CI Examples (All chef devices)
56+
timeout-minutes: 60
57+
runs-on: ubuntu-latest
58+
if: github.actor != 'restyled-io[bot]'
59+
60+
container:
61+
image: ghcr.io/project-chip/chip-build:119
62+
options: --user root
63+
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
- name: Checkout submodules & Bootstrap
68+
uses: ./.github/actions/checkout-submodules-and-bootstrap
69+
with:
70+
platform: linux
71+
- name: CI Examples Linux
72+
shell: bash
73+
run: |
74+
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci_linux"
75+
5476
chef_esp32:
5577
name: Chef - ESP32 CI Examples
5678
runs-on: ubuntu-latest

.github/workflows/darwin.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,10 @@ jobs:
116116
117117
export TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1
118118
119-
# Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI.
120119
xcodebuild test -target "Matter" -scheme "Matter Framework Tests" \
121120
-resultBundlePath /tmp/darwin/framework-tests/TestResults.xcresult \
122121
-sdk macosx ${{ matrix.options.arguments }} \
123-
CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} ${{ matrix.options.defines }}' \
122+
GCC_PREPROCESSOR_DEFINITIONS='${inherited} ${{ matrix.options.defines }}' \
124123
> >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2)
125124
- name: Generate Summary
126125
if: always()

config/esp32/components/chip/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,10 @@ if (CONFIG_SEC_CERT_DAC_PROVIDER)
444444
list(APPEND matter_requires espressif__esp_secure_cert_mgr)
445445
endif()
446446

447+
if (CONFIG_ENABLE_ENCRYPTED_OTA)
448+
list(APPEND matter_requires espressif__esp_encrypted_img)
449+
endif()
450+
447451
add_prebuilt_library(matterlib "${CMAKE_CURRENT_BINARY_DIR}/lib/libCHIP.a"
448452
REQUIRES ${matter_requires})
449453

config/esp32/components/chip/idf_component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
- if: "idf_version >=4.3"
1212

1313
espressif/esp_encrypted_img:
14-
version: "2.1.0"
14+
version: "2.3.0"
1515
require: public
1616
rules:
1717
- if: "idf_version >=4.4"

docs/platforms/esp32/ota.md

+30-15
Original file line numberDiff line numberDiff line change
@@ -92,35 +92,50 @@ image can be encrypted/decrypted using an RSA-3072 key pair.
9292
9393
Please follow the steps below to generate an application image for OTA upgrades:
9494
95-
1. Generate a new RSA-3072 key pair or use an existing one.
95+
1. Generate a new RSA-3072 key pair or use an existing one.
9696
97-
- To generate a key pair, use the following command:
97+
- To generate a key pair, use the following command:
9898
9999
```
100100
openssl genrsa -out esp_image_encryption_key.pem 3072
101101
```
102102
103-
- Extract the public key from the key pair:
103+
- Extract the public key from the key pair:
104104
```
105105
openssl rsa -in esp_image_encryption_key.pem -pubout -out esp_image_encryption_public_key.pem
106106
```
107107
108-
2. Encrypt the application binary using the
109-
[esp_enc_img_gen.py](https://github.com/espressif/idf-extra-components/blob/master/esp_encrypted_img/tools/esp_enc_img_gen.py)
110-
script.
108+
2. Encrypt the application binary using the
109+
[esp_enc_img_gen.py](https://github.com/espressif/idf-extra-components/blob/master/esp_encrypted_img/tools/esp_enc_img_gen.py)
110+
script.
111111
112-
- Use the following command to encrypt the OTA image with the public key:
112+
Use the following command to encrypt the OTA image with the public key:
113113
114-
```
115-
python3 esp_enc_img_gen.py encrypt lighting-app.bin esp_image_encryption_public_key.pem lighting-app-encrypted.bin
116-
```
114+
```
115+
python3 esp_enc_img_gen.py encrypt lighting-app.bin esp_image_encryption_public_key.pem lighting-app-encrypted.bin
116+
```
117117
118-
- Append the Matter OTA header:
119-
```
120-
src/app/ota_image_tool.py create --vendor-id 0xFFF1 --product-id 0x8000 --version 2 --version-str "v2.0" -da sha256 lighting-app-encrypted.bin lighting-app-encrypted-ota.bin
121-
```
118+
Optionally, you can use the cmake function `create_esp_enc_img()` to encrypt
119+
the OTA image during the build process. Please find the usage below. This is
120+
also demonstrated in the `examples/lighting-app/esp32/main/CMakeLists.txt`
121+
file.
122+
123+
```
124+
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
125+
${project_dir}/esp_image_encryption_public_key.pem
126+
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-encrypted.bin
127+
app)
128+
```
129+
130+
3. Append the Matter OTA header
131+
132+
```
133+
src/app/ota_image_tool.py create --vendor-id 0xFFF1 --product-id 0x8000 \
134+
--version 2 --version-str "v2.0" -da sha256 \
135+
lighting-app-encrypted.bin lighting-app-encrypted-ota.bin
136+
```
122137
123-
3. Use the `lighting-app-encrypted-ota.bin` file with the OTA Provider app.
138+
4. Use the `lighting-app-encrypted-ota.bin` file with the OTA Provider app.
124139
125140
## Delta OTA
126141

examples/all-clusters-app/nrfconnect/prj.conf

+3
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ CONFIG_CHIP_ENABLE_READ_CLIENT=y
5757

5858
# Increase the settings partition
5959
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000
60+
61+
# Increase heap size
62+
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=10240

examples/all-clusters-app/nrfconnect/prj_dfu.conf

+3
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=y
5555

5656
# Enable the Read Client for binding purposes
5757
CONFIG_CHIP_ENABLE_READ_CLIENT=y
58+
59+
# Increase heap size
60+
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=10240

examples/all-clusters-app/nrfconnect/prj_release.conf

+3
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ CONFIG_CHIP_ENABLE_READ_CLIENT=y
6666
# Enable LTO to reduce the flash usage
6767
CONFIG_LTO=y
6868
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
69+
70+
# Increase heap size
71+
CONFIG_CHIP_MALLOC_SYS_HEAP_SIZE=10240

examples/camera-controller/commands/interactive/InteractiveCommands.cpp

-38
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
#include <thread>
3030
#include <vector>
3131

32-
#if defined(PW_RPC_ENABLED)
33-
#include <rpc/RpcClient.h>
34-
#include <rpc/RpcServer.h>
35-
#endif
36-
3732
using namespace chip;
3833

3934
namespace {
@@ -42,10 +37,6 @@ constexpr char kInteractiveModePrompt[] = ">>> ";
4237
constexpr char kInteractiveModeHistoryFileName[] = "chip_tool_history";
4338
constexpr char kInteractiveModeStopCommand[] = "quit()";
4439

45-
#if defined(PW_RPC_ENABLED)
46-
constexpr uint16_t kRetryIntervalS = 3;
47-
#endif
48-
4940
// File pointer for the log file
5041
FILE * sLogFile = nullptr;
5142

@@ -114,28 +105,6 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category,
114105
funlockfile(sLogFile);
115106
}
116107

117-
#if defined(PW_RPC_ENABLED)
118-
void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState)
119-
{
120-
if (admin::StartRpcClient() == CHIP_NO_ERROR)
121-
{
122-
// print to console
123-
fprintf(stderr, "Connected to Fabric-Bridge\n");
124-
}
125-
else
126-
{
127-
// print to console
128-
fprintf(stderr, "Failed to connect to Fabric-Bridge, retry in %d seconds....\n", kRetryIntervalS);
129-
systemLayer->StartTimer(System::Clock::Seconds16(kRetryIntervalS), AttemptRpcClientConnect, nullptr);
130-
}
131-
}
132-
133-
void ExecuteDeferredConnect(intptr_t ignored)
134-
{
135-
AttemptRpcClientConnect(&DeviceLayer::SystemLayer(), nullptr);
136-
}
137-
#endif
138-
139108
} // namespace
140109

141110
char * InteractiveStartCommand::GetCommand(char * command)
@@ -198,13 +167,6 @@ CHIP_ERROR InteractiveStartCommand::RunCommand()
198167
Logging::SetLogRedirectCallback(LoggingCallback);
199168
}
200169

201-
#if defined(PW_RPC_ENABLED)
202-
admin::SetRpcRemoteServerPort(mFabricBridgeServerPort.Value());
203-
admin::InitRpcServer(mLocalServerPort.Value());
204-
ChipLogProgress(NotSpecified, "PW_RPC initialized.");
205-
DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredConnect, 0);
206-
#endif
207-
208170
std::thread readCommands(ReadCommandThread);
209171
readCommands.detach();
210172

examples/chef/chef.py

+23
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap") and file != 'template.zap']
4141
_CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_config.json")
4242
_CD_STAGING_DIR = os.path.join(_CHEF_SCRIPT_PATH, "staging")
43+
_EXCLUDE_DEVICE_FROM_LINUX_CI = [ # These do not compile / deprecated.
44+
"noip_rootnode_dimmablelight_bCwGYSDpoe",
45+
"rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680",
46+
]
4347

4448
gen_dir = "" # Filled in after sample app type is read from args.
4549

@@ -382,6 +386,10 @@ def main() -> int:
382386
help=("Builds Chef examples defined in cicd_config. "
383387
"Uses specified target from -t. Chef exits after completion."),
384388
dest="ci", action="store_true")
389+
parser.add_option("", "--ci_linux",
390+
help=("Builds Chef Examples defined in cicd_config under ci_allow_list_linux. "
391+
"Devices are built without -c for faster compilation."),
392+
dest="ci_linux", action="store_true")
385393
parser.add_option(
386394
"", "--enable_ipv4", help="Enable IPv4 mDNS. Only applicable to platforms that can support IPV4 (e.g, Linux, ESP32)",
387395
action="store_true", default=False)
@@ -409,6 +417,21 @@ def main() -> int:
409417
bundle(options.build_target, device_name)
410418
exit(0)
411419

420+
#
421+
# CI Linux
422+
#
423+
424+
if options.ci_linux:
425+
for device_name in _DEVICE_LIST:
426+
if device_name in _EXCLUDE_DEVICE_FROM_LINUX_CI:
427+
continue
428+
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")
429+
command = f"./chef.py -br -d {device_name} -t linux"
430+
flush_print(f"Building {command}", with_border=True)
431+
shell.run_cmd(command)
432+
bundle("linux", device_name)
433+
exit(0)
434+
412435
#
413436
# CD
414437
#

examples/chef/esp32/main/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ set(SRC_DIRS_LIST
5454
"${CHEF}/common/clusters/target-navigator/"
5555
"${CHEF}/common/clusters/temperature-control/"
5656
"${CHEF}/common/clusters/wake-on-lan/"
57+
"${CHEF}/common/clusters/window-covering/"
5758
"${CHIP_ROOT}/zzz_generated/app-common/app-common/zap-generated/attributes"
5859
)
5960

examples/lighting-app/esp32/main/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ target_compile_options(${COMPONENT_LIB} PUBLIC
8282
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
8383
)
8484

85+
if (CONFIG_ENABLE_ENCRYPTED_OTA)
86+
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
87+
${project_dir}/esp_image_encryption_public_key.pem
88+
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-encrypted.bin
89+
app)
90+
endif()
91+
8592
if (CONFIG_ENABLE_PW_RPC)
8693

8794
get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH)

examples/platform/silabs/sensors/AirQuality/AirQualitySensor.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@
2222
#include <platform/CHIPDeviceLayer.h>
2323

2424
#ifdef USE_SPARKFUN_AIR_QUALITY_SENSOR
25-
#ifdef __cplusplus
26-
extern "C" {
27-
#endif
28-
#include <sparkfun_sgp40.h>
29-
}
3025
#include "sl_i2cspm_instances.h"
26+
#include <sparkfun_sgp40.h>
3127
#endif // USE_SPARKFUN_AIR_QUALITY_SENSOR
3228

3329
namespace {

integrations/docker/images/stage-2/chip-build-efr32/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# codegen.py build requirements
2-
Jinja2==3.1.5
2+
Jinja2==3.1.6
33
lark==1.1.7
44
# Sphinx dependencies (for slc-cli)
55
linkify-it-py==2.0.2

scripts/build/build/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ class Context:
1919
to generate make/ninja instructions and to compile.
2020
"""
2121

22-
def __init__(self, runner, repository_path: str, output_prefix: str, ninja_jobs: int):
22+
def __init__(self, runner, repository_path: str, output_prefix: str, verbose: bool, ninja_jobs: int):
2323
self.builders = []
2424
self.runner = runner
2525
self.repository_path = repository_path
2626
self.output_prefix = output_prefix
27+
self.verbose = verbose
2728
self.ninja_jobs = ninja_jobs
2829
self.completed_steps = set()
2930

@@ -38,7 +39,8 @@ def SetupBuilders(self, targets: Sequence[str], options: BuilderOptions):
3839
found = False
3940
for choice in BUILD_TARGETS:
4041
builder = choice.Create(target, self.runner, self.repository_path,
41-
self.output_prefix, self.ninja_jobs, options)
42+
self.output_prefix, self.verbose, self.ninja_jobs,
43+
options)
4244
if builder:
4345
self.builders.append(builder)
4446
found = True

scripts/build/build/target.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def StringIntoTargetParts(self, value: str):
389389
return _StringIntoParts(value, suffix, self.fixed_targets, self.modifiers)
390390

391391
def Create(self, name: str, runner, repository_path: str, output_prefix: str,
392-
ninja_jobs: int, builder_options: BuilderOptions):
392+
verbose: bool, ninja_jobs: int, builder_options: BuilderOptions):
393393

394394
parts = self.StringIntoTargetParts(name)
395395

@@ -406,6 +406,7 @@ def Create(self, name: str, runner, repository_path: str, output_prefix: str,
406406
builder.target = self
407407
builder.identifier = name
408408
builder.output_dir = os.path.join(output_prefix, name)
409+
builder.verbose = verbose
409410
builder.ninja_jobs = ninja_jobs
410411
builder.chip_dir = os.path.abspath(repository_path)
411412
builder.options = builder_options

scripts/build/build_examples.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ def ValidateTargetNames(context, parameter, values):
7878
default='INFO',
7979
type=click.Choice(__LOG_LEVELS__.keys(), case_sensitive=False),
8080
help='Determines the verbosity of script output.')
81+
@click.option(
82+
'--verbose',
83+
default=False,
84+
is_flag=True,
85+
help='Pass verbose flag to ninja.')
8186
@click.option(
8287
'--target',
8388
default=[],
@@ -142,7 +147,7 @@ def ValidateTargetNames(context, parameter, values):
142147
'Set pigweed command launcher. E.g.: "--pw-command-launcher=ccache" '
143148
'for using ccache when building examples.'))
144149
@click.pass_context
145-
def main(context, log_level, target, enable_link_map_file, repo,
150+
def main(context, log_level, verbose, target, enable_link_map_file, repo,
146151
out_prefix, ninja_jobs, pregen_dir, clean, dry_run, dry_run_output,
147152
enable_flashbundle, no_log_timestamps, pw_command_launcher):
148153
# Ensures somewhat pretty logging of what is going on
@@ -168,7 +173,9 @@ def main(context, log_level, target, enable_link_map_file, repo,
168173
logging.info('Building targets: %s', CommaSeparate(requested_targets))
169174

170175
context.obj = build.Context(
171-
repository_path=repo, output_prefix=out_prefix, ninja_jobs=ninja_jobs, runner=runner)
176+
repository_path=repo, output_prefix=out_prefix, verbose=verbose,
177+
ninja_jobs=ninja_jobs, runner=runner
178+
)
172179
context.obj.SetupBuilders(targets=requested_targets, options=BuilderOptions(
173180
enable_link_map_file=enable_link_map_file,
174181
enable_flashbundle=enable_flashbundle,

scripts/build/builders/gn.py

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def _build(self):
9595
self.PreBuildCommand()
9696

9797
cmd = ['ninja', '-C', self.output_dir]
98+
if self.verbose:
99+
cmd.append('-v')
98100
if self.ninja_jobs is not None:
99101
cmd.append('-j' + str(self.ninja_jobs))
100102
if self.build_command:

scripts/build/builders/nrf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _build(self):
220220
# Note: running zephyr/zephyr.elf has the same result except it creates
221221
# a flash.bin in the current directory. ctest has more options and does not
222222
# pollute the source directory
223-
self._Execute(['ctest', '--build-nocmake', '-V', '--output-on-failure', '--test-dir', os.path.join(self.output_dir, 'nrfconnect')],
223+
self._Execute(['ctest', '--build-nocmake', '-V', '--output-on-failure', '--test-dir', os.path.join(self.output_dir, 'nrfconnect'), '--no-tests=error'],
224224
title='Run Tests ' + self.identifier)
225225

226226
def _bundle(self):

0 commit comments

Comments
 (0)