Skip to content

Commit 1b29c71

Browse files
committed
cleanup and code review comments
1 parent 5a12e7d commit 1b29c71

18 files changed

+1110
-110
lines changed

examples/platform/silabs/OTAConfig.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ void OTAConfig::Init()
9494
// Periodic query timeout must be set prior to requestor being initialized
9595
gRequestorUser.SetPeriodicQueryTimeout(OTA_PERIODIC_TIMEOUT);
9696

97+
#if CHIP_DEVICE_CONFIG_ENABLE_MULTI_OTA_REQUESTOR
98+
auto & imageProcessor = chip::OTAMultiImageProcessorImpl::GetDefaultInstance();
99+
#else
97100
auto & imageProcessor = chip::OTAImageProcessorImpl::GetDefaultInstance();
101+
#endif
102+
98103
gRequestorUser.Init(&gRequestorCore, &imageProcessor);
99104

100105
CHIP_ERROR err = imageProcessor.Init(&gDownloader);

examples/platform/silabs/OTAConfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
2424
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
2525

26-
#ifdef CHIP_DEVICE_CONFIG_ENABLE_MULTI_OTA_REQUESTOR
27-
#include <platform/silabs/multi-ota/MultiOTAImageProcessorImpl.h>
26+
#if CHIP_DEVICE_CONFIG_ENABLE_MULTI_OTA_REQUESTOR
27+
#include <platform/silabs/multi-ota/OTAMultiImageProcessorImpl.h>
2828
#else
2929
#include <platform/silabs/OTAImageProcessorImpl.h>
3030
#endif

examples/platform/silabs/args.gni

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ segger_rtt_buffer_size_down = 1024
2525

2626
declare_args() {
2727
app_data_model = ""
28+
chip_enable_multi_ota_requestor = false
2829
}

examples/platform/silabs/efr32/BUILD.gn

+5
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ config("efr32-common-config") {
180180
defines += [ "HEAP_MONITORING" ]
181181
}
182182

183+
if(chip_enable_multi_ota_requestor) {
184+
defines += ["CHIP_DEVICE_CONFIG_ENABLE_MULTI_OTA_REQUESTOR=1"]
185+
}
186+
187+
183188
ldflags = [ "-Wl,--no-warn-rwx-segment" ]
184189
}
185190

scripts/tools/silabs/ota/README.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
orphan: true
3+
---
4+
5+
# Silabs OTA image tool
6+
7+
## Overview
8+
9+
This tool can generate an OTA image in the `|OTA standard header|TLV1|...|TLVn|`
10+
format. The payload contains data in standard TLV format (not Matter TLV
11+
format). During OTA transfer, these TLV can span across multiple BDX blocks,
12+
thus the `OTAImageProcessorImpl` instance should take this into account.
13+
14+
## Supported platforms
15+
16+
- EFR32 -
17+
18+
## Usage
19+
20+
This is a wrapper over standard `ota_image_tool.py`, so the options for `create`
21+
are also available here:
22+
23+
```
24+
python3 ./scripts/tools/silabs/ota/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 50000 -vs "1.0" -da sha256
25+
```
26+
27+
followed by \*_custom options_- and a positional argument (should be last) that
28+
specifies the output file. Please see the `create_ota_images.sh` for some
29+
reference commands.
30+
31+
The list of **custom options**:
32+
33+
```
34+
# Application options
35+
--app-input-file --> Path to the application binary.
36+
--app-version --> Application version. It's part of the descriptor and
37+
can be different than the OTA image header version: -vn.
38+
--app-version-str --> Application version string. Same as above.
39+
--app-build-date --> Application build date. Same as above.
40+
41+
# SSBL options
42+
--bl-input-file --> Path to the SSBL binary.
43+
--bl-version --> SSBL version.
44+
--bl-version-str --> SSBL version string.
45+
--bl-build-date --> SSBL build date.
46+
47+
# Factory data options
48+
--factory-data --> If set, enables the generation of factory data.
49+
--cert_declaration --> Certification Declaration.
50+
--dac_cert --> DAC certificate.
51+
--dac_key --> DAC private key.
52+
--pai_cert --> PAI certificate.
53+
54+
# Custom TLV options
55+
--json --> Path to a JSON file following ota_payload.schema
56+
```
57+
58+
Please note that the options above are separated into four categories:
59+
application, bootloader, factory data and custom TLV (`--json` option). If no
60+
descriptor options are specified for app/SSBL, the script will use the default
61+
values (`50000`, `"50000-default"`, `"2023-01-01"`). The descriptor feature is
62+
optional, TLV processors having the option to register a callback for descriptor
63+
processing.
64+
65+
## Custom payload
66+
67+
When defining a custom processor, a user is able to also specify the custom
68+
format of the TLV by creating a JSON file based on the `ota_payload.schema`. The
69+
tool offers support for describing multiple TLV in the same JSON file. Please
70+
see the `examples/ota_max_entries_example.json` for a multi-app + SSBL example.
71+
Option `--json` must be used to specify the path to the JSON file.
72+
73+
## Examples
74+
75+
A set of examples can be found in `./examples`. Please run `create_ota_image.sh`
76+
to generate the examples:
77+
78+
- Application image with default descriptor
79+
- Application image with specified descriptor
80+
- Factory data image
81+
- SSBL image
82+
- Application + SSBL + factory data image
83+
- Maximum number of entries image, using `ota_max_entries_example.json`. The
84+
examples uses 8 SSBL binaries because they have a small size and fit in
85+
external flash.
86+
87+
The binaries from `./examples/binaries` should only be used only as an example.
88+
The user should provide their own binaries when generating the OTA image.

0 commit comments

Comments
 (0)