I have been working with my Mega 2560 board for few weeks without problem. Now my program together with some audio data stored as constant table in the program memory has exceeded 80 kB. When I downloaded the program to my Mega2560 board, it seemed that the downloading was successfully completed, but when the program run, it just crashed.
I was wondering around for sometimes and tried reducing the program size. The magic boundary of the program size is about 75kB, below that it works, above that can't..
- Is there any limit in program size for the boot loading of Mega2560, which has indicated a maximum size of 258,048 bytes? The program crashed just after loaded, even the very first line code was not executed. So I guess the jump vector to the start of program code may be incorrect.
- I declared an unsigned char array PROGMEM for storing audio samples. Although each array size is less than 64kB, I have a few audio clips (tables) so the total size may exceed 64kB. The compiler doesn't complaint about this. So would that be the source of problem? I tried to move the tables in various positions of the program code, it’s still the same.