ESP32-P4 bootloop after enabling flash encryption

VSparxx
Posts: 5
Joined: Thu Dec 19, 2024 11:55 am

ESP32-P4 bootloop after enabling flash encryption

Postby VSparxx » Mon Oct 06, 2025 7:40 am

Hi all, first a small introduction, I have a project that runs no issues on the ESP32-S3 RGB LCD modules (yellow pcb lcds), encryption i s enabled in development mode, no issues reflashing them via OTA or Serial.
Now to the problem, i have gotten myself one of these newer ESP32-P4NRW32 + C6 lcds that sport mipi dsi lcds, i have made sure to be able to run the project successfully on it unencrypted, all was running well and most imortantly fps is super impressive compared to the previous lcd, so far no issues whatsoever, then i did my usual encryption enablement thing and (sad violin) it just started boot looping.
Now no matter how i flash it just outputs invalid header: 0x02000613 to console.
What i tried:
1. Pre-encrypting wiht the same key all the necessary binaries: bootloader.bin, partitions.bin, firmware.bin and flashing see below for all the commands i run:
pre-encrypting binaries

Code: Select all

.\espsecure.exe  encrypt-flash-data --keyfile .\esp32p4_dev_enc_key.bin --address 0x0 --output .\bootloader-enc.bin .\bootloader.bin
.\espsecure.exe  encrypt-flash-data --keyfile .\esp32p4_dev_enc_key.bin --address 0x8000 --output .\partitions-enc.bin .\partitions.bin
.\espsecure.exe  encrypt-flash-data --keyfile .\esp32p4_dev_enc_key.bin --address 0x10000 --output .\esp32p4-lcd\firmware-enc.bin .\esp32p4-lcd\firmware.bin
flashing cmd

Code: Select all

.\esptool.exe -p COM13 -b 1152000 --before=default-reset --after=hard-reset write-flash  0x0 .\bootloader-enc.bin 0x8000 .\partitions-enc.bin 0x10000 .\firmware-enc.bin
This above dind't work, console just outputs:

Code: Select all

invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
2. Tried flashing plain text and passing the --encrypt flag so it encrypts itself using the burned key when writing to flash, cmd bellow.

Code: Select all

.\esptool.exe -p COM13 -b 1152000 --before=default-reset --after=hard-reset write-flash --encrypt 0x0 .\bootloader.bin 0x8000 .\partitions.bin 0x10000 .\firmware.bin
This also had no success, console outputs same stuff:

Code: Select all

invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
invalid header: 0x02000613
Attached a dump of the efuses as well.
Any help will be much appreciated!
Attachments
30eda0e19632_20251005_120838.txt
(21.54 KiB) Downloaded 28 times

VSparxx
Posts: 5
Joined: Thu Dec 19, 2024 11:55 am

Re: ESP32-P4 bootloop after enabling flash encryption

Postby VSparxx » Mon Oct 06, 2025 9:39 am

Okay so the issue was the fact that i was flashing the bootloader that wrong address, it needs to be 0x2000 instead of 0x0.

Who is online

Users browsing this forum: Amazon [Bot], Barkrowler, Bytespider and 5 guests