feat(esp8266): Add configuration link function

Select to link "FreeRTOS", "LWIP", "libcore.a" and "TCPIP adapter" global data to IRAM.
This commit is contained in:
Dong Heng
2018-09-12 13:15:47 +08:00
parent 4229f4def9
commit c389ca3fb8
7 changed files with 67 additions and 5 deletions

View File

@ -35,6 +35,11 @@ config SOC_FULL_ICACHE
Enable this option, full 32 KB iram instead of 16 KB iram will be used as icache, so the heap use can use
may reduce a lot.
config SOC_IRAM_SIZE
hex
default 0x8000 if SOC_FULL_ICACHE
default 0xC000 if !SOC_FULL_ICACHE
choice CONSOLE_UART_NUM
prompt "UART peripheral to use for console output (0-1)"
default CONSOLE_UART_CUSTOM_NUM_0
@ -119,6 +124,14 @@ config WIFI_PPT_TASKSTACK_SIZE
which calls promiscuous callback function. So if user's function is
complex, the stack must be set larger.
config ESP8266_CORE_GLOBAL_DATA_LINK_IRAM
bool "Link libcore.a internal global data to IRAM"
default y
depends on !LWIP_HIGH_THROUGHPUT
depends on !SOC_FULL_ICACHE
help
Link libcore.a internal global data(.bss .data COMMON) from DRAM to IRAM.
endmenu
menu WIFI

View File

@ -18,12 +18,13 @@ 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.common.ld esp8266.rom.ld esp8266.peripherals.ld
LINKER_SCRIPTS += esp8266.rom.ld esp8266.peripherals.ld
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib \
$(addprefix -l,$(LIBS)) \
-L $(COMPONENT_PATH)/ld \
-T esp8266_out.ld \
-T esp8266_common_out.ld \
-Wl,--no-check-sections \
-u call_user_start \
$(addprefix -T ,$(LINKER_SCRIPTS))
@ -38,11 +39,14 @@ COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS))
#
# 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
$(COMPONENT_LIBRARY): esp8266_out.ld esp8266_common_out.ld
esp8266_out.ld: $(COMPONENT_PATH)/ld/esp8266.ld ../include/sdkconfig.h
$(CC) -I ../include -C -P -x c -E $< -o $@
esp8266_common_out.ld: $(COMPONENT_PATH)/ld/esp8266.common.ld ../include/sdkconfig.h
$(CC) -I ../include -C -P -x c -E $< -o $@
COMPONENT_EXTRA_CLEAN := esp8266_out.ld
endif

View File

@ -1,6 +1,8 @@
/* This linker script generated from xt-genldscripts.tpp for LSP . */
/* Linker Script for ld -N */
#include "sdkconfig.h"
PHDRS
{
dport0_0_phdr PT_LOAD;
@ -108,6 +110,25 @@ SECTIONS
*(.fini.literal)
*(.fini)
*(.gnu.version)
#ifdef CONFIG_LWIP_GLOBAL_DATA_LINK_IRAM
*liblwip.a:(.bss .data .bss.* .data.* COMMON)
#endif
#ifdef CONFIG_TCPIP_ADAPTER_GLOBAL_DATA_LINK_IRAM
*libtcpip_adapter.a:(.bss .data .bss.* .data.* COMMON)
#endif
#ifdef CONFIG_ESP8266_CORE_GLOBAL_DATA_LINK_IRAM
*libcore.a:(.bss .data .bss.* .data.* COMMON)
#endif
#ifdef CONFIG_FREERTOS_GLOBAL_DATA_LINK_IRAM
*libfreertos.a:tasks.o(.bss .data .bss.* .data.* COMMON)
*libfreertos.a:timers.o(.bss .data .bss.* .data.* COMMON)
*libfreertos.a:freertos_hooks.o(.bss .data .bss.* .data.* COMMON)
#endif
_text_end = ABSOLUTE(.);
_etext = .;
} >iram1_0_seg :iram1_0_phdr

View File

@ -20,11 +20,11 @@ MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
/* All .data/.bss/heap are in this segment. 1024 bytes is for system start and interrupt*/
dram0_0_seg : org = 0x3FFE8000, len = 0x18000 - 1024
/* All .data/.bss/heap are in this segment. */
dram0_0_seg : org = 0x3FFE8000, len = 0x18000
/* Functions which are critical should be put in this segment. */
iram1_0_seg : org = 0x40100000, len = 0x8000
iram1_0_seg : org = 0x40100000, len = CONFIG_SOC_IRAM_SIZE
/* It is actually mapped to flash. */
irom0_0_seg : org = 0x40200010 + CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET, len = 0x100000 - 0x10 - CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET

View File

@ -29,5 +29,13 @@ config FREERTOS_ISR_STACKSIZE
default 512
help
The interrupt handlers have their own stack. The size of the stack can be defined here.
config FREERTOS_GLOBAL_DATA_LINK_IRAM
bool "Link FreeRTOS global data to IRAM"
default y
depends on !LWIP_HIGH_THROUGHPUT
depends on !SOC_FULL_ICACHE
help
Link FreeRTOS global data(.bss .data COMMON) from DRAM to IRAM.
endmenu

View File

@ -17,6 +17,14 @@ config LWIP_HIGH_THROUGHPUT
chip should full 32 KB IRAM as icache. For these 2 reasons, the global heap user can used
may reduce a lot.
config LWIP_GLOBAL_DATA_LINK_IRAM
bool "Link LWIP global data to IRAM"
default y
depends on !LWIP_HIGH_THROUGHPUT
depends on !SOC_FULL_ICACHE
help
Link LWIP global data(.bss .data COMMON) from DRAM to IRAM.
menu "ARP"
config LWIP_ARP_TABLE_SIZE

View File

@ -13,4 +13,12 @@ config IP_LOST_TIMER_INTERVAL
the timer expires. The IP lost timer is stopped if the station get the IP again before
the timer expires.
config TCPIP_ADAPTER_GLOBAL_DATA_LINK_IRAM
bool "Link TCPIP adapter global data to IRAM"
default y
depends on !LWIP_HIGH_THROUGHPUT
depends on !SOC_FULL_ICACHE
help
Link TCPIP adapter global data(.bss .data COMMON) from DRAM to IRAM.
endmenu