mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-29 21:27:02 +08:00
feat(make): add "iram_bss" to link some global varible from DRAM to IRAM
This commit is contained in:
@ -52,7 +52,7 @@ else()
|
|||||||
set(include_dirs "include" "include/driver")
|
set(include_dirs "include" "include/driver")
|
||||||
|
|
||||||
set(priv_requires "wpa_supplicant" "log" "spi_flash" "tcpip_adapter" "esp_ringbuf" "bootloader_support" "nvs_flash" "util")
|
set(priv_requires "wpa_supplicant" "log" "spi_flash" "tcpip_adapter" "esp_ringbuf" "bootloader_support" "nvs_flash" "util")
|
||||||
set(fragments linker.lf ld/esp8266_fragments.lf)
|
set(fragments linker.lf ld/esp8266_fragments.lf ld/esp8266_bss_fragments.lf)
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "${include_dirs}"
|
INCLUDE_DIRS "${include_dirs}"
|
||||||
|
@ -25,7 +25,7 @@ endif
|
|||||||
#specifies its own scripts.
|
#specifies its own scripts.
|
||||||
LINKER_SCRIPTS += esp8266.rom.ld esp8266.peripherals.ld
|
LINKER_SCRIPTS += esp8266.rom.ld esp8266.peripherals.ld
|
||||||
|
|
||||||
COMPONENT_ADD_LDFRAGMENTS += ld/esp8266_fragments.lf linker.lf
|
COMPONENT_ADD_LDFRAGMENTS += ld/esp8266_fragments.lf ld/esp8266_bss_fragments.lf linker.lf
|
||||||
|
|
||||||
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib \
|
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib \
|
||||||
$(addprefix -l,$(LIBS)) \
|
$(addprefix -l,$(LIBS)) \
|
||||||
|
@ -81,10 +81,22 @@ SECTIONS
|
|||||||
mapping[iram0_text]
|
mapping[iram0_text]
|
||||||
|
|
||||||
_iram_text_end = ABSOLUTE(.);
|
_iram_text_end = ABSOLUTE(.);
|
||||||
|
} > iram0_0_seg
|
||||||
|
|
||||||
|
.iram0.bss :
|
||||||
|
{
|
||||||
|
. = ALIGN (4);
|
||||||
|
/* Code marked as runnning out of IRAM */
|
||||||
|
_iram_bss_start = ABSOLUTE(.);
|
||||||
|
|
||||||
|
mapping[iram0_bss]
|
||||||
|
|
||||||
|
. = ALIGN (4);
|
||||||
|
_iram_bss_end = ABSOLUTE(.);
|
||||||
_iram_end = ABSOLUTE(.);
|
_iram_end = ABSOLUTE(.);
|
||||||
} > iram0_0_seg
|
} > iram0_0_seg
|
||||||
|
|
||||||
ASSERT(((_iram_text_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
|
ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)),
|
||||||
"IRAM0 segment data does not fit.")
|
"IRAM0 segment data does not fit.")
|
||||||
|
|
||||||
.dram0.data :
|
.dram0.data :
|
||||||
|
5
components/esp8266/ld/esp8266_bss_fragments.lf
Normal file
5
components/esp8266/ld/esp8266_bss_fragments.lf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
[scheme:iram_bss]
|
||||||
|
entries:
|
||||||
|
bss -> iram0_bss
|
||||||
|
common -> iram0_bss
|
@ -14,3 +14,9 @@ entries:
|
|||||||
archive: libphy.a
|
archive: libphy.a
|
||||||
entries:
|
entries:
|
||||||
* (noflash_text)
|
* (noflash_text)
|
||||||
|
|
||||||
|
[mapping:core]
|
||||||
|
archive: libcore.a
|
||||||
|
entries:
|
||||||
|
if ESP8266_CORE_GLOBAL_DATA_LINK_IRAM = y:
|
||||||
|
* (iram_bss)
|
||||||
|
@ -116,6 +116,7 @@ void call_start_cpu(size_t start_addr)
|
|||||||
int *p;
|
int *p;
|
||||||
|
|
||||||
extern int _bss_start, _bss_end;
|
extern int _bss_start, _bss_end;
|
||||||
|
extern int _iram_bss_start, _iram_bss_end;
|
||||||
|
|
||||||
esp_image_header_t *head = (esp_image_header_t *)(FLASH_BASE + (start_addr & (FLASH_SIZE - 1)));
|
esp_image_header_t *head = (esp_image_header_t *)(FLASH_BASE + (start_addr & (FLASH_SIZE - 1)));
|
||||||
esp_image_segment_header_t *segment = (esp_image_segment_header_t *)((uintptr_t)head + sizeof(esp_image_header_t));
|
esp_image_segment_header_t *segment = (esp_image_segment_header_t *)((uintptr_t)head + sizeof(esp_image_header_t));
|
||||||
@ -154,6 +155,10 @@ void call_start_cpu(size_t start_addr)
|
|||||||
for (p = &_bss_start; p < &_bss_end; p++)
|
for (p = &_bss_start; p < &_bss_end; p++)
|
||||||
*p = 0;
|
*p = 0;
|
||||||
|
|
||||||
|
/* clear iram_bss data */
|
||||||
|
for (p = &_iram_bss_start; p < &_iram_bss_end; p++)
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"rsil a2, 2\n"
|
"rsil a2, 2\n"
|
||||||
"movi a1, _chip_interrupt_tmp\n"
|
"movi a1, _chip_interrupt_tmp\n"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
set(COMPONENT_ADD_INCLUDEDIRS include include/freertos include/freertos/private port/esp8266/include port/esp8266/include/freertos)
|
set(COMPONENT_ADD_INCLUDEDIRS include include/freertos include/freertos/private port/esp8266/include port/esp8266/include/freertos)
|
||||||
set(COMPONENT_SRCDIRS "freertos" "port/esp8266")
|
set(COMPONENT_SRCDIRS "freertos" "port/esp8266")
|
||||||
|
set(COMPONENT_ADD_LDFRAGMENTS "linker.lf")
|
||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
|
||||||
|
@ -12,3 +12,5 @@ COMPONENT_SRCDIRS := port/esp8266
|
|||||||
ifndef CONFIG_DISABLE_FREERTOS
|
ifndef CONFIG_DISABLE_FREERTOS
|
||||||
COMPONENT_SRCDIRS += freertos
|
COMPONENT_SRCDIRS += freertos
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
COMPONENT_ADD_LDFRAGMENTS += linker.lf
|
||||||
|
5
components/freertos/linker.lf
Normal file
5
components/freertos/linker.lf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[mapping:freertos]
|
||||||
|
archive: libfreertos.a
|
||||||
|
entries:
|
||||||
|
if FREERTOS_GLOBAL_DATA_LINK_IRAM = y:
|
||||||
|
* (iram_bss)
|
@ -32,6 +32,8 @@ endif()
|
|||||||
set(COMPONENT_REQUIRES vfs)
|
set(COMPONENT_REQUIRES vfs)
|
||||||
set(COMPONENT_PRIV_REQUIRES tcpip_adapter)
|
set(COMPONENT_PRIV_REQUIRES tcpip_adapter)
|
||||||
|
|
||||||
|
set(COMPONENT_ADD_LDFRAGMENTS "linker.lf")
|
||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
|
||||||
component_compile_options(-Wno-address)
|
component_compile_options(-Wno-address)
|
||||||
|
@ -24,6 +24,8 @@ ifdef CONFIG_USING_ESP_VFS
|
|||||||
COMPONENT_SRCDIRS += port
|
COMPONENT_SRCDIRS += port
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
COMPONENT_ADD_LDFRAGMENTS += linker.lf
|
||||||
|
|
||||||
CFLAGS += -Wno-address #lots of LWIP source files evaluate macros that check address of stack variables
|
CFLAGS += -Wno-address #lots of LWIP source files evaluate macros that check address of stack variables
|
||||||
|
|
||||||
lwip/src/apps/sntp/sntp.o: CFLAGS += -Wno-implicit-function-declaration
|
lwip/src/apps/sntp/sntp.o: CFLAGS += -Wno-implicit-function-declaration
|
||||||
|
5
components/lwip/linker.lf
Normal file
5
components/lwip/linker.lf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[mapping:lwip]
|
||||||
|
archive: liblwip.a
|
||||||
|
entries:
|
||||||
|
if LWIP_GLOBAL_DATA_LINK_IRAM = y:
|
||||||
|
* (iram_bss)
|
Reference in New Issue
Block a user