Just sharing my own experiences while reducing the flash size of our Beat707 software.
Here's a fun chart I created while playing around with some changes. ;-)
Start: Flash = 27936 - Memory = 334
Removed OK (Print) Flash = 27930 - Memory = 330
Removed OK (Write) Flash = 27932 - Memory = 334
Removed dmNote XT Flash = 27516 - Memory = 333
Removed more LCD Print Flash = 27486 - Memory = 343
Removed more LCD Print Flash = 26926 - Memory = 361
Fixed Bad LCD code Flash = 26906 - Memory = 361
Changed INIT Values Flash = 26934 - Memory = 362
Changed Note Names Flash = 26818 - Memory = 362
Changed lcd.print Flash = 26168 - Memory = 386
The biggest change was to remove all Serial.print and replace with Serial.write. Keep in mind that to use write(0) you need to do this:
Serial.write((byte)0);
Another big change was to change the way we store Strings in the Prog Flash, how to read, and also to get rid of lcd.print and use lcd.write with our own functions. I will post the functions below.
void lcdPrint(uint8_t pos)
{
uint8_t c;
char* p = (char*)pgm_read_word(&(stringlist[pos]));
while (c = pgm_read_byte(p)) { lcd.write(c); p++; }
}
void lcdPrintString(char* string)
{
uint8_t p = 0;
while (string[p] != 0) { lcd.write(string[p]); p++; }
}
void lcdPrintNumber(uint8_t number)
{
lcd.write('0'+(number/10));
lcd.write('0'+(number-((number/10)*10)));
}
void lcdPrintNumber3Dgts(uint8_t number)
{
if (number >= 200) { lcd.write('2'); number -= 200; }
else if (number >= 100) { lcd.write('1'); number -= 100; }
else lcd.write('0');
lcdPrintNumber(number);
I will also post the code for the String List which the above functions uses...
Hope this helps someone else too. 8)
Best Regards, WilliamK