Skip to content

Commit 510069d

Browse files
selissiakowsisoundhar12carol-applebzbarsky-appleDamian-Nordic
authored
[OTA] EFR32: Parse Matter OTA header, update documentation (#16120)
* Add header parsing logic to OTAImageProcessorImpl * Use a local variable for the buffer when parsing the header * Test added march 8 (#15957) * Added new manual scripts * Added Auto generated File * [OTA] Fix OTARequestorDriverImpl inclusion (#15981) * Regen to fix CI failures (#15990) * [ota] Store Default OTA Providers in flash (#15970) * [ota] Store Default OTA Providers in flash Store Default OTA Providers in flash each time the attribute is modified and load it back on the application startup. * Restyled by clang-format * Fix build and reduce flash usage Co-authored-by: Restyled.io <commits@restyled.io> * Set periodic query timeout * Make OTAImageProcessorImpl::Apply() schedule work instead of running directly * Update error logs * Remove files that got out of synch with the upstream repo * Return after bootloader errors * Update OTA documentation for EFR32 * Fix spelling * Add OTA_PERIODIC_TIMEOUT to the lock-app build * Fix typo * Add OTA_periodic_query_timeout to EFR32 light-switch and window-app * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Fix typos * Update dictionary Co-authored-by: kowsisoundhar12 <57476670+kowsisoundhar12@users.noreply.github.com> Co-authored-by: Carol Yang <clyang@apple.com> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> Co-authored-by: Damian Królik <66667989+Damian-Nordic@users.noreply.github.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent e6a96ac commit 510069d

File tree

14 files changed

+226
-167
lines changed

14 files changed

+226
-167
lines changed

.github/.wordlist.txt

+18
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ MX
805805
mydir
806806
MyPASSWORD
807807
MySSID
808+
NAMESERVER
808809
nameserver
809810
namespacing
810811
nano
@@ -1294,6 +1295,7 @@ virtualenv
12941295
visualstudio
12951296
vlatest
12961297
VLEDs
1298+
vn
12971299
vnc
12981300
vous
12991301
VPN
@@ -1382,3 +1384,19 @@ zephyrproject
13821384
Zigbee
13831385
zigbeealliance
13841386
zigbeethread
1387+
libshell
1388+
TestGroupDemoConfig
1389+
ACLs
1390+
AddNOC
1391+
CHIPConfig
1392+
CHIPProjectAppConfig
1393+
CaseAdminNode
1394+
DataVersion
1395+
ProxyView
1396+
ReadAttribute
1397+
WriteAttribute
1398+
kAdminister
1399+
kManage
1400+
kOperate
1401+
kView
1402+
xFFFFFFFD
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Matter Software Update with EFR32 example applications
2+
3+
The Over The Air (OTA) Software Update functionality can be added to any of the
4+
EFR32 example applications by passing the `chip_enable_ota_requestor=true`
5+
option to the build script. This option is supposed to be enabled by default for
6+
all of the EFR32 example applications.
7+
8+
## Running the OTA Download scenario
9+
10+
- For Matter with OpenThread: Bring up the OpenThread Border Router as
11+
discussed in examples/lighting-app/efr32/README.md and get its operational
12+
dataset.
13+
14+
- On a Linux or Darwin platform build the chip-tool and the ota-provider-app
15+
as follows:
16+
17+
scripts/examples/gn_build_example.sh examples/chip-tool out/
18+
scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug chip_config_network_layer_ble=false
19+
20+
- Build or download the Gecko Bootloader binary. Bootloader should be built
21+
with the Gecko SDK version 3.2.1 or earlier, type "external SPI" configured
22+
with a single slot of at least 1000 KB. Pre-built binaries should be
23+
available in
24+
25+
third_party/efr32_sdk/repo/platform/bootloader/sample-apps/bootloader-storage-spiflash-single
26+
27+
- Using the commander tool upload the bootloader to the device running the
28+
application.
29+
30+
- Create a bootable image file (using the Lighting application image as an
31+
example):
32+
33+
commander gbl create chip-efr32-lighting-example.gbl --app chip-efr32-lighting-example.s37
34+
35+
- Create the Matter OTA file from the bootable image file:
36+
37+
./src/app/ota_image_tool.py create -v 0xFFF1 -p 0x8005 -vn 1 -vs "1.0" -da sha256 chip-efr32-lighting-example.gbl chip-efr32-lighting-example.ota
38+
39+
- In a terminal start the Provider app passing to it the path to the Matter
40+
OTA file created in the previous step:
41+
42+
rm -r /tmp/chip_*
43+
./out/debug/chip-ota-provider-app -f chip-efr32-lighting-example.ota
44+
45+
- In a separate terminal run the chip-tool commands to provision the Provider:
46+
47+
./out/chip-tool pairing onnetwork 1 20202021
48+
./out/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0
49+
50+
- If the application device had been previously commissioned hold Button 0 for
51+
six seconds to factory-reset the device.
52+
53+
- In the chip-tool terminal enter:
54+
55+
./out/chip-tool pairing ble-thread 2 hex:<operationalDataset> 20202021 3840
56+
57+
where operationalDataset is obtained from the OpenThread Border Router.
58+
59+
- Once the commissioning process completes enter:
60+
61+
./out/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0
62+
63+
- The application device will connect to the Provider and start the image
64+
download. Once the image is downloaded the device will reboot into the
65+
downloaded image.
66+
67+
## Managing the Software Version, Vendor and Product ID
68+
69+
Starting the ota-provider-app with the --otaImageList command line option allows
70+
the user to supply a JSON file specifying the Software Version, Vendor and
71+
Product ID that identify the image served by the Provider, see
72+
[ota-provider-app](../../examples/ota-provider-app/linux/README.md)
73+
74+
Example provider configuration file:
75+
76+
```
77+
{ "foo": 1, // ignored by parser
78+
"deviceSoftwareVersionModel":
79+
[
80+
{ "vendorId": 65521, "productId": 32773, "softwareVersion": 1, "softwareVersionString": "1.0.0", "cDVersionNumber": 18, "softwareVersionValid": true, "minApplicableSoftwareVersion": 0, "maxApplicableSoftwareVersion": 100, "otaURL": "chip-efr32-lighting-example.ota" }
81+
]
82+
}
83+
```
84+
85+
In order for the Provider to successfully serve the image to a device during the
86+
OTA Software Update process the softwareVersion parameter in the Provider config
87+
file must be greater than the CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
88+
parameter set in the application's CHIPProjectConfig.h file.

examples/light-switch-app/efr32/BUILD.gn

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ declare_args() {
4848
# Enable Sleepy end device
4949
enable_sleepy_device = false
5050

51+
# OTA timeout in seconds
52+
OTA_periodic_query_timeout = 86400
53+
5154
# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
5255
use_wf200 = false
5356
use_rs911x = false
@@ -100,6 +103,7 @@ efr32_sdk("sdk") {
100103
"BOARD_ID=${efr32_board}",
101104
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
102105
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
106+
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
103107
]
104108

105109
if (chip_enable_pw_rpc) {

examples/light-switch-app/efr32/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12.
1313
- [Running the Complete Example](#running-the-complete-example)
1414
- [Notes](#notes)
1515
- [Running RPC console](#running-rpc-console)
16+
- [Memory settings](#memory-settings)
17+
- [OTA Software Update](#ota-software-update)
1618

1719
<hr>
1820

@@ -362,3 +364,9 @@ console the RAM usage of each individual task and the number of Memory
362364
allocation and Free. While this is not extensive monitoring you're welcome to
363365
modify `examples/platform/efr32/MemMonitoring.cpp` to add your own memory
364366
tracking code inside the `trackAlloc` and `trackFree` function
367+
368+
## OTA Software Update
369+
370+
For the description of Software Update process with EFR32 example applications
371+
see
372+
[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md)

examples/lighting-app/efr32/BUILD.gn

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ declare_args() {
4949
enable_sleepy_device = false
5050

5151
# OTA timeout in seconds
52-
OTA_periodic_query_timeout = 10
52+
OTA_periodic_query_timeout = 86400
5353

54-
# Wifi related stuff - they are overriden by gn -args="use_wf200=true"
54+
# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
5555
use_wf200 = false
5656
use_rs911x = false
5757
use_rs911x_sockets = false

examples/lighting-app/efr32/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12.
1313
- [Running the Complete Example](#running-the-complete-example)
1414
- [Notes](#notes)
1515
- [Running RPC console](#running-rpc-console)
16+
- [Memory settings](#memory-settings)
17+
- [OTA Software Update](#ota-software-update)
1618

1719
<hr>
1820

@@ -315,3 +317,9 @@ console the RAM usage of each individual task and the number of Memory
315317
allocation and Free. While this is not extensive monitoring you're welcome to
316318
modify `examples/platform/efr32/MemMonitoring.cpp` to add your own memory
317319
tracking code inside the `trackAlloc` and `trackFree` function
320+
321+
## OTA Software Update
322+
323+
For the description of Software Update process with EFR32 example applications
324+
see
325+
[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md)

examples/lock-app/efr32/BUILD.gn

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ declare_args() {
4747
# Enable Sleepy end device
4848
enable_sleepy_device = false
4949

50-
# Wifi related stuff - they are overriden by gn -args="use_wf200=true"
50+
# OTA timeout in seconds
51+
OTA_periodic_query_timeout = 86400
52+
53+
# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
5154
use_wf200 = false
5255
use_rs911x = false
5356
use_rs911x_sockets = false
@@ -98,6 +101,7 @@ efr32_sdk("sdk") {
98101
defines = [
99102
"BOARD_ID=${efr32_board}",
100103
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
104+
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
101105
]
102106

103107
if (chip_enable_pw_rpc) {

examples/lock-app/efr32/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ An example showing the use of CHIP on the Silicon Labs EFR32 MG12.
1212
- [Viewing Logging Output](#viewing-logging-output)
1313
- [Running the Complete Example](#running-the-complete-example)
1414
- [Notes](#notes)
15+
- [Memory settings](#memory-settings)
16+
- [OTA Software Update](#ota-software-update)
1517

1618
<hr>
1719

@@ -289,3 +291,9 @@ console the RAM usage of each individual task and the number of Memory
289291
allocation and Free. While this is not extensive monitoring you're welcome to
290292
modify `examples/platform/efr32/MemMonitoring.cpp` to add your own memory
291293
tracking code inside the `trackAlloc` and `trackFree` function
294+
295+
## OTA Software Update
296+
297+
For the description of Software Update process with EFR32 example applications
298+
see
299+
[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md)
+5-120
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,6 @@
1-
# CHIP EFR32 OTA Requestor Example
1+
For the description of Software Update process with EFR32 example applications
2+
see
3+
[EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md)
24

3-
An example showing the use of the Matter OTA Requestor functionality on the
4-
Silicon Labs EFR32 MG12.
5-
6-
<a name="intro"></a>
7-
8-
## Introduction
9-
10-
The EFR32 OTA Requestor example provides a baseline demonstration the Matter OTA
11-
Requestor functionality built with the Silicon Labs gecko SDK. It can be
12-
controlled by a Chip controller over OpenThread network.
13-
14-
<a name="building"></a>
15-
16-
## Building
17-
18-
For initial setup steps please see the CHIP EFR32 Lighting Example README at
19-
examples/lighting-app/efr32/README.md
20-
21-
- Supported hardware:
22-
23-
MG12 boards:
24-
25-
- BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm
26-
- BRD4164A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm
27-
- BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm
28-
- BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm,
29-
915MHz@19dBm
30-
- BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm
31-
32-
MG21 boards: Currently not supported due to RAM limitation.
33-
34-
- BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm
35-
36-
MG24 boards :
37-
38-
- BRD4186A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm
39-
- BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm
40-
41-
* Build the example application:
42-
43-
cd ~/connectedhomeip
44-
./scripts/examples/gn_efr32_example.sh  ./examples/ota-requestor-app/efr32/ ./out/ota-requestor-app BRD4161A
45-
46-
- To delete generated executable, libraries and object files use:
47-
48-
$ cd ~/connectedhomeip
49-
$ rm -rf ./out/
50-
51-
<a name="Flashing the Application"></a>
52-
53-
## Flashing the Application
54-
55-
- On the command line:
56-
57-
$ cd ~/connectedhomeip/out/ota-requestor-app/BRD4161A
58-
$ python3 chip-efr32-ota-requestor-example.flash.py
59-
60-
- Or with the Ozone debugger, just load the .out file.
61-
62-
<a name="view-logging"></a>
63-
64-
## Viewing Logging Output
65-
66-
See `examples/lighting-app/efr32/README.md`
67-
68-
<a name="Running the OTA Download scenario"></a>
69-
70-
## Running the OTA Download scenario
71-
72-
- Bring up the OpenThread Border Router as discussed in
73-
examples/lighting-app/efr32/README.md and get its operational dataset.
74-
75-
- On a Linux or Darwin platform build the chip-tool and the ota-provider-app
76-
as follows:
77-
78-
scripts/examples/gn_build_example.sh examples/chip-tool out/
79-
scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug chip_config_network_layer_ble=false
80-
81-
- Build or download the Gecko Bootloader binary. Bootloader should be built
82-
with the Gecko SDK version 3.2.1 or earlier, type "external SPI" configured
83-
with a single slot of at least 1000 KB. Pre-built binaries should be
84-
available in
85-
86-
third_party/efr32_sdk/repo/platform/bootloader/sample-apps/bootloader-storage-spiflash-single
87-
88-
- Using the commander tool upload the bootloader to the device running the
89-
requestor application.
90-
91-
- Create a bootable image file:
92-
93-
commander gbl create chip-efr32-ota-requestor-example.gbl --app chip-efr32-ota-requestor-example.s37
94-
95-
- In a terminal start the provider app passing to it the path to the bootable
96-
image file created in the previous step:
97-
98-
rm -r /tmp/chip_*
99-
./out/debug/chip-ota-provider-app -f chip-efr32-ota-requestor-example.gbl
100-
101-
- In a separate terminal run the chip-tool commands to provision the Provider:
102-
103-
./out/chip-tool pairing onnetwork 1 20202021
104-
./out/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' 1 0
105-
106-
- If the Requestor had been previously commissioned hold Button 0 for six
107-
seconds to factory-reset the device.
108-
109-
- In the chip-tool terminal enter:
110-
111-
./out/chip-tool pairing ble-thread 2 hex:<operationalDataset> 20202021 3840
112-
113-
where operationalDataset is obtained from the OpenThread Border Router.
114-
115-
- Once the commissioning process completes enter:
116-
117-
./out/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0
118-
119-
- The Requestor will connect to the Provider and start the image download.
120-
Once the image is downloaded the Requestor will reboot into the downloaded
121-
image.
5+
The EFR32 ota-requestor-app example app has been deprecated. The OTA Software
6+
Update functionality can be used in any EFR32 example application.

examples/platform/efr32/OTAConfig.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ void OTAConfig::Init()
7575
gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
7676
gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
7777

78+
// Periodic query timeout must be set prior to requestor being initialized
79+
gRequestorUser.SetPeriodicQueryTimeout(OTA_PERIODIC_TIMEOUT);
7880
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
7981

8082
gImageProcessor.SetOTAImageFile(chip::CharSpan("test.txt"));

examples/window-app/efr32/BUILD.gn

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ declare_args() {
4141
# Enable Sleepy end device
4242
enable_sleepy_device = false
4343

44-
# Wifi related stuff - they are overriden by gn -args="use_wf200=true"
44+
# OTA timeout in seconds
45+
OTA_periodic_query_timeout = 86400
46+
47+
# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
4548
use_wf200 = false
4649
use_rs911x = false
4750
use_rs911x_sockets = false
@@ -92,6 +95,7 @@ efr32_sdk("sdk") {
9295
defines = [
9396
"BOARD_ID=${efr32_board}",
9497
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
98+
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
9599
]
96100
if (use_rs911x) {
97101
defines += rs911x_defs

0 commit comments

Comments
 (0)