Browse Source

Put each ICACHE_RAM_ATTR function in its own section. (#2334)

* Put each ICACHE_RAM_ATTR function in its own section.

* Chached the macro names to be less likely to cause problems
Philip Gladstone 6 years ago
parent
commit
cda8da622d
2 changed files with 4 additions and 2 deletions
  1. 3 1
      app/include/user_config.h
  2. 1 1
      ld/nodemcu.ld

+ 3 - 1
app/include/user_config.h

@@ -52,7 +52,9 @@ extern void luaL_assertfail(const char *file, int line, const char *message);
 
 #define ICACHE_STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed))
 #define ICACHE_STORE_ATTR __attribute__((aligned(4)))
-#define ICACHE_RAM_ATTR __attribute__((section(".iram0.text")))
+#define ICACHE_RAM_STRING(x) ICACHE_RAM_STRING2(x)
+#define ICACHE_RAM_STRING2(x) #x
+#define ICACHE_RAM_ATTR     __attribute__((section(".iram0.text." __FILE__ "." ICACHE_RAM_STRING(__LINE__))))
 #ifdef  GPIO_SAFE_NO_INTR_ENABLE
 #define NO_INTR_CODE ICACHE_RAM_ATTR __attribute__ ((noinline))
 #else

+ 1 - 1
ld/nodemcu.ld

@@ -121,7 +121,7 @@ SECTIONS
     /* *libwpa.a:*(.literal .text) - tested that safe to keep in iROM */
     /* *libwps.a:*(.literal .text) - tested that safe to keep in iROM */
 
-    *(.iram.text .iram0.text)
+    *(.iram.text .iram0.text .iram0.text.*)
 
     *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)