ESP32-C3 platformio arduino framework run-time error with 2MB flash

pataga
Posts: 73
Joined: Sat Aug 12, 2017 5:53 am

ESP32-C3 platformio arduino framework run-time error with 2MB flash

Postby pataga » Tue Oct 03, 2023 5:50 am

I have an ESP32-C3 AI thinker module with 2MB flash. I have used this before with platformio and arduino framework (worked fine about a year ago).

But now I get the following run time error complaining about the detected flash size 2MB being smaller than the binary image (4MB).

Code: Select all

ELF file SHA256: bfb337d64580b7e5

E (526) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
Rebooting...
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x403819b6
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x918
load:0x403ce710,len:0x24e4
entry 0x403cc710
E (167) spi_flash: Detected size(2048k) smaller than the size in the binary image header(4096k). Probe failed.

assert failed: do_core_init startup.c:326 (flash_ret == ESP_OK)
Core  0 register dump:
MEPC    : 0x40381df6  RA      : 0x403871c0  SP      : 0x3fcde190  GP      : 0x3fc8e800  
TP      : 0x00000000  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130  
S0/FP   : 0x3fcde2ff  S1      : 0x00000088  A0      : 0x3fcde1f4  A1      : 0x3fc90d0d  
A2      : 0x00000001  A3      : 0x00000029  A4      : 0x00000001  A5      : 0x3fc97000  
A6      : 0x7a797877  A7      : 0x76757473  S2      : 0x3fcde1e8  S3      : 0x00000001  
S4      : 0x3fcde1e8  S5      : 0x4201129c  S6      : 0x42000020  S7      : 0x3c090020  
S8      : 0x00010020  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938  
MSTATUS : 0x00001801  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000  
MHARTID : 0x00000000  
This is the successful build log

Code: Select all

Linking .pio/build/esp32c3/firmware.elf
Retrieving maximum program size .pio/build/esp32c3/firmware.elf
Checking size .pio/build/esp32c3/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.2% (used 33556 bytes from 327680 bytes)
Flash: [====      ]  35.6% (used 699800 bytes from 1966080 bytes)
Building .pio/build/esp32c3/firmware.bin
esptool.py v3.3
Creating esp32c3 image...
Merged 2 ELF sections
Successfully created esp32c3 image.
partitions.csv

Code: Select all

# Name,  Type, SubType, Offset,   Size,  Flags
# NVS : 24,576 bytes
# Factory app partition : 1,966,080 bytes
# LittleFS partition : 65,536 bytes
nvs,      data, nvs,      0x00009000, 0x00006000,
phy_init, data, phy,      0x0000F000, 0x00001000,
factory,   app,  factory, 0x00010000, 0x001E0000,
spiffs,   data, spiffs,   0x001F0000, 0x00010000,
platformio.ini

Code: Select all

[env:esp32-c3-devkitm-1]

platform = https://github.com/platformio/platform-espressif32.git
platform_packages = 
	platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
  
framework = arduino
board = esp32-c3-devkitm-1
board_build.flash_mode = qio
board_build.partitions = partitions.csv
board_build.filesystem = littlefs
board_build.f_cpu = 80000000L
board_build.f_flash = 40000000L

Has something changed in the last year ? Is there some way to specify the flash size in the platformio.ini file ? I can't find any other platformio supported ESP32-C3 board or module so I assumed just the partitions.csv file would be sufficient to specify a 2MB binary image.

BTW, I can flash and run example sketches without a problem using the Arduino IDE 1.8.19 after selecting the 2MB flash menu option for ESP32-C3.
Last edited by pataga on Tue Oct 03, 2023 6:03 am, edited 1 time in total.

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32-C3 platformio arduino framework run-time error with 2MB flash

Postby lbernstone » Tue Oct 03, 2023 5:55 am

board_upload.flash_size=2MB

pataga
Posts: 73
Joined: Sat Aug 12, 2017 5:53 am

Re: ESP32-C3 platformio arduino framework run-time error with 2MB flash

Postby pataga » Tue Oct 03, 2023 6:07 am

board_upload.flash_size=2MB
Thanks a lot !

Who is online

Users browsing this forum: No registered users and 158 guests