diff --git a/components/esp8266/component.mk b/components/esp8266/component.mk index 30b35609..449a95c9 100644 --- a/components/esp8266/component.mk +++ b/components/esp8266/component.mk @@ -11,8 +11,6 @@ LIBS += airkiss crypto espnow gcc hal core net80211 \ phy pp pwm smartconfig ssc wpa wps endif -ESPTOOLPY_FLASHSIZE ?= $(CONFIG_ESPTOOLPY_FLASHSIZE) - ifeq ($(CONFIG_ESPTOOLPY_APP_NUM),"app1") BIN_APP_NUM := app1 endif @@ -20,41 +18,17 @@ ifeq ($(CONFIG_ESPTOOLPY_APP_NUM),"app2") BIN_APP_NUM := app2 endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "512KB") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.512.$(BIN_APP_NUM).ld -endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "1MB") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.1024.$(BIN_APP_NUM).ld -endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "2MB") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.1024.$(BIN_APP_NUM).ld -endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "2MB-c1") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.2048.ld -endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "4MB") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.1024.$(BIN_APP_NUM).ld -endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "4MB-c1") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.2048.ld -endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "8MB") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.2048.ld -endif -ifeq ($(ESPTOOLPY_FLASHSIZE), "16MB") -ESP8266_LINKER_SCRIPTS := eagle.app.v6.new.2048.ld -endif - #Linker scripts used to link the final application. #Warning: These linker scripts are only used when the normal app is compiled; the bootloader #specifies its own scripts. -LINKER_SCRIPTS += $(ESP8266_LINKER_SCRIPTS) eagle.app.v6.common.ld eagle.rom.addr.v6.ld +LINKER_SCRIPTS += esp8266.common.ld esp8266.rom.ld COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib \ $(addprefix -l,$(LIBS)) \ -L $(COMPONENT_PATH)/ld \ + -T esp8266_out.ld \ -Wl,--no-check-sections \ - -u call_user_start \ + -u call_user_start \ $(addprefix -T ,$(LINKER_SCRIPTS)) ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) @@ -62,3 +36,14 @@ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) # final linking of project ELF depends on all binary libraries, and # all linker scripts COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS)) + +# Preprocess esp8266.ld linker script into esp8266_out.ld +# +# The library doesn't really depend on esp8266_out.ld, but it +# saves us from having to add the target to a Makefile.projbuild +$(COMPONENT_LIBRARY): esp8266_out.ld + +esp8266_out.ld: $(COMPONENT_PATH)/ld/esp8266.ld ../include/sdkconfig.h + $(CC) -I ../include -C -P -x c -E $< -o $@ + +COMPONENT_EXTRA_CLEAN := esp8266_out.ld \ No newline at end of file diff --git a/components/esp8266/ld/eagle.app.v6.ld b/components/esp8266/ld/eagle.app.v6.ld deleted file mode 100644 index f9e35b0f..00000000 --- a/components/esp8266/ld/eagle.app.v6.ld +++ /dev/null @@ -1,30 +0,0 @@ -/* eagle.flash.bin @ 0x00000 */ -/* eagle.irom0text.bin @ 0x20000 */ - -/* Flash Map, support 512KB/1MB/2MB/4MB SPI Flash */ -/* |......|..............................|..........................|.....|....| */ -/* ^ ^ ^ ^ ^ */ -/* |_flash.bin start(0x0000) |_irom0text.bin start(0x20000) | */ -/* |_flash.bin end |_irom0text.bin end */ -/* |_system param area(0x7b000) */ - -/* NOTICE: */ -/* 1. You can change irom0 org, but MUST make sure irom0text.bin start not overlap flash.bin end. */ -/* 2. You can change irom0 len, but MUST make sure irom0text.bin end not overlap system param area. */ -/* 3. Space between flash.bin end and irom0text.bin start can be used as user param area. */ -/* 4. Space between irom0text.bin end and system param area can be used as user param area. */ -/* 5. Make sure irom0text.bin end < 0x100000 */ -/* 6. system param area: */ -/* 1>. 512KB--->0x07b000 */ -/* 2>. 1MB----->0x0fb000 */ -/* 3>. 2MB----->0x1fb000 */ -/* 4>. 4MB----->0x3fb000 */ -/* 7. Don't change any other seg. */ - -MEMORY -{ - dport0_0_seg : org = 0x3FF00000, len = 0x10 - dram0_0_seg : org = 0x3FFE8000, len = 0x18000 - iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40220000, len = 0x5C000 -} diff --git a/components/esp8266/ld/eagle.app.v6.new.1024.app1.ld b/components/esp8266/ld/eagle.app.v6.new.1024.app1.ld deleted file mode 100644 index 4207841d..00000000 --- a/components/esp8266/ld/eagle.app.v6.new.1024.app1.ld +++ /dev/null @@ -1,21 +0,0 @@ -/* user1.bin @ 0x1000 */ - -/* Flash Map (512KB + 512KB), support 1MB/2MB/4MB SPI Flash */ -/* |..|........................|.....|.....|..|........................|.....|....| */ -/* ^ ^ ^ ^ ^ ^ ^ ^ */ -/* |_boot start(0x0000) | | |_pad start(0x80000) | | */ -/* |_user1 start(0x1000) |_user1 end |_user2 start(0x81000) |_user2 end */ -/* |_system param symmetric area(0x7b000) |_system param area(0xfb000) */ - -/* NOTICE: */ -/* 1. You can change irom0 len, but MUST make sure user1 end not overlap system param symmetric area. */ -/* 2. Space between user1 end and pad start can be used as user param area. */ -/* 3. Don't change any other seg. */ - -MEMORY -{ - dport0_0_seg : org = 0x3FF00000, len = 0x10 - dram0_0_seg : org = 0x3FFE8000, len = 0x18000 - iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40201010, len = 0x6B000 -} diff --git a/components/esp8266/ld/eagle.app.v6.new.1024.app2.ld b/components/esp8266/ld/eagle.app.v6.new.1024.app2.ld deleted file mode 100644 index 4b70e426..00000000 --- a/components/esp8266/ld/eagle.app.v6.new.1024.app2.ld +++ /dev/null @@ -1,21 +0,0 @@ -/* user2.bin @ 0x81000 */ - -/* Flash Map (512KB + 512KB), support 1MB/2MB/4MB SPI Flash */ -/* |..|........................|.....|.....|..|........................|.....|....| */ -/* ^ ^ ^ ^ ^ ^ ^ ^ */ -/* |_boot start(0x0000) | | |_pad start(0x80000) | | */ -/* |_user1 start(0x1000) |_user1 end |_user2 start(0x81000) |_user2 end */ -/* |_system param symmetric area(0x7b000) |_system param area(0xfb000) */ - -/* NOTICE: */ -/* 1. You can change irom0 len, but MUST make sure user2 end not overlap system param area. */ -/* 2. Space between user2 end and system param area can be used as user param area. */ -/* 3. Don't change any other seg. */ - -MEMORY -{ - dport0_0_seg : org = 0x3FF00000, len = 0x10 - dram0_0_seg : org = 0x3FFE8000, len = 0x18000 - iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40281010, len = 0x6B000 -} diff --git a/components/esp8266/ld/eagle.app.v6.new.512.app1.ld b/components/esp8266/ld/eagle.app.v6.new.512.app1.ld deleted file mode 100644 index 195b991d..00000000 --- a/components/esp8266/ld/eagle.app.v6.new.512.app1.ld +++ /dev/null @@ -1,21 +0,0 @@ -/* user1.bin @ 0x1000 */ - -/* Flash Map (256KB + 256KB), support 512KB SPI Flash */ -/* |..|........................|.....|.....|..|........................|.....|....| */ -/* ^ ^ ^ ^ ^ ^ ^ ^ */ -/* |_boot start(0x0000) | | |_pad start(0x40000) | | */ -/* |_user1 start(0x1000) |_user1 end |_user2 start(0x41000) |_user2 end */ -/* |_system param symmetric area(0x3b000) |_system param area(0x7b000) */ - -/* NOTICE: */ -/* 1. You can change irom0 len, but MUST make sure user1 end not overlap system param symmetric area. */ -/* 2. Space between user1 end and pad start can be used as user param area. */ -/* 3. Don't change any other seg. */ - -MEMORY -{ - dport0_0_seg : org = 0x3FF00000, len = 0x10 - dram0_0_seg : org = 0x3FFE8000, len = 0x18000 - iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40201010, len = 0x2B000 -} diff --git a/components/esp8266/ld/eagle.app.v6.new.512.app2.ld b/components/esp8266/ld/eagle.app.v6.new.512.app2.ld deleted file mode 100644 index 4231d3c1..00000000 --- a/components/esp8266/ld/eagle.app.v6.new.512.app2.ld +++ /dev/null @@ -1,21 +0,0 @@ -/* user2.bin @ 0x41000 */ - -/* Flash Map (256KB + 256KB), support 512KB SPI Flash */ -/* |..|........................|.....|.....|..|........................|.....|....| */ -/* ^ ^ ^ ^ ^ ^ ^ ^ */ -/* |_boot start(0x0000) | | |_pad start(0x40000) | | */ -/* |_user1 start(0x1000) |_user1 end |_user2 start(0x41000) |_user2 end */ -/* |_system param symmetric area(0x3b000) |_system param area(0x7b000) */ - -/* NOTICE: */ -/* 1. You can change irom0 len, but MUST make sure user2 end not overlap system param area. */ -/* 2. Space between user2 end and system param area can be used as user param area. */ -/* 3. Don't change any other seg. */ - -MEMORY -{ - dport0_0_seg : org = 0x3FF00000, len = 0x10 - dram0_0_seg : org = 0x3FFE8000, len = 0x18000 - iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40241010, len = 0x2B000 -} diff --git a/components/esp8266/ld/eagle.app.v6.common.ld b/components/esp8266/ld/esp8266.common.ld similarity index 100% rename from components/esp8266/ld/eagle.app.v6.common.ld rename to components/esp8266/ld/esp8266.common.ld diff --git a/components/esp8266/ld/eagle.app.v6.new.2048.ld b/components/esp8266/ld/esp8266.ld similarity index 98% rename from components/esp8266/ld/eagle.app.v6.new.2048.ld rename to components/esp8266/ld/esp8266.ld index 31b173f5..448cc181 100644 --- a/components/esp8266/ld/eagle.app.v6.new.2048.ld +++ b/components/esp8266/ld/esp8266.ld @@ -14,6 +14,8 @@ /* 4. Don't change any other seg. */ /* 5. user1.bin and user2.bin are same in this mode, so upgrade only need one of them. */ +#include "sdkconfig.h" + MEMORY { dport0_0_seg : org = 0x3FF00000, len = 0x10 diff --git a/components/esp8266/ld/eagle.rom.addr.v6.ld b/components/esp8266/ld/esp8266.rom.ld similarity index 100% rename from components/esp8266/ld/eagle.rom.addr.v6.ld rename to components/esp8266/ld/esp8266.rom.ld