Skip to content

esp8266 precompiled bootloaders don't support partitions past 1MB #16402

@iosabi

Description

@iosabi

Description

The esp8266 cpu ships with some bootloader code pre-compiled from the vendor SDK. I couldn't find what revision and options where used to compile these bootloaders, they have the following bug:

If the partition table contains any partition that starts or ends at the 1MB boundary or after that you get the following error even if using a chip with 4MB flash:

I (69) boot: SPI Flash Size : 4MB
E (72) flash_parts: partition 3 invalid - offset 0x100000 size 0x2000 exceeds flash chip size 0x100000
E (81) boot: Failed to verify partition table
E (85) boot: load partition table error!
user code done

Note that the code detects the flash at 4MB but then complains about the partition being larger than 1MB.

Steps to reproduce the issue

Create a custom partition table with the vendor recommended OTA scheme, for example:

$ cat mypartitions.csv
# Name,   Type, SubType, Offset,   Size
nvs,      data, nvs,     0x9000,   0x6000
phy_init, data, phy,     0xf000,   0x1000
ota_0,    app,  ota_0,   0x010000, 0xf0000
otadata,  data, ota,     0x100000, 0x2000
ota_1,    app,  ota_1,   0x110000, 0xf0000

Then compile and run on a esp12 board the following example program:

USEMODULE=esp_log_startup make -C tests/shell BOARD=esp8266-esp-12x PARTITION_TABLE_CSV=`pwd`/mypartitions.csv -j flash

Expected results

The board should boot all the way to the shell.

Actual results

The ROM bootloader loads the flash bootloader at 0x0000 and prints messages in the UART at 74880 bps while doing that; and then the flash bootloader switches to 115200 and prints the following error:

I (69) boot: SPI Flash Size : 4MB
E (72) flash_parts: partition 3 invalid - offset 0x100000 size 0x2000 exceeds flash chip size 0x100000
E (81) boot: Failed to verify partition table
E (85) boot: load partition table error!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: cpuArea: CPU/MCU portsPlatform: ESPPlatform: This PR/issue effects ESP-based platformsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions