ESP32 memory size not changing after upgrade

Hi All,
I was using a ESP32-WROVER-IB(4MB) with 4MB flash but started to run out of room.
I changed over to the ESP32-WROVER-IE(16MB) and modified my platformio.ini and board definition file to reflect the change.

Any ideas why the compiler does not reflect the change in memory size?

Thanks,
Neil.

Platformio.ini

[env]
platform = espressif32
board = PPKME_ESP32_16MB
framework = arduino
etc etc

PPKME_ESP32_16MBx.json

{
  "build": {
    "arduino":{
      "ldscript": "esp32_out.ld",
      "partitions": "default_16MB.csv"
    },
    "core": "esp32",
    "extra_flags": "-DARDUINO_ESP32_THING_PLUS",
    "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": "PPKME 16MB Flash with OTA and spiffs",
  "upload": {
    "flash_size": "16MB",
    "maximum_ram_size": 327680,
    "maximum_size": 16777216,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://www.ppk.com",
  "vendor": "PPKME"
}

default_16MB.csv

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x640000,
app1,     app,  ota_1,   0x650000,0x640000,
spiffs,   data, spiffs,  0xc90000,0x370000,

Compiler output

Processing Serial (platform: espressif32; board: PPKME_ESP32_16MB; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/PPKME_ESP32_16MB.html
PLATFORM: Espressif 32 (3.5.0) > PPKME 16MB Flash with OTA & spiffs
HARDWARE: ESP32 240MHz, 320KB RAM, 16MB Flash
..............
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  20.1% (used 65744 bytes from 327680 bytes)
Flash: [======    ]  59.4% (used 1245206 bytes from 2097152 bytes)
Building .pio\build\Serial\firmware.bin
esptool.py v3.1
Merged 1 ELF section

Upload output

Serial port COM3
Connecting....
Chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 34:86:5d:18:f9:18
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 16MB

You’re referencing a different board = .. here than the board file is named?

Hi Max,
Sorry, my bad. The filename does not have an x at the end as I depicted. I was trying to determine what the root folder(?) of the project was by renaming files and looking for compiler errors.
I had created that file in the “C:\Users\Neil.platformio\platforms\espressif32\boards” folder and had it deleted by a platform update, so I was trying to find where else I could locate this file and the partitions file so that it stayed with the project and not deleted by a platformio update.
From the platformio documentation

Example
; 1) A “partitions_custom.csv” in the root of project directory
[env:custom_table]
board_build.partitions = partitions_custom.csv

By the way, still try to determine the project root folder??
Is this where the platformio.ini file is located?

P.S. The memory sizing problem still exists.

Thanks,
Neil.

I can’t reproduce your problem. If I create a very minimal project with a boards/ folder that has the exact above PPKME_ESP32_16MB.json file and I write the platformio.ini as

[env:PPKME_ESP32_16MB]
platform = espressif32
board = PPKME_ESP32_16MB
framework = arduino

with src\main.cpp as

#include <Arduino.h>
void setup(){}
void loop(){}

I get the compilation result

Checking size .pio\build\PPKME_ESP32_16MB\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.0% (used 13224 bytes from 327680 bytes)
Flash: [          ]   3.1% (used 201212 bytes from 6553600 bytes)
Building .pio\build\PPKME_ESP32_16MB\firmware.bin

and that 6.5MByte is the correct partition sizes for app0.

So, that works nicely.

I would recommend to delete any custom boards in the platform/espressif32 folder and try to create a minimal project with the project-local board JSON file.

Hi,
Ok, I found the issue. In the platformio.ini file, the below line overrode the board definition.
board_build.partitions = no_ota.csv
Comment out this line and I get the correct memory allocation. Thanks for your help.

A separate question:
I copied the board file and placed it beside the platformio.ini file, then renamed it from “PPKME_ESP32_16MB.json” to “fred.json”.
I then put in my ini file “board = fred”

platformio.ini

[env]
platform = espressif32
board = fred
;board = PPKME_ESP32_16MB
;board = esp32dev
framework = arduino

Compiling gives me “Error: Unknown board ID ‘fred’”.
As per an earlier post, where can I place my board file with the project so that it doesn’t get deleted during a platformio update?

image

Ok, so what was throwing me off was that the memory partition file can sit in the root project folder and be easily referenced in the platformio.ini file as
board_build.partitions = PPKME_16MB.csv

But! The board file has to sit in it’s own project folder “boards”
So I put PPKME_ESP32_16MB.json and PPK_16MB.csv into the boards folder, then changed the platformio.ini file to look like this:

[env]
platform = espressif32
framework = arduino
board = PPKME_ESP32_16MB
board_build.partitions = boards/PPKME_16MB.csv
monitor_port = COM3

That way customization files are all together.
image
image

Then I started to look at pins_arduino.h and went, this is getting to complicated. The new pins… file needs to be in a project patches folder?? Are the above new board and memory partition information also not patches but are not required to go into a patches folder???

Thanks for your help Max in assisting me to understand the layouts.
I documented the above findings/config to assist others going down this path.