Uploading problem


I suddenly have a problem uploading my latest game. It looks like I overwrite the bootloader. Is it possible?

When compiling:
“Sketch uses 17568 bytes (61%) of program storage space. Maximum is 28672 bytes.
Global variables use 2083 bytes (81%) of dynamic memory, leaving 477 bytes for local variables. Maximum is 2560 bytes.
Low memory available, stability problems may occur.”
and after it tries to upload:
“An error occurred while uploading the sketch”

When using flashlight mode, I have no more problem uploading, but it is still annoying especially when I’ll want to share it with the community.

Source is here: https://github.com/skaterced/Twotris
I was adding stuff in “menu.cpp” when it happened.

Thank you in advance for your help

1 Like

I’ve just tested it.

I’m not sure it’s not overwriting the bootloader because as you say ‘flashlight’ mode still works for uploading,
it’s probably just the problem that happens sometimes when games push the memory limit.

The easiest solution is to wrap all your printed strings in the F macro because that will keep them in progmem and out of RAM.

E.g. instead of:

  ab.println("Move until you reach");
  ab.println("a border to change");
  ab.println("moving direction");


  ab.println(F("Move until you reach"));
  ab.println(F("a border to change"));
  ab.println(F("moving direction"));

Doing that to menu.cpp alone was enough to get RAM usage back down to 1803,
and it fixes the problem in the process.

By the way, try this:

ab.println(F("    C" "\x82" "dric Martin"));

It should display “Cédric Martin” instead of “Cedric Martin”.


If you can always upload using flashlight mode then your sketch is likely experiencing the problem with overwriting the bootloader “magic key” in RAM, especially since your sketch uses so much RAM. There’s not much you can do about it with a standard Arduboy. Reducing or rearranging RAM use may fix it but there’s no guarantee from release to release, including library and Arduino IDE releases.


It works perfectly.
Thank you very much :slight_smile:

1 Like