Espressif ESP32-S2 Programming Manual page 1031

Table of Contents

Advertisement

Chapter 2. API Reference
• The partition table should not have a factory partition, only two of the app.
security_version:
• In application image it is stored in esp_app_desc structure.
FIG_BOOTLOADER_APP_SECURE_VERSION.
Secure OTA Updates Without Secure boot
The verification of signed OTA updates can be performed even without enabling hardware secure
boot.
This can be achieved by setting
FIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT
OTA Tool (otatool.py)
The component app_update provides a tool
device. The following operations can be performed using the tool:
• read contents of otadata partition (read_otadata)
• erase otadata partition, effectively resetting device to factory app (erase_otadata)
• switch OTA partitions (switch_ota_partition)
• erasing OTA partition (erase_ota_partition)
• write to OTA partition (write_ota_partition)
• read contents of OTA partition (read_ota_partition)
The tool can either be imported and used from another Python script or invoked from shell script for users wanting
to perform operation programmatically. This is facilitated by the tool's Python API and command-line interface,
respectively.
Python API
Before anything else, make sure that the otatool module is imported.
import
sys
import
os
idf_path
=
os.environ["IDF_PATH"]
otatool_dir
=
os.path.join(idf_path, "components", "app_update")
lives in $IDF_PATH/components/app_update
sys.path.append(otatool_dir)
from
otatool
import
The starting point for using the tool's Python API to do is create a OtatoolTarget object:
# Create a partool.py target device connected on serial port /dev/ttyUSB1
target
=
OtatoolTarget("/dev/ttyUSB1")
The created object can now be used to perform operations on the target device:
# Erase otadata, reseting the device to factory app
target.erase_otadata()
# Erase contents of OTA app slot 0
target.erase_ota_partition(0)
# Switch boot partition to that of app slot 1
target.switch_ota_partition(1)
# Read OTA partition 'ota_3' and save contents to a file named 'ota_3.bin'
target.read_ota_partition("ota_3", "ota_3.bin")
Espressif Systems
CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT
otatool.py
# get value of IDF_PATH from environment
# this enables Python to find otatool module
*
# import all names inside otatool module
Submit Document Feedback
for performing OTA partition-related operations on a target
1020
The number is set
CON-
and
CON-
#
otatool.py␣
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF