esp-rs / espflash

Serial flasher utility for Espressif SoCs and modules based on esptool.py
Apache License 2.0
478 stars 116 forks source link

spi_flash: Detected size(2048k) smaller than the size in the binary image header(4096k). #629

Closed xiaguangbo closed 5 months ago

xiaguangbo commented 5 months ago

Device

ESP8684(esp32s2) 2MByte Flash have this err, 4MByte normal.

log

[2024-04-25T13:56:02Z INFO ] Serial port: '/dev/ttyACM0'
[2024-04-25T13:56:02Z INFO ] Connecting...
[2024-04-25T13:56:02Z INFO ] Using flash stub
Chip type:         esp32c2 (revision v1.0)
Crystal frequency: 26 MHz
Flash size:        2MB
Features:          WiFi, BLE
MAC address:       34:98:7a:2b:51:00
Using 26MHz bootloader
App/part. size:    751,184/2,031,616 bytes, 36.97%
[2024-04-25T13:56:03Z INFO ] Segment at address '0x0' has not changed, skipping write
[2024-04-25T13:56:03Z INFO ] Segment at address '0x8000' has not changed, skipping write
[00:00:37] [========================================]     363/363     0x10000                                                          [2024-04-25T13:56:43Z INFO ] Flashing has completed!
Commands:
    CTRL+R    Reset chip
    CTRL+C    Exit

ESP-ROM:esp8684-api2-20220127
Build:Jan 27 2022
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd5c80,len:0x16bc
load:0x403acb70,len:0x974
load:0x403aeb70,len:0x297c
entry 0x403acb70
I (32) boot: ESP-IDF v5.1.2 2nd stage bootloader
I (32) boot: compile time Jan 16 2024 14:05:06
I (32) boot: chip revision: v1.0
I (37) boot.esp32c2: MMU Page Size  : 32K
I (44) boot.esp32c2: SPI Speed      : 30MHz
I (51) boot.esp32c2: SPI Mode       : DIO
I (59) boot.esp32c2: SPI Flash Size : 4MB
I (66) boot: Enabling RNG early entropy source...
I (74) boot: Partition Table:
I (80) boot: ## Label            Usage          Type ST Offset   Length
I (91) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (102) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (114) boot:  2 factory          factory app      00 00 00010000 001f0000
I (126) boot: End of partition table
I (132) esp_image: segment 0: paddr=00010020 vaddr=3fcaab10 size=013f0h (  5104) load
I (147) esp_image: segment 1: paddr=00011418 vaddr=40380000 size=06c00h ( 27648) load
I (169) esp_image: segment 2: paddr=00018020 vaddr=3c078020 size=354d0h (218320) map
I (246) esp_image: segment 3: paddr=0004d4f8 vaddr=40386c00 size=02b20h ( 11040) load
I (251) esp_image: segment 4: paddr=00050020 vaddr=42000020 size=76214h (483860) map
I (421) esp_image: segment 5: paddr=000c623c vaddr=40389720 size=013e8h (  5096) load
I (427) boot: Loaded app from partition at offset 0x10000
I (427) boot: Disabling RNG early entropy source...
I (452) cpu_start: Unicore app
I (452) cpu_start: Pro cpu up.
I (464) cpu_start: Pro cpu start user code
I (464) cpu_start: cpu freq: 120000000 Hz
I (464) cpu_start: Application information:
I (469) cpu_start: Project name:     libespidf
I (476) cpu_start: App version:      1
I (483) cpu_start: Compile time:     Apr 25 2024 21:54:59
I (493) cpu_start: ELF file SHA256:  0000000000000000...
I (502) cpu_start: ESP-IDF:          v5.1.3
I (509) cpu_start: Min chip rev:     v1.0
I (516) cpu_start: Max chip rev:     v1.99 
I (524) cpu_start: Chip rev:         v1.0
I (531) heap_init: Initializing. RAM available for dynamic allocation:
I (542) heap_init: At 3FCAD150 len 0002FA20 (190 KiB): D/IRAM
I (552) heap_init: At 3FCDCB70 len 0000294C (10 KiB): STACK/DRAM
I (564) spi_flash: detected chip: generic
I (570) spi_flash: flash io: dio
E (576) spi_flash: Detected size(2048k) smaller than the size in the binary image header(4096k). Probe failed.

assert failed: do_core_init startup.c:342 (flash_ret == ESP_OK)
Core  0 register dump:
MEPC    : 0x403819d6  RA      : 0x40385368  SP      : 0x3fcde5e0  GP      : 0x3fcab310  
0x403819d6 - panic_abort
...
Vollbrecht commented 5 months ago

If you are having a non-default sized esp, you need to tell espflash the value manual. You can do so with the --flash-size flag. Checkout the espflash flash --help output for more info

xiaguangbo commented 5 months ago

If you are having a non-default sized esp, you need to tell espflash the value manual. You can do so with the --flash-size flag. Checkout the espflash flash --help output for more info

Problem solved, thanks!