Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By hughanderson
#22479 Hi,
My apologies in advance if this is a newbie question, but I could not find the answer on the forums or by searching.
I am using an ESP8266, compiling using the Arduino environment. My device is NodeMCU 1.0 (ESP-12E), and I can compile
and run samples fine.
However, I have noticed that I only seem to have about 38K of RAM available. If I allocate (say) a couple of larger arrays, the compiler complains that
...address 0x3fffec80 of TestESP8266Memory.cpp.elf section `.bss' is not within region `dram0_0_seg'
and then dies.
The variables appear at the bottom of the bss section: just above 3FFE8000h, where there is supposed to be 0x14000 (81920) bytes free, but any variables over about 38K seem to exceed the RAM area allocated.
Can someone explain why I only appear to be able to access about half of the RAM?
I am just compiling a test like this:
Code: Select allvoid setup() {
  Serial.begin(115200);
}

uint8_t a1[16384];
uint8_t a2[16384];
uint8_t a3[16384];

void loop() {
  int b;
  Serial.print("Address of a1,a2 is ");
  Serial.print((long)&a1[0]);
  Serial.print(",");
  Serial.print((long)&a2[0]);
  Serial.println();
  delay(500);
}


Anyway - can someone explain the limitation? Is this to be expected?

Regards Hugh
User avatar
By hughanderson
#22533 Hi again,

I am not using the Wifi functions, so I would have hoped that the compiler would not have compiled them in, and would not be allocating space for their variables and (TCP?) buffers.
If the WiFi does make use of more than 40K of memory, then is there some way of reducing this? If lots of space is being allocated for TCP buffers, then could this be tuned to reduce the footprint?
I wondered instead if the run time system allocated a fixed-size heap, and this was what took up the room.
In any case is there some way of reducing this - in my application I need about 60K of spare memory.

Regards Hugh