Skip to content

Commit 30eb729

Browse files
Move ICACHE_* to unique sections, local LD script
Similar to PROGMEM changes, make the name of each ICACHE_* variable/fuction unique to avoid issues with section conflicts. Also rename the generated LD linker script to avoid issue with older copies of the eagle.app.v6.common.ld which were generated by the build process in a global directory before being moved to the {build.path}. The linker would use the older, generated *.ld file instead of the generated one, which would lead to runtime failures on some systems and cause the VTABLE location to not correspond to the IDE menu selection. Fixes #5115, and is an update to #5117 and #5116.
1 parent 1a44f79 commit 30eb729

26 files changed

+32
-30
lines changed

Diff for: platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ recipe.hooks.core.prebuild.1.pattern.windows=cmd.exe /c mkdir {build.path}\core
7979
recipe.hooks.core.prebuild.2.pattern.windows=
8080

8181
## Build the app.ld linker file
82-
recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/eagle.app.v6.common.ld"
82+
recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld"
8383

8484
## Compile c files
8585
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

Diff for: tools/sdk/include/c_types.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ typedef enum {
8484
#define SHMEM_ATTR
8585

8686
#ifdef ICACHE_FLASH
87-
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
88-
#define ICACHE_RAM_ATTR __attribute__((section(".iram.text")))
89-
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
87+
#define __ICACHE_STRINGIZE_NX(A) #A
88+
#define __ICACHE_STRINGIZE(A) __ICACHE_STRINGIZE_NX(A)
89+
#define ICACHE_FLASH_ATTR __attribute__((section("\".irom0.text." __FILE__ "." __ICACHE_STRINGIZE(__LINE__) "." __ICACHE_STRINGIZE(__COUNTER__) "\"")))
90+
#define ICACHE_RAM_ATTR __attribute__((section("\".iram.text." __FILE__ "." __ICACHE_STRINGIZE(__LINE__) "." __ICACHE_STRINGIZE(__COUNTER__) "\"")))
91+
#define ICACHE_RODATA_ATTR __attribute__((section("\".irom.text." __FILE__ "." __ICACHE_STRINGIZE(__LINE__) "." __ICACHE_STRINGIZE(__COUNTER__) "\"")))
9092
#else
9193
#define ICACHE_FLASH_ATTR
9294
#define ICACHE_RAM_ATTR

Diff for: tools/sdk/ld/eagle.app.v6.common.ld.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ SECTIONS
127127
*libwpa.a:(.literal.* .text.*)
128128
*libwpa2.a:(.literal.* .text.*)
129129
*libwps.a:(.literal.* .text.*)
130-
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text .irom.text.*)
130+
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom0.text.* .irom.text .irom.text.*)
131131
_irom0_text_end = ABSOLUTE(.);
132132
_flash_code_end = ABSOLUTE(.);
133133
} >irom0_0_seg :irom0_0_phdr
@@ -164,8 +164,8 @@ SECTIONS
164164
*(.init.literal)
165165
*(.init)
166166
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
167-
*.cpp.o(.iram.text)
168-
*.c.o(.iram.text)
167+
*.cpp.o(.iram.text .iram.text.*)
168+
*.c.o(.iram.text .iram.text.*)
169169
#ifdef VTABLES_IN_IRAM
170170
*(.rodata._ZTV*) /* C++ vtables */
171171
#endif

Diff for: tools/sdk/ld/eagle.flash.16m14m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x411FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.16m15m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x411FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x0 );
2020
PROVIDE ( _SPIFFS_block = 0x0 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m128.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m144.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m160.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m192.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m256.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m512.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.1m64.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x402FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.2m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x403FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x0 );
2020
PROVIDE ( _SPIFFS_block = 0x0 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.2m1m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x403FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.2m512.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x403FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.4m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x405FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x0 );
2020
PROVIDE ( _SPIFFS_block = 0x0 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.4m1m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x405FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.4m2m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x405FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.4m3m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x405FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.512k.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x4027B000 );
1919
PROVIDE ( _SPIFFS_page = 0x0 );
2020
PROVIDE ( _SPIFFS_block = 0x0 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.512k128.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x4027B000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.512k32.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x4027B000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.512k64.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x4027B000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x1000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.8m6m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x409FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

Diff for: tools/sdk/ld/eagle.flash.8m7m.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ PROVIDE ( _SPIFFS_end = 0x409FB000 );
1919
PROVIDE ( _SPIFFS_page = 0x100 );
2020
PROVIDE ( _SPIFFS_block = 0x2000 );
2121

22-
INCLUDE "eagle.app.v6.common.ld"
22+
INCLUDE "local.eagle.app.v6.common.ld"

0 commit comments

Comments
 (0)