Go Down

Topic: get 'not enough memory' on project that worked fine before ??? ide 1.8.4  (Read 365 times) previous topic - next topic



On a project that compiled and uploaded fine 3 to 6 months ago i suddenly get a warning in the IDE.
i use the arduino Leonardo ETH board.

Archiving built core (caching) in: C:\Users\xxxxxx\AppData\Local\Temp\arduino_cache_938716\core\core_arduino_avr_leonardoeth_62b369e08cb6d96005fea4df1b2f7b2e.a
Sketch uses 26152 bytes (91%) of program storage space. Maximum is 28672 bytes.

Global variables use 2656 bytes (103%) of dynamic memory, leaving -96 bytes for local variables. Maximum is 2560 bytes.
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
Error compiling for board Arduino Leonardo ETH.

the flash was always a bit high but this is still ok (91%)
but now the memory is suddenly 103% were it was fine before.

I'm using arduino 1.8.4

libraries used are:

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>      //! version 1.1.5
#include <Adafruit_SSD1306.h>  //! version 1.1.0

#include <EEPROM.h>
#include <Ethernet2.h>
#include <EthernetUdp2.h>   //! UDP library from: bjoern@cs.stanford.edu 12/30/2008
#include <Adafruit_ADS1015.h>  //! version 1.0.0  AD converter ADS1115

i tried to see if any file or library changed in 2018 but windows can't find it, (but perhaps the creation date is checked and the same?)
C:\arduino-1.8.4>forfiles  /S /D +01-01-2018
ERROR: No files found with the specified search criteria.

I tried compiling another old project and got the same problem.
A quick rough count tells me i use about 400bytes global memory, with 2560 available those libraries use quite a bit...

some questions:
1) is this a know issue?
2) anything updated this year that used 100+ more bytes/memory?
3) is there a way i can see were the memory is used?
4) anything i can try to point me in the right way? to solve this ?
5) i notice in the 'sketch' menu there is an option 'export compiled binary' that creates a .hex file. can a previous made .hex file be used in the arduino IDE to upload or do we need a atmel uploader/different software/hardware for that? Unfortunately i don't have a .hex yet for this project but it may be handy for future projects...

your help is much appreciated!


just copied my project to another pc (without changes), with IDE 1.8.2 and it compiled fine.
gives me...
uses 91% of program space
uses 83% of dynamic memory (leaving 431 bytes)

this is weird (i'm sure it worked on the ide 1.8.4 before.

if i have the time i'll copy the libraries back but since i can compile it now from the other pc, i'm happy enough.

I created the .hex files,  will google how to use those in the future.


Compare the versions of every library.

Find the one that is different. It's gotta be a different library version.... Maybe ethernet?

Ethernet and SSD1306 libraries are ram hogs.

Also - if you've ever used Board Manager to update the avr boards package, you need to look at that too - once you use board manager once for the avr board package, it no longer looks at the core in under the install directory - it's all under the arduino15 folder.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy


5) i notice in the 'sketch' menu there is an option 'export compiled binary' that creates a .hex file. can a previous made .hex file be used in the arduino IDE to upload
No, the Arduino IDE doesn't support doing that that.

or do we need a atmel uploader/different software/hardware for that?
You already have the software. It's named avrdude and it comes with the Arduino IDE. It's the tool the Arduino IDE uses to upload to your Leonardo ETH. The easiest way to learn how to use it is to do this:
File > Preferences > Show verbose output during: > upload (check) > OK
Upload any sketch to your Leonardo ETH.
After the upload finishes, scroll up the black console window at the bottom of the Arduino IDE window until you find the avrdude command the Arduino IDE used to do the upload.

You can copy that command, change the .hex file name to the one you want to upload, and run the avrdude command from the command line or a script/batch file. There is one important difference. When you upload to an ATmega32U4-based board like the Leonardo ETH, the Arduino IDE does a special process to reset the board and activate the bootloader before running the avrdude command. The way it works is the IDE opens the serial port at 1200 baud. That is a signal to the firmware on the ATmega32U4 to do a reset. After the reset the bootloader code runs. This creates a new virtual com port on your computer. The Arduino IDE waits for a new port to appear and then runs the avrdude command to upload to that port. When running the avrdude command outside of the Arduino IDE it's easier to just press the reset button on the Leonardo ETH before running the command. You should note that the com port of the bootloader will not be the same as the com port of the Leonardo ETH when in normal operation. The avrdude command you copy from the Arduino IDE will have the correct port but this port can change from time to time so you might need to update it occasionally.


And to answer your other question, no additional hardware is needed. If you want to use an ISP programmer to upload .hex files to your Leonardo ETH you can use avrdude for that also and then you don't need to worry about the whole reset/com port business. That could also free up 2 kB of flash memory that is taken up by the bootloader.


Another suggestion is to try turning on Load Time Optimisation.


Link time optimization is already on. All the Arduino AVR Boards versions that have the Leonardo ETH board also have LTO.

Go Up