iBeacon-indoor-positioning-demo icon indicating copy to clipboard operation
iBeacon-indoor-positioning-demo copied to clipboard

Latest ESP32 libraries too big, uses 119% of memory

Open jarkko-hautakorpi opened this issue 6 years ago • 14 comments

Sketch can be compiled using older library versions (uses 94%):

Linking everything together...
Multiple libraries were found for "WiFi.h"
 Used: /home/jarkko/Arduino/hardware/espressif/esp32/libraries/WiFi
Multiple libraries were found for "BLEDevice.h"
 Used: /home/jarkko/Arduino/libraries/ESP32_BLE_Arduino
Using library WiFi at version 1.0 in folder: /home/jarkko/Arduino/hardware/espressif/esp32/libraries/WiFi 
Using library PubSubClient at version 2.6 in folder: /home/jarkko/Arduino/libraries/PubSubClient 
Using library ESP32_BLE_Arduino at version 0.4.7 in folder: /home/jarkko/Arduino/libraries/ESP32_BLE_Arduino 
Sketch uses 1234222 bytes (94%) of program storage space. Maximum is 1310720 bytes.
Global variables use 77392 bytes (26%) of dynamic memory, leaving 217520 bytes for local variables. Maximum is 294912 bytes.

How to build using older libraries?

Solution1: Checkout old version of ESP32 libraries and rebuild sketch.

  1. cd ~/Arduino/hardware/espressif/esp32
  2. git checkout 52d47054
  3. git submodule update --init --recursive &&
    cd tools &&
    python2 get.py
  4. Start/restart Arduino IDE and rebuild sketch

Solution2: You got any ideas? Please comment.

jarkko-hautakorpi avatar May 13 '18 12:05 jarkko-hautakorpi

I have solution for this, you just need to edit Boards.txt in esp32 hardware directory in your arduino IDE. please email me for further information

rishaldyprisly avatar Jul 28 '18 08:07 rishaldyprisly

Sketch uses 1394890 bytes (40%) of program storage space. Maximum is 3407872 bytes. Global variables use 98032 bytes (33%) of dynamic memory, leaving 196880 bytes for local variables. Maximum is 294912 bytes.

programmer131 avatar Oct 03 '18 11:10 programmer131

@programmer131 Is this with the latest version of ESP32 Libraries? I have not tried re-compiling for a while with updated libs. edit: wait, you have more memory in your ESP32?

jarkko-hautakorpi avatar Oct 04 '18 13:10 jarkko-hautakorpi

@programmer131 you can fix that by edit the memory size at board.txt inside Arduino directory.

@jarkko-hautakorpi i have several problem when running your script in React.

rishaldyprisly avatar Oct 05 '18 02:10 rishaldyprisly

edit: wait, you have more memory in your ESP32?

yes, i don't have any issue in compiling, it is all perfect, but I had only single esp32, ordered 6 more, will test tomorrow with at least 3 esp32 stations.

programmer131 avatar Oct 05 '18 17:10 programmer131

To get more space for your sketch you need :

  • to modify the partitions ( for details https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/partition-tables.html ) -to modify board.txt accordingly

step by step on Windows10 with in your local installation C:\Users\xxx\xxx\Arduino\hardware\espressif\esp32\tools\partitions image

you can see the file default.csv which need to be modified you can also see other file which could fit your needs, one has no ota anotherone has ota and small spiffs In our case the best is "min_spiffs" that gives 2mb for sketch and you can still use OTA, and ble wifi, mqtt, string, works fine copy your default.csv in default.old
duplicate the min_spiffs.csv and rename it to the "default.csv" As you can see in the partition table You have size is in hex, it is 1E0000.

You need to put this value to the boards configuration file that is under: C:\Users\xxxxx\xxxx\Arduino\hardware\espressif\esp32 You need to find your board in the file , and change the upload.maximum_size from the default to the new amount, in my case it is 1E0000, but you cannot put it there in hex, You need to change it to dec so for 1E0000 you will get 1966080 So for my board DOIT DEVKIT V1 it should look like this: esp32doit-devkit-v1.upload.maximum_size=1966080 Restart arduino IDE, compile the skecth and you see that you have the space required and even more ..

Mikx5 avatar Oct 06 '18 13:10 Mikx5

@rishaldyprisly Why would we need to email you? Why not post your solution here? How is this in the spirit of FOSS?

RobThree avatar Oct 21 '18 22:10 RobThree

because im still have a research on it, im affraid if i post the solution in here, it will messed up someone else work, kind of need to discuss more, as you guys a professional programmer.

rishaldyprisly avatar Oct 22 '18 02:10 rishaldyprisly

Jus post what you have and add a disclaimer it may not work or what risks are involved. We're big boys and girls and can decide for ourselves if we want to try your solution or not. Also: you work should be backed up always anyways so I don't see the problem.

RobThree avatar Oct 22 '18 06:10 RobThree

anyone successful in solving this problem? i am running the ide on osx

RogierQ avatar May 29 '19 19:05 RogierQ

tried all options with old and new versions and all partition settings, all without any succes :-( any help is more then welcome!

RogierQ avatar May 29 '19 22:05 RogierQ

My first comment "How to build using older libraries?" is one solution. Just use old version, everything works in it. https://github.com/jarkko-hautakorpi/iBeacon-indoor-positioning-demo/issues/1#issue-322589407

jarkko-hautakorpi avatar Jun 22 '19 19:06 jarkko-hautakorpi

I solved this error

"Sketch uses 1467630 bytes (111%) of program storage space. Maximum is 1310720 bytes. Global variables use 66016 bytes (20%) of dynamic memory, leaving 261664 bytes for local variables. Maximum is 327680 bytes. Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it. Error compiling for board WEMOS LOLIN32."

by changing partition scheme from 'default' to 'no OTA (Large App)' under

tools>Partition Scheme:

muathime avatar Jul 08 '19 12:07 muathime

am using Arduino 1.8.9 board WEMOS LOLIN32

muathime avatar Jul 08 '19 12:07 muathime