I am running out of memory on the Orangutan SV-328 and need to add a little more code to complete the project. I probably only need to save 1 or 2% to be able to finish up. By the way, I used all the default compiler settings for AVRStudio 4 - so the optimization setting is -Os.
When I compile I get the following message:
Device: atmega328p
Program: 32746 bytes (99.9% Full)
(.text + .data + .bootloader)
Data: 1683 bytes (82.2% Full)
(.data + .bss + .noinit)
EEPROM: 936 bytes (91.4% Full)
(.eeprom)
Build succeeded with 0 Warnings…
I found an article on line that mentioned that uninitialized variables go into .bss and the vast majority of the variables I use are global arrays of uninitialized structures - so that should not cause program memory to fill up.
I have done several things to save program memory like: put static strings in EEPROM and reading them as needed, using a single file wide static char array variable for use in place of char array variables declared in local functions. I have removed all the unused code I can find and tried to use the fewest variables and the simplest approach to accomplishing a given task in the code.
The Pololu AVR library reference mentions that printf() for the LCD uses memory but I am not sure what to do about it. A lot of my code is related to running a necessarily simple-minded yet extensive user interface to configure the project. The resulting configuration info is saved in the global arrays mentioned above and in EEPROM for future use. Naturally, the menu uses printf() a lot.
Can you offer any suggestions?