This is my current challenge in making OS for AVR microcontroller. I got only 2KB of RAM and it's eaten by avery function all and variable used.

In my text editor i started to get corrupted screen as the stack/heap started ovevriten screen buffer space ;)

So much fun!

#Arduino #Clang #Memory #OS

Follow

@w84death I know you're the one writing the OS and I'm the one watching, but have you heard of the PROGMEM keyword in Arduino C++? It allows you to store data that would usually be in RAM in flash. (I see you tagged Clang though)

@golemwire
Yes, I found that recently. I'm using PROGMEM for ALL the strings. As each string even the one in parameters for a function took a piece of ram.

When I need to print a string, I first copy the data from PROGMEM variable to the small buffer and use that buffer for print parameter. I'll do that to every string in the app.

Unfortunately those buffers NEEDS to be in ram. And the screen one is way too big - that's why I found a sweet spot of 112x88 pixels to work with.

@golemwire Clang as "C language" not the clang variant. I'll change that tag to make it clear.

Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml