Not able to use full flash for ESP32-C3-MINI-1U

I have a ESP32-C3-MINI-1U, and I’m trying to build a sample for this board it’s on. The build fails right at the end because of the flash used:

Checking size .pio\build\ESP32-2424S012\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====Error: The program size (2866476 bytes) is greater than maximum allowed (1310720 bytes)
===*** [checkprogsize] Explicit exit, status 1
  ]  80.3% (used 263212 bytes from 327680 bytes)
Flash: [==========]  218.7% (used 2866476 bytes from 1310720 bytes)

This processor should have 4MB flash, so this size should be totally fine.

The board JSON (custom) is as follows:

{
    "build": {
      "arduino":{
        "ldscript": "esp32c3_out.ld"
      },
      "core": "esp32",
      "f_cpu": "160000000L",
      "f_flash": "80000000L",
      "flash_mode": "qio",
      "extra_flags": "-DARDUINO_ESP32C3_DEV",
      "mcu": "esp32c3",
      "variant": "esp32c3"
    },
    "connectivity": [
      "wifi",
      "bluetooth"
    ],
    "debug": {
      "openocd_target": "esp32c3.cfg"
    },
    "frameworks": [
      "arduino",
      "espidf"
    ],
    "name": "ESP32-2424S012 (ESP32-C3-MINI-1U)",
    "upload": {
      "flash_size": "4MB",
      "maximum_ram_size": 327680,
      "maximum_size": 4194304,
      "require_upload_port": true,
      "speed": 460800
    },
    "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html",
    "vendor": "Espressif"
  }

I can’t figure out where I’m going wrong to enable the use of 4MB flash, or I’m really misunderstanding something.

Doesn’t seem relevant, but here is my platformio.ini:

[env:ESP32-2424S012]
platform = espressif32
board = ESP32-2424S012
framework = arduino
build_flags = -D LV_CONF_PATH=my_lv_conf.h -I lib
lib_deps = 
	lovyan03/LovyanGFX@^1.1.12
	lvgl/lvgl@8.3.6

You need to speficy another partition layout, because the default partition layout has only 1.2MB App.
You can try huge_app.csv which will give you 3MB App, 1 MB SPIFFS but no OTA.

board_build.partitions = huge_app.csv

For more information about partition layout, please see Espressif 32 — PlatformIO latest documentation

1 Like

Thank you, that worked perfectly! I was totally unaware of the partition layout functionality, whoops.

1 Like