Esp32 flash size in menuconfig doesn't work

Hi,
I want to set flash size of my project from 4MB in 8MB, but it doesn’t change!!

This is the Setup in menuconfig:

This is the error:

Can someone help me?

1 Like
  • Whats your full platformio.ini? You should also a board = .. setting which has a 8MB flash chip then.
  • Have you updated your platforms? (E.g. via Update platforms & packages)

I’ve update platform and packages as you suggest, but it doesn’t change anything.

This is my platformio.ini:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
board_build.embed_txtfiles = src/certs/ca_cert.cer
board_build.partitions = partitions.csv

For what it’s worth… the esp32dev board by default has 4MB Flash… so that may not be a good start! :open_mouth: I’m not familiar with the ESPIDF, so I don’t know if that would cause that particular compile-time error message.

The Heltec WiFi LoRa 32 (V2) has 8MB of flash… maybe just try using heltec_wifi_lora_32_V2 as the board type as a test, and see if the error changes / goes away. If that doesn’t work, I’ll leave it to those who do know to help you further! :wink:

Hi @pfeerick thank you for your reply. Now it works!

I have another questions: what is the utility of menuconfig if the settings aren’t respected.
Maybe the platformio.ini is on top of menuconfig always and in anycase?

Thank you

Excellent! If you don’t mind, can you see if board_upload.flash_size=8MB with board = esp32dev works instead then? Yes, platformio.ini would be the base configuration, and then menuconfig on top of that. So if the underlying configuration is wrong, nothing you do in menuconfig would override that. Or that how I’m guessing it works! :slight_smile:

Thank you for your reply. So, I must set a different board in base of my module flash size in platformio.ini.

However, If I set board_upload.flash_size=8MB with board = esp32dev it doesn’t still work.

Actually I’m using a Wroom32D (8MB) on a custom board, it is possibile, in future, to add it on boards section in Platformio where the user can set the flash size. Would it be more correct?

1 Like

Maybe the other setting is missing as well:

board_upload.maximum_size=8388608

but these are workarounds anyways.

PlatformIO already has the feature that you can add your board JSON file to the board/ folder of the project (docs), for custom private projects.

If it’s something big commercial of course, it can be added to the list of globally known boards.

1 Like

I faced exactly this puzzle. The solution suggested by @maxgerhardt resolved it for me. I needed both board_upload.flash_size = 8MB and board_upload.maximum_size = 8388608. (I wasn’t using menuconfig. I was fiddling directly with platformio.ini.)

1 Like

Hi
I also faced this problem with Wroom32D.
The error almost disapeared following @maxgerhardt instructions.
But, looking at the transcript windows gives me the following error

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" Error: The program size (1377954 bytes) is greater than maximum allowed (1310720 bytes) RAM: [== ] 18.0% (used 59028 bytes from 327680 bytes) Flash: [===*** [checkprogsize] Explicit exit, status 1 =======] 105.1% (used 1377954 bytes from 1310720 bytes) esptool.py v3.0

Same error but in different color… what to think about it??
Is this bug not fixed yet?

1 Like

Above information may be incorrect – you primarily need to give PlatformIO and ESP-IDF (I assume you’re using that instead of Arduino since this topic is about ESP-IDF) the right partition table. Not via “flash size” in the menuconfig. That is a parameter that’s being used for esptool during flashing, not during build.

Read Unable to build and upload SPIFFS filesystem image with framework esp-idf - #3 by maxgerhardt up until the line “And I quit-and-save out of that”, it shows how to set a partition file and also an example partition. You will surely want a different partition file or adapted sizes per Espressif 32 — PlatformIO latest documentation.

Also see Problem compiling idf + arduino.

Ahhh sorry, did not think about the thread title. Maybe my question should be moved.
I am using Arduino. This is my .ini file

[global]
lib_deps = ${global.lib_deps}
	marvinroger/AsyncMqttClient @ ^0.8.2
boards_dir =  C:\Users\lglin\OneDrive\hostedProjects\iot\smartplug-m001
board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608

[env:esp32-Serial]
platform = espressif32
board = ESP32Wrom32D
framework = arduino
lib_extra_dirs = C:\Users\lglin\OneDrive\hostedProjects\iot\library
build_flags = -Os
monitor_port = com6
upload_port = com6
monitor_speed = 115200
lib_deps = marvinroger/AsyncMqttClient@^0.8.2

Then I’d suggest you add the line

board_build.partitions = default_8MB.csv 

For a partition table that has 1.6MB SPIFFS partition and two app partitions (for OTA) with circa 3.2MB size each. See the Arduino partition table in the docs as linked above. You can also create arbitrary partition tables yourself if that configuration is not what you want.

Thanks for extremly fast response.

Unfourtnatly it made no difference.
I get this error.

    Building .pio\build\esp32-Serial\firmware.bin
Checking size .pio\build\esp32-Serial\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
Error: The program size (1377954 bytes) is greater than maximum allowed (1310720 bytes)
RAM:   [==        ]  18.0% (used 59028 bytes from 327680 bytes)
*** [checkprogsize] Explicit exit, status 1
Flash: [==========]  105.1% (used 1377954 bytes from 1310720 bytes)
esptool.py v3.0
============================================================================================================================================================================================================== [FAILED] Took 20.90 seconds ==============================================================================================================================================================================================================The terminal process "C:\Users\lglin\.platformio\penv\Scripts\pio.exe 'run', '--environment', 'esp32-Serial'" terminated with exit code: 1.

I have created a custom board file. Looks like this. Is there anything wrong in this.

 {
"build": {
  "arduino":{
    "ldscript": "esp32_out.ld"
  },
  "core": "esp32",
  "extra_flags": "-DARDUINO_ESP32_DEV",
  "f_cpu": "240000000L",
  "f_flash": "40000000L",
  "flash_mode": "dio",
  "mcu": "esp32",
  "variant": "esp32"
},
"connectivity": [
  "wifi",
  "bluetooth",
  "ethernet",
  "can"
],
"debug": {
  "openocd_board": "esp-wroom-32.cfg"
},
"frameworks": [
  "arduino",
  "espidf"
],
"name": "WROOM-32D DEV MODULE",
"upload": {
  "flash_size": "8MB",
  "maximum_ram_size": 327680,
  "maximum_size": 8388608,
  "require_upload_port": true,
  "speed": 460800
},
"url": "https://en.wikipedia.org/wiki/ESP32",
"vendor": "Consius"

}

Not reproducable. Using your JSON file as boards/esp-wroom-32d.json content and doing a standard platformio.ini of

[env:esp-wroom-32d]
platform = espressif32
board = esp-wroom-32d
framework = arduino
board_build.partitions = default_8MB.csv

with a blinky code will result in

Checking size .pio\build\esp-wroom-32d\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.5% (used 14700 bytes from 327680 bytes)
Flash: [=         ]   6.3% (used 209795 bytes from 3342336 bytes)
esptool.py v3.0
======================= [SUCCESS] Took 25.55 seconds =======================

which his correct, the partition table states around 3,2 MB for the APP0 size.

Okay, now it works.
I had placed " board_build.partitions = default_8MB.csv " in the wrong place… :frowning:

Many thanks, need a second eye after looking at a problem to long :slight_smile:

@lgLindstrom
Hello, can you share your “platformio.ini” and your “defualt_8MB.csv” to see how you make it work ? :smiley: