Ok this will sound like I am crazy, an idiot or both. I am attempting to make a "print" library for my embedded program. So I got a hard coded ascii font (8x8 bits) to render it. I started playing around with the idea of scaling the text up since 8x8 bits is a little small for my current resolution, then weird things started to happen.

This is exactly what is going on right now. As a test I am first drawing a white rectangle, and then on top of that a smaller cyan rectangle.

If I call no functions in between, I get the expected behaviour.
If I call a blank function (a stub, no arguments, no implementation) there are 2 possibilities.
If a variable is 11 or less I get the expected behaviour.
if a variable is 12 or more I only get the rectangle drawn before calling the stub.

In other words, making a variable have a value greater than 11 seems to change the machine state in such a way I cannot draw anymore. The function is:

UPDATE:
It is related to the line: uint32_t charTest[CHAR_BITS*CHAR_BITS*size*size];
Commenting that line out seems to fix the problem. I assume there is a problem with this form of dynamic initialisation?

What is the value and type of CHAR_BITS?
Can't help unless we have all the details.

You could also be nice and help the optimizer out, there is lots of repeated mathematics which you are relying totally on the optimizer recognizing to factor them out. Even just factoring CHAR_BITS*size to a temp variable would help it as I see it 6 times.

uint32_t temp = CHAR_BITS*size;
is calling out to you and saves you some typing in the code and RSI in later life

So I can see you are looking to do your own OS which I fully encourage.

What I will also say is it is very slow and messy to scale bitmap fonts. If you just want to scale the system font with screen res, the display of each character will be a heck of a lot faster to just include/link different font files based on screen res. If you do run the scaling and hold the result you don't want to have to scale on the fly every letter.

Hello, I think the problem was related to memory, once I declared the array as a global variable and statically initialize it it went away. About the fonts. i actually have coded bezier implementations of TTF fonts, before, but my printing methods right now are simply for debugging, scaling was simply so that I would not go blind trying to read my own output.