Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 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 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 17 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 18 | scripts/examples/gn_build_example.sh examples/chip-tool out/ |
| 19 | scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug chip_config_network_layer_ble=false |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 20 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 21 | |
| 22 | - Build or download the Gecko Bootloader binary. Bootloader should be built |
Sergei Lissianoi | 94e8197 | 2022-04-13 11:35:18 -0400 | [diff] [blame] | 23 | with the Gecko SDK version 3.2.1 or earlier. For the bootloader using the |
| 24 | external flash select the "external SPI" bootloader type configured with a |
| 25 | single slot of at least 1000 KB. For the bootloader using the internal flash |
| 26 | (supported on MG24 boards only) select the "internal storage" bootloader |
| 27 | type. Follow the instructions in "UG266: Silicon Labs Gecko Bootloader |
| 28 | User’s Guide". Pre-built binaries for some configurations should be |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 29 | available in |
| 30 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 31 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 32 | third_party/efr32_sdk/repo/platform/bootloader/sample-apps/bootloader-storage-spiflash-single |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 33 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 34 | |
| 35 | - Using the commander tool upload the bootloader to the device running the |
| 36 | application. |
| 37 | |
| 38 | - Create a bootable image file (using the Lighting application image as an |
| 39 | example): |
| 40 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 41 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 42 | commander gbl create chip-efr32-lighting-example.gbl --app chip-efr32-lighting-example.s37 |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 43 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 44 | |
| 45 | - Create the Matter OTA file from the bootable image file: |
| 46 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 47 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 48 | ./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 |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 49 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 50 | |
| 51 | - In a terminal start the Provider app passing to it the path to the Matter |
| 52 | OTA file created in the previous step: |
| 53 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 54 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 55 | rm -r /tmp/chip_* |
| 56 | ./out/debug/chip-ota-provider-app -f chip-efr32-lighting-example.ota |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 57 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 58 | |
| 59 | - In a separate terminal run the chip-tool commands to provision the Provider: |
| 60 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 61 | ``` |
| 62 | ./out/chip-tool pairing onnetwork 1 20202021 |
| 63 | ./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 |
| 64 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 65 | |
| 66 | - If the application device had been previously commissioned hold Button 0 for |
| 67 | six seconds to factory-reset the device. |
| 68 | |
| 69 | - In the chip-tool terminal enter: |
| 70 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 71 | ``` |
| 72 | ./out/chip-tool pairing ble-thread 2 hex:<operationalDataset> 20202021 3840 |
| 73 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 74 | |
| 75 | where operationalDataset is obtained from the OpenThread Border Router. |
| 76 | |
| 77 | - Once the commissioning process completes enter: |
| 78 | |
Andrei Litvin | a76f75e | 2022-04-13 08:34:42 -1000 | [diff] [blame^] | 79 | ``` |
| 80 | ./out/chip-tool otasoftwareupdaterequestor announce-ota-provider 1 0 0 0 2 0 |
| 81 | ``` |
Sergei Lissianoi | 510069d | 2022-03-14 17:12:04 -0400 | [diff] [blame] | 82 | |
| 83 | - The application device will connect to the Provider and start the image |
| 84 | download. Once the image is downloaded the device will reboot into the |
| 85 | downloaded image. |
| 86 | |
| 87 | ## Managing the Software Version, Vendor and Product ID |
| 88 | |
| 89 | Starting the ota-provider-app with the --otaImageList command line option allows |
| 90 | the user to supply a JSON file specifying the Software Version, Vendor and |
| 91 | Product ID that identify the image served by the Provider, see |
| 92 | [ota-provider-app](../../examples/ota-provider-app/linux/README.md) |
| 93 | |
| 94 | Example provider configuration file: |
| 95 | |
| 96 | ``` |
| 97 | { "foo": 1, // ignored by parser |
| 98 | "deviceSoftwareVersionModel": |
| 99 | [ |
| 100 | { "vendorId": 65521, "productId": 32773, "softwareVersion": 1, "softwareVersionString": "1.0.0", "cDVersionNumber": 18, "softwareVersionValid": true, "minApplicableSoftwareVersion": 0, "maxApplicableSoftwareVersion": 100, "otaURL": "chip-efr32-lighting-example.ota" } |
| 101 | ] |
| 102 | } |
| 103 | ``` |
| 104 | |
| 105 | In order for the Provider to successfully serve the image to a device during the |
| 106 | OTA Software Update process the softwareVersion parameter in the Provider config |
| 107 | file must be greater than the CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION |
| 108 | parameter set in the application's CHIPProjectConfig.h file. |