Code stepping on bootloader port

I've had this issue with both a Arduino Leo and an A-Star 32U4 Prime SV.
Have attached the code.

The code displays a face and text on a SSD1306 OLED 128x64 screen thru the i2C bus. It is based on some C code I wrote for the TI CC3200 many years ago that is still working on those platforms.
The issue is, if I activate the text section and the eyes section of the code at the same time the process shows random pixels on the screen, locks up the process and breaks the bootloader port. I can run one or the other without a problem, but they won't run at the same time.

sketch_jun26a.zip (6.9 KB)


The forum supports code tags. Please take some time to read the sticky posts at the top of every forum subsection on how to properly ask questions and post the things members need to understand the problem you’re trying to solve.

Perhaps it is a mistake to include the null terminator in the text being displayed?

  //Text
  char tp[] = "Hi I'm Leo";
  int x = sizeof (tp);  ////// Includes the null
  TextByPosition(led_addr, tp, x, 0xB7, 0xB7, 0, 0, 1);

I would try this to see if it helps:

  //Text
  char tp[] = "Hi I'm Leo";
  TextByPosition(led_addr, tp, strlen(tp), 0xB7, 0xB7, 0, 0, 1);

Thanks for the reply. I tried using strlen and it still breaks.
The text processing function handles the \0 array ending anyway.Plus the text code runs, except when the eyes code is included.
I even wrote another quick sketch that randomly positions the text on the screen in the loop section and it runs as expected.
The "code breaking the bootloader port" seems to be a "feature" of the whole system.
I've seen posts and solutions starting several years ago to the present, on almost all the boards.
I am just starting out playing around with the Arduino platforms, though I've been writing code in C for RTOS for embedded systems for decades.
Any other suggestions are welcome.

@kms3156, your topic has been moved to a more suitable location on the forum.

You can upload code, so I'm not quite sure why this relates to Avrdude, stk500, Bootloader issues :wink: