Arduino RAM Overflow
heavy coding and with just another variable or after some seconds serial transmitting nothing works as used?
Could happen that you ran out of RAM, more special the SRAM as its called on the ATmega´s.
Lets digg into it and look how to get it sorted!
So something is totaly strange since your last compile? But the compiler gives no error?
You can already have overflow´s in the SRAM, or lets call it RAM from now on.
The Arduino uses the ATmega168 / ATmega328 / ATmega1280 / ATmega 2560, they all have different RAM Sizes:
|AVR Chip:||SRAM Size:|
But how much is already used?
First, we need to find the folder with the compiled files, in Arduino 20 and higher you have to open your temp folder.
If you hit compile on your Arduino IDE, the content in the right folder gets updated!
so now we have that, we need to open the command line on that folder
and type: "avr-size ***.elf" where the *** stands for your programm name
now we summ the BSS and DATA, in this case its 2068.
If its higher it means you will overflow, no warning will be given by the compiler but it will go crazy...
Here we have now a ATmega328, the programm does fit the EEPROM, but not the RAM!
To reduce your RAM Footprint, take a look at all your variables, can they be "const" ? or do you have large strings what are not in PROGMEM?
To find that out in detail, type: "avr-objdump -t -j .bss xxx.elf > C:\dump.txt" this will give you a list of all variables, as the output is quite large the last part from the command will print the output to C:\dump.txt, you could change this to whatever you like!
That will give you a list of al variables and functions and theyr sizes. There you can find the bad boys what are to big!
Hope it helped you a bit, check out arduino.cc Forums for more about Arduino!