ESP32 Program Storage

Hi,

I've been using these ESP32 WROOM 32D boards for a couple of months now. I wasn't sure what settings to use in the Tools menu of the Arduino IDE so I just used the default ones that the IDE selected for me. When creating a small Bluetooth project the IDE Output stated that I've used 76% of program storage.

Sketch uses 1008897 bytes (76%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45604 bytes (13%) of dynamic memory, leaving 282076 bytes for local variables. Maximum is 327680 bytes.

A couple of weeks back, I tried adding the bluetooth and wifi libraries to an existing small project and it stated that I had exceeded the program storage (128%).

#include <WiFi.h>
#include <esp_wifi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <BLEAdvertisedDevice.h>

I began to lose faith in the boards until I came across this site. How To Use PSRAM
I changed my Tools settings in the Arduino IDE to the ones listed in the site and the difference was unliveable!!! My original Sketch (Above) stated that I used 76% of the program storage. Using the sites settings it now only uses 34% of program storage. A huge drop!!!

Sketch uses 1087373 bytes (34%) of program storage space. Maximum is 3145728 bytes.
Global variables use 45820 bytes (13%) of dynamic memory, leaving 281860 bytes for local variables. Maximum is 327680 bytes.

I'm currently playing around with a TFT ILI9341 Screen with an ESP32 WROOM 32D which is going well. Just out of curiosity, I added all of the Bluetooth and WiFi libraries and built the program again. Astonishingly, I'm only using 40%. These are in imported libraries:-

#include <lvgl.h>
#include <Arduino.h>
#include <TFT_eSPI.h>
#include <XPT2046_Touchscreen.h>
#include <WiFi.h>
#include <esp_wifi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <BLEAdvertisedDevice.h>
#include <Adafruit_GFX.h> // graphics library
#include <Adafruit_ST7789.h> // library for this display
#include <SPI.h>

The reason for this post is to inform other people, who use ESP32 WROOMs, and like me, we're thinking of never using them again because of the storage issues.

Now that I have updated my settings, I will not be using anything else but these ESP32 WROOM boards and the Arduino IDE in all of my future projects. I have just ordered another 6 of them and 3 ESP32 Super Mini Development Board with WiFi & Bluetooth.

1 Like

Thanks for the input, it should help many others.

The problem is not so much with the memory on the ESP32, but with the fact that the BlueTooth library is rather large. As you have discovered, the problem can be addressed by re-configuring the allocation of memory to assign more capacity to program storage but at the cost of reducing the size of the filesystem.

It's the wifi library that takes up a lot of memory, I'm using BLE and as a screen an old android phone (just as long as it has BLE) and you will save a lot of pins and power for the touch screen, in addition to the fact that it will be wired with ESP32, while if you use a phone you can make different Apps each for an Esp32 board with its sketch and peripherals.
Unfortunately adding ram on ESP is not as painless as adding it on a PC, you run into limitations.
Not if you saw my post where I use ESP32 and BLE ... I'll give you the link

PSRAM has nothing to do with program storage. It's extra SPI-interfaced RAM that's available for data storage. What does effect program storage is the "Partition Scheme" that divides available flash between program storage, OTA buffer, and file system.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.