I am using the following program, testing how much I will be able to save in PROGMEM on an Arduino Mega 2560:
// initially I set up 824 PROGMEM strings and then a string table linking to them - I have excluded most of them for easier reading.
const char string_1[] PROGMEM = "This is example of long string number 1ARROOCHICHA ARROOCHICHA ARROOCHICHACHA";
const char string_2[] PROGMEM = "This is example of long string number 2ARROOCHICHA ARROOCHICHA ARROOCHICHACHA";
//............................ All numbers in between included in here...............................
const char string_824[] PROGMEM = "This is example of long string number 824ARROOCHICHA ARROOCHICHA ARROOCHICHACHA";
PGM_P const string_table[] PROGMEM =
{
string_1,
string_2,
//............................ All numbers in between included in here...............................
string_824
};
void setup() {
Serial.begin(9600); // open the serial port at 9600 bps:
}
void loop() {
char buffer[78];
for (unsigned long i = 0; i < 999; i++){
strcpy_P(buffer, (PGM_P)pgm_read_word(&(string_table[i])));
Serial.print(buffer);
Serial.print('\n');
}
}
The problem is that it no longer compiles at this point as the number of bytes stored in PROGMEM at this point would be above 65536.
It reports:
"C:....\Temp\cckwAwy9.s: Assembler messages:
C:....\Temp\cckwAwy9.s:4699: Error: value of 65734 too large for field of 2 bytes at 65812
C:....\Temp\cckwAwy9.s:4700: Error: value of 65656 too large for field of 2 bytes at 65814
C:....\Temp\cckwAwy9.s:4701: Error: value of 65578 too large for field of 2 bytes at 65816"
Can anyone tell me why this is not compiling correctly at this point, and if I will be able to extend it to greater PROGMEM, or if PROGMEM is limited to 65536 bytes?