Hi guys,
I've a code of which i want to run on Arduino Pro mini, but the space in Atemga328p-Au is not enough to hold my code it's showing me this error in console
Sketch uses 31,806 bytes (98%) of program storage space. Maximum is 32,256 bytes.
Global variables use 2,203 bytes (107%) of dynamic memory, leaving -155 bytes for local variables. Maximum is 2,048 bytes.
Maybe, depends on the nature of the data and it's use but external memory of any kind is not a good substitute for internal and often not a substitute at all.
I know it's a large program, but can you attach the file, it's quite likely that someone more experienced can point to areas that can be optimized.
You basically can't store variables or run code from external flash. The memory can only be used to store data. Like if you have a code with lots of messages being printed on the serial, those messages you ight be able to store on the Flash, but you'll need to also write some code and a buffer to read and print back to the user.
Have you tried to optimise your code already? Things like using uint8_t instead of unsigned int where it suits. Reducing the number of Serial.print, and using the F() macro as well.
Show us your code, maybe we can find a few hundred bytes of sram. Did you use the 'F()' macro ?
Did you try the newest Arduino IDE 1.6.10 ? It has -flto enabled by default, that makes smaller code and less usage of sram.
mudassir9999:
Hi guys,
I've a code of which i want to run on Arduino Pro mini, but the space in Atemga328p-Au is not enough to hold my code it's showing me this error in console
shall i use external flash memory.?
Please Help
Thanks
If you do not know what is causing your storage issues... just move up the product line to an Arduino Mega2560 or one of the 3rd party 1284 boards.
If you want to optimize the existing program, then DrAzzy/Koepel make good suggestions ... start reading and studing coding techniques.
Hello Guys thank you for your replies
I've optimized my code upto my levels now it's using
Sketch uses 27,434 bytes (85%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,853 bytes (90%) of dynamic memory, leaving 195 bytes for local variables. Maximum is 2,048 bytes.
But still there's a problem of stability
@Crosswords thank you for your suggestion, Can i have a bootloader of it on internet.?
"Can i have a bootloader of it on internet.?"
I don't know what that means.
I bootload the chips before I send them.
You can add 1284P to the IDE for programming, check out how here https://forum.arduino.cc/index.php?topic=402335.0