Chapter 4. API Guides
4.3 Bootloader
The ESP-IDF Software Bootloader performs the following functions:
1. Minimal initial configuration of internal modules;
2. Initialize Flash Encryption and/or Secure features, if configured;
3. Select the application partition to boot, based on the partition table and ota_data (if any);
4. Load this image to RAM (IRAM & DRAM) and transfer management to the image that was just loaded.
Bootloader is located at the address 0x1000 in the flash.
For a full description of the startup process including the the ESP-IDF bootloader, see Application Startup Flow.
4.3.1 Bootloader compatibility
It is recommended to update to newer versions of ESP-IDF: when they are released. The OTA (over the air) update
process can flash new apps in the field but cannot flash a new bootloader. For this reason, the bootloader supports
booting apps built from newer versions of ESP-IDF.
The bootloader does not support booting apps from older versions of ESP-IDF. When updating ESP-IDF manually
on an existing product that might need to downgrade the app to an older version, keep using the older ESP-IDF
bootloader binary as well.
Note: If testing an OTA update for an existing product in production, always test it using the same ESP-IDF
bootloader binary that is deployed in production.
SPI Flash Configuration
Each ESP-IDF application or bootloader .bin file contains a header with CONFIG_ESPTOOLPY_FLASHMODE, CON-
FIG_ESPTOOLPY_FLASHFREQ, CONFIG_ESPTOOLPY_FLASHSIZE embedded in it. These are used to configure
the SPI flash during boot.
The First stage bootloader in ROM reads the Second stage bootloader header information from flash and uses this
infomation to load the rest of the Second stage bootloader from flash. However, at this time the system clock speed
is lower than configured and not all flash modes are supported. When the Second stage bootloader then runs, it will
reconfigure the flash using values read from the currently selected app binary’s header (and NOT from the Second
stage bootloader header). This allows an OTA update to change the SPI flash settings in use.
4.3.2 Log Level
The default bootloader log level is “Info”. By setting the CONFIG_BOOTLOADER_LOG_LEVEL option, it’s
possible to increase or decrease this level. This log level is separate from the log level used in the app (see Logging
library).
Reducing bootloader log verbosity can improve the overall project boot time by a small amount.
4.3.3 Factory reset
Sometimes it is desirable to have a way for the device to fall back to a known-good state, in case of some problem
with an update.
To roll back to the original “factory”device configuration and clear any user settings, configure the config item
CONFIG_BOOTLOADER_FACTORY_RESET in the bootloader.
The factory reset mechanism allows the device to be factory reset in two ways:
Espressif Systems 1266
Submit Document Feedback
Release v4.4