Hello, this thread is meant to be a continuation of Receiving wrong values from four 32000 char arrays (Arduino Mega) that I created some time back.
Backstory:
In the thread linked above, I was able to statically allocate 128KB of memory in an Arduino Mega using 4 unsigned char arrays, with the help of @guix, which are being placed in the .fini
1 subsection of the .text
section. After this, I am able to get 32 bit pointers using pgm_get_far_address
and read the bytes there using pgm_read_byte_far
.
Present:
I am now trying to create a library that will work with AdafruitGFX to use WaveShare colour e-Paper displays. Since the refresh time for these displays is >30 seconds, it makes the most sense to use with a display buffer for all the drawing functions, and send it to the actual display with another dedicated function. I am trying to create something similar to the Adafruit SSD1316 Library, which uses a buffer for very small 1 bit displays.
As there are many similar displays with varying resolutions, I want to dynamically allocate (malloc or new) enough memory (max 150KB I guess? ) for a buffer in the .text
section, since we saw that .data
wasn't large enough.
I also looked here:
The last article seems to imply that only constant data can be stored in the program space. I wanted to ask if this is true and what options I have to dynamically allocate and manage ~150KB on an Arduino Mega for this buffer.
Any help/insight is much appreciated. Thanks!