Error: Bootloader binary size 0x7780 bytes is too large for partition table offset 0x8000. Bootloader binary can be maximum 0x7000 (28672) bytes unless the partition table offset is increased in the Partition Table section of the project configuration menu.
Enabling flash encryption in esp32 firmware.
CONFIG_PARTITION_TABLE_OFFSET
to a higher value (e.g. using idf.py menuconfig
). Default is 0x8000. I would set it to 0x1F000 to reserve 0x17000 more bytes for the bootloader (results in a maximum bootloader size of 120 KiB which should suffice for any situation).CONFIG_PARTITION_TABLE_OFFSET
+ 0x1000. Default is 0x9000. I would set it to 0x20000 to match the previous change. You would want to review and update the locations and sizes of all partitions that follow, not just the first one.
There are 3 "hidden" partitions before the partition table visible in your partitions.csv
. By default they are:
# Start | Length | Partition
# ----------+------------------+----------------------
# 0x0000 | 0x1000 (4 KB) | (hidden) Secure boot IV and app image signature
# 0x1000 | 0x7000 (28 KB) | (hidden) Bootloader
# 0x8000 | 0x1000 (4 KB) | (hidden) Partition table
# ----------+--------------------+----------------------
Default config unwisely allocates only 28 KiB for the bootloader, which is not enough if you enable flash encryption and secure boot. The "visible" partitions declared in your partitions.csv
start where this table ends, 0x9000 by default.
You can change the offset of the partition table using config key CONFIG_PARTITION_TABLE_OFFSET
which moves the partition "Partition table" to a new address. Doing this leaves more space for the bootloader which is located in front of the partition table.
Obviously, all the visible partitions in partitions.csv
move forward by the same amount.
See an example partition table for a 16 MiB Flash below.
Below we leave 120 KiB of space for the bootloader. Followed by semi-mandatory OTA data, PHY partitions. A big 884 KiB NVS partition. Finally two OTA partitions, ~7.6 MiB each.
CONFIG_PARTITION_TABLE_OFFSET
to 0x1F000partitions.csv
to following:# Start | Length | Partition
# ----------+--------------------+----------------------
# 0x0000 | 0x1000 (4 KB) | (hidden) Secure boot IV and app image signature
# 0x1000 | 0x1E000 (120 KB) | (hidden) Bootloader
# 0x1F000 | 0x1000 (4 KB) | (hidden) Partition table
# ----------+--------------------+----------------------
otadata, data, ota, 0x20000, 0x2000,
phy_init, data, phy, 0x22000, 0x1000,
nvs, data, nvs, 0x23000, 0xDD000,
app0, app, ota_0, 0x100000, 0x780000,
app1, app, ota_1, 0x880000, 0x780000,