Skip to content

Application fails to boot in v4.3 when SPI flash freq differs between bootloader and application (IDFGH-7601) #9156

@zevv

Description

@zevv

Envionment

Custom PCB, ESP32-WROOM-32D on IDF.4.3,

Problem Description

we have a problem where our application is not started by the bootloader when there is a
mismatch in ESPTOOLPY_FLASHFREQ setting between the boot loader and the app.

  • bootloader configured for 40MHz, app for 80MHz: does not boot
  • bootloader configured fro 80MHz, app for 40MHz, does not boot

This problem started for us when upgrading from idf 4.2 to 4.3, I have bisected this to commit 2373f11

Expected Behavior

SPI frequency setting difference between app and bootloader code should not prevent the app from booting.

Actual Behavior

App does not boot when SPI frequency mismatch between bootloader and app.

Steps to reproduce

I can not reproduce this with the minimal hello_world application, as the result seems to depend on the total binary size; the test we have now is compiling our current application (which ends up at approx 450KB), and putting this code in the top of main()

printf("started");
volatile int stop = true;
if(stop) for(;;);

This message started gets printed on idf v4.2, but not on idf v4.2

Debug Logs

Bootloader boots up to the following lines

I (185) esp_image: segment 4: paddr=0x00030020 vaddr=0x400d0020 size=0x4a744 (304964) map
I (283) esp_image: segment 5: paddr=0x0007a76c vaddr=0x4008cbf4 size=0x03648 ( 13896) load
I (289) esp_image: segment 6: paddr=0x0007ddbc vaddr=0x400c0000 size=0x00088 (   136) load
I (299) boot: Loaded app from partition at offset 0x10000
I (299) boot: Disabling RNG early entropy source...

After a few seconds pause the ESP reboots:

ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x12 (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:1
load:0x3fff0030,len:7160
load:0x40078000,len:13212
ho 0 tail 12 room 4
load:0x40080400,len:4568
entry 0x400806f4
I (29) boot: ESP-IDF v4.2.2-dirty 2nd stage bootloader
I (29) boot: compile time 14:07:12
I (29) boot: chip revision: 1
I (33) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (40) boot.esp32: SPI Speed      : 80MHz
I (44) boot.esp32: SPI Mode       : DIO
I (49) boot.esp32: SPI Flash Size : 16MB
I (54) boot: Enabling RNG early entropy source...
...

Other items if possible

The problem seems to be introduced by commit 2373f11

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions