-->
Page 1 of 4

ESP8266 NONOS 2 RAM

PostPosted: Mon Jan 09, 2017 5:36 am
by berkutta
Hi,

I want to get know how to use the NONOS 2.0 to put a function i to ram and not flash. I need this to do a self update of the flash.

There aren't any definitions in c_types.h like in older NONOS versions.

Berkutta

Re: ESP8266 NONOS 2 RAM

PostPosted: Mon Jan 09, 2017 9:38 am
by gjump
@Berkutta
If you add this to a function declaration __attribute__((section(".data"))) it will probably be stored in RAM. You can check the ELF output file where your function is stored. Be warned that the RAM section is small.

ie:
Code: Select allvoid __attribute__((section(".data"))) foo(void)
{
}

Re: ESP8266 NONOS 2 RAM

PostPosted: Mon Jan 09, 2017 1:31 pm
by berkutta
@gjump
Thanks for the answer. But the ESP seems to direct fall into an exception after trying to call the function when it has this argument. The same for .iram0.text. Any other idea?

Re: ESP8266 NONOS 2 RAM

PostPosted: Mon Jan 09, 2017 2:43 pm
by gjump
@berkuttta
Indeed i made a mistake, actually this memory area is for usar data only, not for function call. My bad!
Replace for __attribute__((section(".text"))) then it's going to be stored somewhere after 0x40100000(start address of instruction RAM). You can double check those regions looking at your memory mapping script (ld script), if you are using the default one (eagle.app.v6.ld) the .text region is stored in IRAM.

Regards,