Supported Targets | ESP32-C2 | ESP32-C3 |
---|
This example demonstrates how to use compressed OTA by the bootloader support plus component.
The basic flow of compressed OTA:
Plaintext
************ *************
*bootloader* ---------------------->* ota_0 * <-----
************ ************* |
|decompress
************* |
* ota_1 * ------
*************
The example is a copy of simple_ota_example. Please refer the README.md for setup details.
You can also use the other samples in esp-idf/examples/system/ota directory to verify compressed OTA.
Generate the compressed app firmware in an ESP-IDF "project" directory by running:
Plaintext
idf.py gen_compressed_ota
This command will compile the project first, then it will generate the compressed app firmware. If there are no errors, the build/custom_ota_binaries
directory may contain the following file:
Plaintext
simple_ota.bin.xz
simple_ota.bin.xz.packed
The file named simple_ota.bin.xz.packed
is the actual compressed app binary file to be transferred.
In addition, if secure boot is enabled, the command will generate the signed compressed app binary file:
Plaintext
simple_ota.bin.xz.packed.signed
you can also use the script gen_custom_ota.py to compress the specified app:
Plaintext
python3 gen_custom_ota.py -hv v3 -i simple_ota.bin --add_app_header
Plaintext
I (4601) simple_ota_example: Starting OTA example task
I (4611) simple_ota_example: Attempting to download update from https://192.168.4.102:8070/simple_ota.bin.xz.packed
I (4621) main_task: Returned from app_main()
I (5071) esp_https_ota: Starting OTA...
I (5071) custom_image: OTA to ota_1
I (5071) esp_https_ota: Writing to partition subtype 17 at offset 0x150000
I (13131) simple_ota_example: OTA Succeed, Rebooting...
...
I (115) boot_custom: bootloader plus version: 0.2.6
I (252) boot_custom: start OTA to slot 0
I (10268) boot_custom: OTA success, boot from slot 0
I (10268) esp_image: segment 0: paddr=00020020 vaddr=3c0c0020 size=2a8cch (174284) map
I (10299) esp_image: segment 1: paddr=0004a8f4 vaddr=3fc92e00 size=02d88h ( 11656) load
I (10301) esp_image: segment 2: paddr=0004d684 vaddr=40380000 size=02994h ( 10644) load
I (10307) esp_image: segment 3: paddr=00050020 vaddr=42000020 size=b1408h (726024) map
I (10427) esp_image: segment 4: paddr=00101430 vaddr=40382994 size=102b0h ( 66224) load
I (10445) boot: Loaded app from partition at offset 0x20000
To create a project from this example, run:
idf.py create-project-from-example "espressif/bootloader_support_plus=0.3.8:simple_ota_example"