Closed
Description
edit: quoting updated
Hi
When trying to make a hardware debug platform.txt I bumped into the compilation problem below.
'Building file: C:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\core_esp8266_postmortem.c'
'Starting C compile'
"C:\eclipse\arduinoPlugin\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2/tools/sdk/include" "-IC:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2/tools/sdk/lwip2/include" "-IC:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2/tools/sdk/libc/xtensa-lx106-elf/include" "-IL:/test/runtime-EclipseApplication_eng/esp/ff/core" -c -Wall -Wextra -DDEBUG -Og -ggdb -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections -DF_CPU=160000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DDEBUG_ESP_PORT=Serial -DARDUINO=10802 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="\"ESP8266_GENERIC\"" -DLED_BUILTIN=9 -DESP8266 -I"C:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266" -I"C:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2\variants\generic" -I"C:\Users\jan\git\hardware\jantje\ESP8266\libraries\gdb" -MMD -MP -MF"core\core\core_esp8266_postmortem.c.d" -MT"core\core\core_esp8266_postmortem.c.o" -D__IN_ECLIPSE__=1 "C:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\core_esp8266_postmortem.c" -o "core\core\core_esp8266_postmortem.c.o"
C:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\core_esp8266_postmortem.c:83:23: error: istr causes a section type conflict with iram_read_byte
static const char istr[] ICACHE_RAM_ATTR = (str); \
^
C:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\core_esp8266_postmortem.c:190:5: note: in expansion of macro 'ets_printf_P'
ets_printf_P("<<<stack<<<\n");
^
C:\eclipse\arduinoPlugin\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266\core_esp8266_postmortem.c:66:29: note: 'iram_read_byte' was declared here
static char ICACHE_RAM_ATTR iram_read_byte (const char *addr) {
^
core\core\subdir.mk:356: recipe for target 'core\core\core_esp8266_postmortem.c.o' failed
make: *** [core\core\core_esp8266_postmortem.c.o] Error 1
The problem lies into the fact that the define ICACHE_RAM_ATTR is used 2 times for a different variable.
Apparently optimized for small optimizes this to 1 variable which makes this problem is not visible when using -Os. Obviously optimizing for debugging does not allow this.
This can be fixed by changing the line
static const char istr[] ICACHE_RAM_ATTR = (str);
to
static const char istr[] __attribute__((section(".iram.text.2"))) = (str);
I didn't want to make this a push request because I am not sure "the change is an acceptable solution" as yesterday I had not heard about something called
__attribute__((section(XXX)))
Best regards
Jantje