@@ -7,6 +7,13 @@ dependent, therefore, the system environment including toolchains, must be set a
77standalone build version means that ESP-IDF and its toolchain are used as source. For 3rd parties
88framework, HAL path and toolchain must be set.
99
10+ ---
11+ *** Note***
12+
13+ * Current compatible ESP-IDF version for HAL sources is ` v5.1.6 ` *
14+
15+ ---
16+
1017Documentation about the MCUboot bootloader design, operation and features can be found in the
1118[ design document] ( design.md ) .
1219
@@ -16,7 +23,7 @@ The current port is available for use in the following SoCs within the OSes:
1623
1724| | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 | ESP32-C2 | ESP32-C6 | ESP32-H2 |
1825| :----: | :-------: | :-------: | :-------: | :-------: | :---------: | :-------: | :---------: |
19- | Zephyr | Supported | Supported | Supported | Supported | Supported | Supported | In progress |
26+ | Zephyr | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
2027| NuttX | Supported | Supported | Supported | Supported | In progress | Supported | Supported |
2128
2229Notice that any customization in the memory layout from the OS application must be done aware of
@@ -44,7 +51,12 @@ The following instructions considers a MCUboot Espressif port standalone build.
4451 ` ` `
4552
46533. If ESP-IDF is the chosen option for use as HAL layer and the system already have ESP-IDF
47- installed, ensure that the environment is set:
54+ installed, ensure that it is the current compatible version and the environment is set:
55+
56+ ` ` ` bash
57+ cd < IDF_PATH>
58+ git checkout v5.1.6
59+ ` ` `
4860
4961 ` ` ` bash
5062 < IDF_PATH> /install.sh
@@ -140,18 +152,27 @@ Additional configuration related to MCUboot features and slot partitioning may b
140152 ninja -C build/ flash
141153 ```
142154
143- If `MCUBOOT_FLASH_PORT` arg was not passed to `cmake`, the default `PORT` for flashing will be
144- `/dev/ttyUSB0`.
155+ If the below arguments were not passed to `cmake` build step , the default values for each on
156+ the flashing operation will be as following:
145157
146- Alternatively:
158+ - `MCUBOOT_FLASH_PORT`: "/dev/ttyUSB0"
159+ - `ESP_BAUD_RATE`: 115200
160+ - `ESP_FLASH_MODE`: "dio"
161+ - `ESP_FLASH_FREQ`: "40m" for ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6;
162+ "60m" for ESP32-C2;
163+ "24m" for ESP32-H2.
164+
165+ Alternatively, `esptool` can be used for flashing directly:
147166
148167 ```bash
149- esptool.py -p <PORT> -b <BAUD> --before default_reset --after no_reset --chip <TARGET> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq 40m <BOOTLOADER_FLASH_OFFSET> build/mcuboot_<TARGET>.bin
168+ esptool.py -p <PORT> -b <BAUD> --before default_reset --after no_reset --chip <TARGET> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq <FLASH_FREQ> <BOOTLOADER_FLASH_OFFSET> build/mcuboot_<TARGET>.bin
150169 ```
151170
152171 ---
153172 ***Note***
154173
174+ Ensure that the flash parameters like `<FLASH_FREQ>`, `<FLASH_MODE>`, `<FLASH_SIZE>` matches
175+ the same parameters from `cmake` step and configuration file.
155176 You may adjust the port `<PORT>` (like `/dev/ttyUSB0`) and baud rate `<BAUD>` (like `2000000`)
156177 according to the connection with your board. You can also skip `<PORT>` and `<BAUD>` parameters
157178 so that esptool tries to automatically detect it.
@@ -209,7 +230,7 @@ Additional configuration related to MCUboot features and slot partitioning may b
2092302. Flash the signed application:
210231
211232 ```bash
212- esptool.py -p <PORT> -b <BAUD> --before default_reset --after hard_reset --chip <TARGET> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq 40m <SLOT_OFFSET> <SIGNED_BIN>
233+ esptool.py -p <PORT> -b <BAUD> --before default_reset --after hard_reset --chip <TARGET> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq <FLASH_FREQ> <SLOT_OFFSET> <SIGNED_BIN>
213234 ```
214235
215236# [Downgrade prevention](#downgrade-prevention)
@@ -366,10 +387,14 @@ CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=1
366387# to not overlap with other flash regions)
367388CONFIG_EFUSE_VIRTUAL=1
368389CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=1
369- CONFIG_EFUSE_VIRTUAL_OFFSET=0x250000
390+ CONFIG_EFUSE_VIRTUAL_OFFSET=0x10000
370391CONFIG_EFUSE_VIRTUAL_SIZE=0x2000
371392
372393` ` `
394+
395+ Observe that the region defined by ` CONFIG_EFUSE_VIRTUAL_OFFSET` and ` CONFIG_EFUSE_VIRTUAL_SIZE`
396+ must not overlap with other flash regions.
397+
373398---
374399
375400---
@@ -420,10 +445,13 @@ key are correct and you did not forget anything before flashing.*
420445---
421446
422447Flash the bootloader as following, with ` --after no_reset` flag, so you can reset the device only
423- when assured:
448+ when assured. Also ensure that the flash parameters like ` < FLASH_FREQ> ` , ` < FLASH_MODE> ` ,
449+ ` < FLASH_SIZE> ` matches the same parameters from ` cmake` step and configuration file, this is
450+ important because ` esptool` may modify the binary if it detects that these parameters are
451+ different from what they were on the building.
424452
425453` ` ` bash
426- esptool.py -p < PORT> -b 2000000 --after no_reset --chip < ESP_CHIP> write_flash --flash_mode dio --flash_size < FLASH_SIZE> --flash_freq 40m < BOOTLOADER_FLASH_OFFSET> < SIGNED_BOOTLOADER_BIN>
454+ esptool.py -p < PORT> -b 2000000 --after no_reset --chip < ESP_CHIP> write_flash --flash_mode dio --flash_size < FLASH_SIZE> --flash_freq < FLASH_FREQ > < BOOTLOADER_FLASH_OFFSET> < SIGNED_BOOTLOADER_BIN>
427455` ` `
428456
429457# ## [Secure Boot Process](#secure-boot-process)
@@ -510,10 +538,14 @@ CONFIG_SECURE_BOOT_ALLOW_JTAG=1
510538# to not overlap with other flash regions)
511539CONFIG_EFUSE_VIRTUAL=1
512540CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=1
513- CONFIG_EFUSE_VIRTUAL_OFFSET=0x250000
541+ CONFIG_EFUSE_VIRTUAL_OFFSET=0x10000
514542CONFIG_EFUSE_VIRTUAL_SIZE=0x2000
515543
516544```
545+
546+ Observe that the region defined by `CONFIG_EFUSE_VIRTUAL_OFFSET` and `CONFIG_EFUSE_VIRTUAL_SIZE`
547+ must not overlap with other flash regions.
548+
517549---
518550
519551---
@@ -583,11 +615,11 @@ the SPI Flash.
583615Flash the bootloader and application normally:
584616
585617` ` ` bash
586- esptool.py -p < PORT> -b 2000000 --after no_reset --chip < ESP_CHIP> write_flash --flash_mode dio --flash_size < FLASH_SIZE> --flash_freq 40m < BOOTLOADER_FLASH_OFFSET> < BOOTLOADER_BIN>
618+ esptool.py -p < PORT> -b 2000000 --after no_reset --chip < ESP_CHIP> write_flash --flash_mode dio --flash_size < FLASH_SIZE> --flash_freq < FLASH_FREQ > < BOOTLOADER_FLASH_OFFSET> < BOOTLOADER_BIN>
587619` ` `
588620
589621` ` ` bash
590- esptool.py -p < PORT> -b 2000000 --after no_reset --chip < ESP_CHIP> write_flash --flash_mode dio --flash_size < FLASH_SIZE> --flash_freq 40m < PRIMARY_SLOT_FLASH_OFFSET> < APPLICATION_BIN>
622+ esptool.py -p < PORT> -b 2000000 --after no_reset --chip < ESP_CHIP> write_flash --flash_mode dio --flash_size < FLASH_SIZE> --flash_freq < FLASH_FREQ > < PRIMARY_SLOT_FLASH_OFFSET> < APPLICATION_BIN>
591623` ` `
592624
593625On the ** first boot** , the bootloader will:
@@ -642,11 +674,11 @@ of generate a new one.
642674Flashing the bootloader and application:
643675
644676```bash
645- esptool.py -p <PORT> -b 2000000 --after no_reset --chip <ESP_CHIP> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq 40m <BOOTLOADER_FLASH_OFFSET> <BOOTLOADER_BIN>
677+ esptool.py -p <PORT> -b 2000000 --after no_reset --chip <ESP_CHIP> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq <FLASH_FREQ> <BOOTLOADER_FLASH_OFFSET> <BOOTLOADER_BIN>
646678```
647679
648680```bash
649- esptool.py -p <PORT> -b 2000000 --after no_reset --chip <ESP_CHIP> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq 40m <PRIMARY_SLOT_FLASH_OFFSET> <APPLICATION_BIN>
681+ esptool.py -p <PORT> -b 2000000 --after no_reset --chip <ESP_CHIP> write_flash --flash_mode dio --flash_size <FLASH_SIZE> --flash_freq <FLASH_FREQ> <PRIMARY_SLOT_FLASH_OFFSET> <APPLICATION_BIN>
650682```
651683
652684On the **first boot**, the bootloader will:
0 commit comments