ESP32 dev board memory

Hi

Im writting a sketch that uses large arrays for storing scan data,

unsigned char rawMap [500][500];
unsigned char cleanMap [500][500];

The board im using is ESP32 WROOM, some pages tell it DOIT32

When compiling, PlatformIO shows this error:

c:/users/dell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\mhetesp32devkit\firmware.elf section .dram0.bss' will not fit in region dram0_0_seg'

c:/users/dell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: DRAM segment data does not fit.

c:/users/dell/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: region `dram0_0_seg' overflowed by 390952 bytes

It means SRAM is out for these arrays, document says internal SRAM is 520kB but the platformIO gives its info is about 320kB RAM, does the board use 200kB for core/boot/system functions ?

And 320kB RAM includes Heap and Stack and Static memory or just Heap and Stack ?

I take a look at Available Heap section in https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/mem_alloc.html

Due to a technical limitation, the maximum statically allocated DRAM usage is 160KB. The remaining 160KB (for a total of 320KB of DRAM) can only be allocated at runtime as heap.

If i only need large arrays that save 0 or 1 data, can we use bit array instead ?

Thanks :slight_smile: :slight_smile:

A littet math: 500 x 500 = 250.000. Two times of such arrays means RAM = 500.000.
OK?

m4u_hoahoctro:
. . .
If i only need large arrays that save 0 or 1 data, can we use bit array instead ?
. .

You can use arrays of bytes and pack 8 bits into each byte with bitRead() and bitWrite().