Page 1 of 1

DRAM segment data does not fit

Posted: Mon Jan 24, 2022 6:22 pm
by lobis0
Hello,

I am running into a problem where I need to allocate memory for a dynamic array and it (barelly) exceeds the DRAM limit of my ESP32 board.

Code: Select all

#include <Arduino.h>

#define IMAGE_SIZE 134400

unsigned char image[IMAGE_SIZE];

void setup()
{

  for (int i = 0; i < IMAGE_SIZE; i++)
  {
    image[i] = 0;
  }

  return;
}

void loop()
{
}
Is there any way to make the above code work?

My goal is to call an external function that takes a `const unsigned char *image` as an argument. If I declare this `image` array as a const array, the problem will work, but taking out the const modifier throws this exception. I could store the image data into multiple arrays since it fits in memory, perhaps there is a smart way to merge this multiple arrays into a single const array such as the one required by my external function? This would solve my issue.

Thanks!