44 lines
1.8 KiB
Markdown
44 lines
1.8 KiB
Markdown
Custom ESP-IDF Bootloader (Rollback Enabled)
|
||
|
||
This minimal project builds a custom ESP-IDF bootloader with rollback support enabled.
|
||
You can flash it later alongside a Rust firmware using `espflash`.
|
||
|
||
What this provides
|
||
- A minimal ESP-IDF project (CMake) that can build just the bootloader.
|
||
- Rollback support enabled via sdkconfig.defaults (CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y).
|
||
- A sample OTA partition table (partitions.csv) suitable for OTA and rollback (otadata + two OTA slots).
|
||
- A convenience script to build the bootloader for the desired target.
|
||
|
||
Requirements
|
||
- ESP-IDF installed and set up (IDF_PATH exported, Python env activated).
|
||
- A selected target (esp32, esp32s3, esp32c3, etc.).
|
||
|
||
Build
|
||
1) Ensure ESP-IDF is set up:
|
||
source "$IDF_PATH/export.sh"
|
||
|
||
2) Pick a target (examples):
|
||
idf.py set-target esp32
|
||
# or use the script:
|
||
./build_bootloader.sh esp32
|
||
|
||
3) Build only the bootloader:
|
||
idf.py bootloader
|
||
# or using the script (which also supports setting target):
|
||
./build_bootloader.sh esp32
|
||
|
||
Artifacts
|
||
- build/bootloader/bootloader.bin
|
||
|
||
Using with espflash (Rust)
|
||
- For a no_std Rust firmware, you can pass this custom bootloader to espflash:
|
||
espflash flash --bootloader build/bootloader/bootloader.bin \
|
||
--partition-table partitions.csv \
|
||
<your-app-binary-or-elf>
|
||
|
||
Notes
|
||
- Rollback logic requires an OTA layout (otadata + at least two OTA app partitions). The provided partitions.csv is a starting point; adjust sizes/offsets to match your needs.
|
||
- This project doesn’t build an application; it exists solely to produce a bootloader with the right configuration.
|
||
- If you need different log verbosity or features, run `idf.py menuconfig` and then diff/port the changes back into sdkconfig.defaults.
|
||
- Targets supported depend on your ESP-IDF version. Use `idf.py set-target <chip>` or `./build_bootloader.sh <chip>`.
|