Due to lack of space (many additional functions), I'm changing old GPS project C/C++ source for ATmega328p to ATmega2560. The old prototype on 328p worked stable (4800 baud software serial tied with GPS module and 115200 baud hardware from device to PC).
Now project with ATmega2560 become unstable reseting irregularly. Possibly because one (or both) of the facts:
1. New code use only hardware USARTs
2. Entire code is now > 64Kb
Arduino software 1.8.5 is used, 16Mhz crystal, stable battery power supply 5V.
Main functionality is to use interrupt on receiving NMEA data from GPS module and place it to circular buffer, then resend to PC in main loop. GPS baud is configurable from default 4800 to 115200 and configurable with PC by default 115200.
In order to eliminate cause of the reset, I can suppose situation when one USART module start to receive data from GPS module in the same time main loop send data to PC through other. In that case receive interrupt may happens during sending data by other USART module, causing reset.
Is this scenario actually possible?
What would be the safe protocol using multiple hardware USARTs including proper BAUD rates?
Regarding program memory > 64K. The whole firmware now have 130Kb. The reset or corruption actually may be caused by some bug in GCC or used Arduino libs (for instance stored PROGMEM data read without far extension, or not properly calling functions from different 64Kb blocks), however that is another issue irrelevant for this topic...