← Back to the chapter · Previous detail
Technical detail · Safe Over-the-Air Updates
Why the bootloader is the risk surface
22.5.1 Why the Bootloader Is the Risk Surface
A watchdog is a timer that can reset a device if software stops responding. Brown-out detection watches the supply voltage and holds or resets the device when it falls too low for reliable operation. Both settings can affect whether a device recovers safely after an update.
On an ESP32-C3, a first-stage bootloader in ROM runs first and loads a second-stage bootloader from flash. That bootloader selects and starts an application. During ESP-IDF app OTA, the running application writes a new image to an inactive app partition; the bootloader selects it on a later boot. Boot settings depend on the target: ESP-IDF reads SPI flash settings from the selected app image header, while some Microchip MCUs use non-volatile configuration bits for the clock, watchdog, and brown-out detection. A wrong partition layout or boot setting can prevent a device from starting, so test the update on the exact target hardware.
This is why bricking is not a vague fear. If an update path writes directly over the only copy of the bootloader or active image and the transfer is interrupted, corrupted, or aimed at the wrong hardware revision, there may be no known-good code left to boot into. A device in that state is unrecoverable over the air, and lost outright if it is physically inaccessible. The recoverable-slot and boot-confirmation requirements earlier in this section exist to prevent exactly that: the update agent stages the new image in an inactive slot or partition; with application-confirmed rollback enabled, the bootloader boots the candidate first, and the running application then confirms its health or rejects it so the bootloader returns to the previous image.
Two established OTA architectures make different trade-offs with this risk. An on-chip bootloader that handles the update itself can reuse the device’s existing radio or serial hardware and keeps size and cost down, but a corrupted bootloader on that same chip can brick the device with no fallback path. A dedicated off-chip programmer — a companion chip or module that owns the update protocol separately from the application processor — keeps the update path isolated from application firmware risk, at the cost of extra size, complexity, and unit cost. Record which architecture a target device uses in target_bootloader_or_partition_scheme; it changes what “recoverable” means for that hardware.