Reputation: 11
I don't have much experience with programming besides the basics but i'm programming a sequence of lights to turn on and off when a certain time is reached. However I keep getting program memory usage overflow:
Program Memory Usage :2066 bytes 100.9 % Full (Memory Overflow) Data Memory Usage : 1 bytes 0.8 % Full
can anyone point me in the right direction to what this means and how to deal with it?
Upvotes: 1
Views: 2342
Reputation: 21
you must use PROGMEM
#include "avr/pgmspace.h"
const char s[] PROGMEM = { 0,0,0,0,0,0,0,0,0,0,0,0,0};
and read massive
a=pgm_read_byte(s+1(or 2,0,1,3,4,5...) );
Upvotes: 2
Reputation: 50
You can change the level of optimization for your code in the project options and optimize for size.
In Atmel Studio select Project -> YourProjectName Properties... -> Toolchain -> Optimization -> Optimization Level: Optimize for size (-Os).
This should reduce your code footprint, however it may have a negative impact on timing, but I assume in your application microseconds are not crucial.
I have not seen your code but I suggest you should rather look into design of your application. For such a simple task the program memory available should be sufficent, especially when less than 1% of RAM is used.
Upvotes: 0