question about macro "ICACHE_RODATA_ATTR"

spiderweb
Posts: 2
Joined: Fri Jan 27, 2017 10:55 am

question about macro "ICACHE_RODATA_ATTR"

Postby spiderweb » Fri Jan 27, 2017 11:03 am

My code crashed when i using the macro "ICACHE_RODATA_ATTR",why,thank U very much!

Code: Select all

const char ICACHE_RODATA_ATTR  testFlashStr[]="test string";
const int ICACHE_RODATA_ATTR   testFlashArray[]={0,1,2,3,4,5,6,7,8,9};
void testDataInFlash()
{
   int i=0;
   while(1)
   {
      printf("%u:%s--%d\n",i++,testFlashStr,testFlashArray[i%10]);
      vTaskDelay(1000 / portTICK_RATE_MS);
   }
}

the uart print:
Fatal exception (3):
epc1=0x40101277
epc2=0x00000000
epc3=0x00000000
epcvaddr=0x4024c038
depc=0x00000000


But,removed the macro "ICACHE_RODATA_ATTR",like this:

Code: Select all

const char testFlashStr[]="test string";
const int testFlashArray[]={0,1,2,3,4,5,6,7,8,9};
void testDataInFlash()
{
   int i=0;
   while(1)
   {
      printf("%u:%s--%d\n",i++,testFlashStr,testFlashArray[i%10]);
      vTaskDelay(1000 / portTICK_RATE_MS);
   }
}

It's OK,I was confused

ESP_Xutao
Posts: 134
Joined: Tue Sep 27, 2016 5:42 pm

Re: question about macro "ICACHE_RODATA_ATTR"

Postby ESP_Xutao » Mon Feb 06, 2017 10:42 am

hi
For ESP8266_RTOS SDK:
Functions are located in the IROM section by default and do not need to be attributed with ICACHE_FLASH_ATTR. Interrupt handlers can also run from IROM. Hence, if functions called frequently need to be run from IRAM, they should be attributed with IRAM_ATTR.

Who is online

Users browsing this forum: Bryantpoirm, HenryCot, Henryionic and 6 guests