problem with re-flashable bootloader + secure boot

/dev/urandom
Posts: 2
Joined: Tue Dec 10, 2019 8:45 pm

problem with re-flashable bootloader + secure boot

Postby /dev/urandom » Tue Dec 10, 2019 8:58 pm

I'm trying to set up an example with re-flashable bootloader + secure boot + app signing with esp-idfv3.3
I took an example app, enable re-flashable bootloader, automatic signing and set a secure boot signing key. Built the app with make and make bootloader. secure-bootloader-key-256.bin gets generated re-produceable.

The efuses were burned successfully, espefuse.py printed them in reverse order as it seems (compared to secure-bootloader-key-256.bin).

But when I re-flash the bootloader and or secure bootloader digest I jut get repeated resets:

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:8856
load:0x40078000,len:17776
ho 0 tail 12 room 4
load:0x40080400,len:6648
entry 0x40080764
I (60) boot: ESP-IDF v3.3-dirty 2nd stage bootloader
I (60) boot: compile time 21:39:45
I (60) boot: Enabling RNG early entropy source...
I (66) boot: SPI Speed      : 40MHz
I (70) boot: SPI Mode       : DIO
I (74) boot: SPI Flash Size : 4MB
E (78) flash_parts: partition 0 invalid magic number 0x1ad
E (84) boot: Failed to verify partition table
E (89) boot: load partition table error!
ets Jun  8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:8856
load:0x40078000,len:17776
ho 0 tail 12 room 4
load:0x40080400,len:6648
entry 0x40080764
I (60) boot: ESP-IDF v3.3-dirty 2nd stage bootloader
I (60) boot: compile time 21:39:45
I (60) boot: Enabling RNG early entropy source...
I (66) boot: SPI Speed      : 40MHz
I (70) boot: SPI Mode       : DIO
I (74) boot: SPI Flash Size : 4MB
E (78) flash_parts: partition 0 invalid magic number 0x1ad
E (84) boot: Failed to verify partition table
E (89) boot: load partition table error!
ets Jun  8 2016 00:22:57
When I flash the main app + partition table I get another reset:

Code: Select all

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:8856
load:0x40078000,len:17776
ho 0 tail 12 room 4
load:0x40080400,len:6648
csum err:0xe8!=0x04
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:8856
load:0x40078000,len:17776
ho 0 tail 12 room 4
load:0x40080400,len:6648
csum err:0xe8!=0x04
ets_main.c 371 
ets Jun  8 2016 00:22:57
It might be that I built and flashed the original app with 2MB flash setting instead of the 4MB I have.

Any Ideas where my error could be?


/dev/urandom
Posts: 2
Joined: Tue Dec 10, 2019 8:45 pm

Re: problem with re-flashable bootloader + secure boot

Postby /dev/urandom » Wed Dec 11, 2019 4:59 pm

Increased partition table offset from 0x8000 (default) to 0x10000 and it works, thanks a lot ! :D

Who is online

Users browsing this forum: djixon and 155 guests