Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By scargill
#11982 Can someone give me this in very simple english.

I'm messing with the ESP8266 in C and wanted to know how much RAM I have...

I used the system call which said

data:2768
rodata: 5332
bss: 32992
heap: 40824

To test, I created a 10,000 byte buffer and poked something into it - the difference being the BSS went up by 10k exactly and the heap went down by 10k exactly.

Can someone explain the first 3 results... clearly as the heap goes down the BSS whatever that is goes up (used memory?) - if I'd used a static buffer would it have made any difference?

Pete.
User avatar
By joostn
#11997 If I'm right .bss is used for data which resides in RAM but is zero-initialized. Because it is in RAM you'll have less heap space available.

Normally with microcontrollers you'd use static const for read-only data. This goes to the .rodata section which normally maps to flash. For some reason the EPS needs rodata in RAM (viewtopic.php?t=1001&p=5508#p5508). If you want your data to go into flash you need to add a section attribute:

static const char __attribute__((section(".irom0.text"))) MyLargeBuffer[65000]={
// initialise the data here
} ;
User avatar
By scargill
#12019 That storing of an array in Flash looked good until I tried it..

It immediately objected to conflicting with a function space - this one

static void ICACHE_FLASH_ATTR readDHT() {

ALL of my functions are in ICASHE_FLASH_ATTR... for some reason it didn't pick the first one..

The data was only a 256 byte byte lookup table so I doubt anything is filled up...

Any ideas?