c_types.h #define ICACHE_FLASH_ATTR Hence, the code is not placed in .irom.text anymore.

User avatar
raspberrypidmx
Posts: 15
Joined: Wed Apr 27, 2016 6:15 am
Contact:

c_types.h #define ICACHE_FLASH_ATTR Hence, the code is not placed in .irom.text anymore.

Postby raspberrypidmx » Thu Sep 29, 2016 2:46 am

With ESP8266_RTOS_SDK 1.4.2 , the #define ICACHE_FLASH_ATTR is empty. Hence, the code is not placed in .irom.text anymore.

According to the manual "ESP8266 RTOS SDK Programming Guide Version 1.4.0" -> "Since ESP8266_RTOS_SDK_v1.2.0, functions are stored in CACHE area by default, need not be added ICACHE_FLASH_ATTR any more."

When I compile my project with void user_init(void) , then I get the error :
build/app.out section `.text' will not fit in region `iram1_0_seg'

When I compile my project with void __attribute__((section(".irom0.text"))) user_init(void) , then the compile is going fine:
Generate user1.1024.new.2.bin successully in folder firmware/upgrade

Seems to me that the function are not stored by default in CACHE area.

Please advice.

Thanks, Arjan

pratik

Re: c_types.h #define ICACHE_FLASH_ATTR Hence, the code is not placed in .irom.text anymore.

Postby pratik » Fri Sep 30, 2016 5:50 pm

Hello Arjan,

The LD files contain where the code will be placed by default. Please make sure you are using a freshly downloaded, unmodified copy of the SDK with the original LD files.
Also, if you are getting the error that code cannot fit in IRAM, it might be because you have large printf logs or large constant arrays that are getting stored in RAM...

User avatar
raspberrypidmx
Posts: 15
Joined: Wed Apr 27, 2016 6:15 am
Contact:

Re: c_types.h #define ICACHE_FLASH_ATTR Hence, the code is not placed in .irom.text anymore.

Postby raspberrypidmx » Thu Oct 06, 2016 11:06 pm

Hi Pratik,

Thank you for the reply. Much appreciated.

I have replaced the simple "%s\n" printf's with my own written

Code: Select all

int __attribute__((section(".irom0.text"))) uart0_puts(const char *s) {
   char c;
   int i = 0;;

   while ((c = *s++) != (char) 0) {
      i++;
      uart0_putc(c);
   }

   return i;
}


This reduces the amount of RAM being used.

The complete code be found here -> https://github.com/vanvught/rpidmx512/tree/master/esp8266_rtos_sdk_rpi
With the Raspberry Pi code here -> https://github.com/vanvught/rpidmx512/tree/master/lib-esp8266

pratik

Re: c_types.h #define ICACHE_FLASH_ATTR Hence, the code is not placed in .irom.text anymore.

Postby pratik » Sat Oct 08, 2016 11:42 am

Glad it worked, thanks for sharing the links!
Take care of alignment issues though, when storing arrays in ROM. :)

Who is online

Users browsing this forum: No registered users and 54 guests