arduino-pico/ota
Kjell Braden 4d03edc7d5
Don't go through runtime initializers when there is no OTA command (#2697)
Leave that to the main app instead, so we don't reset peripherals twice.
* ota: fix copy error for riscv headers
* ota: initialize bootrom bit ops and add explanation
2024-12-19 10:05:46 -08:00
..
uzlib@6d60d651a4
CMakeLists.txt Don't go through runtime initializers when there is no OTA command (#2697) 2024-12-19 10:05:46 -08:00
make-ota.sh Add RISC-V support, GCC 14 move (#2491) 2024-09-29 15:10:36 -07:00
memmap_ota_rp2040.ld Add RP2350 support, new boards (#2337) 2024-08-25 11:21:46 -07:00
memmap_ota_rp2350-riscv.ld Add RISC-V support, GCC 14 move (#2491) 2024-09-29 15:10:36 -07:00
memmap_ota_rp2350.ld Enable OTA support for RP2350 (#2472) 2024-09-17 15:05:42 -07:00
ota.c Don't go through runtime initializers when there is no OTA command (#2697) 2024-12-19 10:05:46 -08:00
ota_clocks.c Add RP2350 support, new boards (#2337) 2024-08-25 11:21:46 -07:00
ota_command.h
ota_lfs.c Enable use of uninitialized_ram() macro (#1199) 2023-02-16 17:59:15 -08:00
ota_lfs.h
pico_sdk_import.cmake
README.md Update README.md 2022-09-04 11:38:58 -07:00

Arduino-Pico OTA Bootloader

This directory contains a small "stage 3" bootloader (after the boot ROM and the boot2.S flash configuration) which implements a power fail safe, generic OTA method.

The bootloader is built here into an .ELF, without boot2.S (which will come from the main app), configured to copy itself into RAM (so that it can update itself), and included in the main applications. Exactly 12KB for all sketches is consumed by this OTA bootloader.

It works by mounting the LittleFS file system (the parameters are stored by the main app at 0x3000-16), checking for a specially named command file. If that file exists, and its contents pass a checksum, the bootloader reads from the filesystem (optionally, automatically decompressing GZIP compressed files) and writes to application flash.

Every block is checked to see if it identical to the block already in flash, and if so it is skipped. This allows silently skipping bootloader writes in many cases.

Should a power failure happen, as long as it was not in the middle of writing a new OTA bootloader, it should simply begin copying the same program from scratch.

When the copy is completed, the command file's contents are erased so that on a reboot it won't attempt to write the same firmware over and over. It then reboots the chip (and re-runs the potentially new bootloader).

If there is no special file, or its contents don't have a proper checksum, the bootloader simply adjusts the ARM internal vector pointers and jumps to the main application.

The files in the LittleFS filesystem can come over WiFi, over an Ethernet object, or even over a serial port.