2015-05-30 09:11:04 +00:00
|
|
|
/* This linker script generated from xt-genldscripts.tpp for LSP .
|
|
|
|
|
|
|
|
Modified for esp open RTOS, this linker script is no longer the same as the esp_iot_rtos_sdk one.
|
|
|
|
*/
|
|
|
|
|
2015-06-15 06:51:06 +00:00
|
|
|
/* FreeRTOS memory management functions
|
|
|
|
|
|
|
|
We link these directly to newlib functions (have to do it at link
|
|
|
|
time as binary libraries use these symbols too.)
|
|
|
|
*/
|
|
|
|
pvPortMalloc = malloc;
|
|
|
|
vPortFree = free;
|
|
|
|
|
2015-06-16 06:23:36 +00:00
|
|
|
/* FreeRTOS lock functions.
|
|
|
|
|
|
|
|
Rely on a patch to libc that produces weak linked versions of the
|
|
|
|
below symbols. Currently treating locking primitives like universal
|
|
|
|
global critical section rather than individual locks, but this seems
|
|
|
|
OK from the use cases in newlib.
|
|
|
|
*/
|
2015-06-15 06:51:06 +00:00
|
|
|
_lock_acquire = vPortEnterCritical;
|
|
|
|
_lock_acquire_recursive = vPortEnterCritical;
|
|
|
|
_lock_try_acquire = vPortEnterCritical;
|
|
|
|
_lock_try_acquire_recursive = vPortEnterCritical;
|
|
|
|
_lock_release = vPortExitCritical;
|
|
|
|
_lock_release_recursive = vPortExitCritical;
|
|
|
|
|
2015-06-16 06:22:55 +00:00
|
|
|
/* SDK compatibility */
|
|
|
|
ets_printf = printf;
|
|
|
|
|
2015-07-21 05:02:09 +00:00
|
|
|
/* Evaluate FLASH_SIZE to calculate irom size, etc.
|
|
|
|
*/
|
|
|
|
#ifndef OTA
|
|
|
|
|
2015-09-18 03:45:44 +00:00
|
|
|
#define IROM0_START 0x40220000
|
2015-07-21 05:02:09 +00:00
|
|
|
|
|
|
|
/* Non-OTA sizes */
|
|
|
|
#if FLASH_SIZE == 2 /* 256kB */
|
|
|
|
#define IROM0_LEN 0x3C000
|
|
|
|
#elif FLASH_SIZE == 4 /* 512kB */
|
|
|
|
#define IROM0_LEN 0x7C000
|
|
|
|
#elif FLASH_SIZE == 8 /* 1MB */
|
|
|
|
#define IROM0_LEN 0xFC000
|
|
|
|
#elif FLASH_SIZE == 16 /* 2MB */
|
|
|
|
#define IROM0_LEN 0x1FC000
|
|
|
|
#elif FLASH_SIZE == 32 /* 4MB */
|
|
|
|
#define IROM0_LEN 0x3FC000
|
|
|
|
#else /*FLASH_SIZE*/
|
|
|
|
#error "Unknown flash size for linker script. Check the FLASH_SIZE variable in your Makefile."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else /* OTA */
|
|
|
|
|
|
|
|
/* IROM0 becomes an actual "section" of the bootloader image, so we need to leave
|
|
|
|
space for the bootloader (0x2000 bytes) and space for the bootloader & section
|
|
|
|
headers (0x10 bytes)
|
|
|
|
*/
|
|
|
|
#define IROM0_START 0x40202010
|
|
|
|
|
|
|
|
/* OTA sizes */
|
|
|
|
#if FLASH_SIZE < 16
|
|
|
|
#error "OTA support currently requires 16 or 32 megabit flash"
|
|
|
|
#elif FLASH_SIZE == 16 || FLASH_SIZE == 32
|
|
|
|
/* 1MB irom0 section regardless, minus the space for the bootloader */
|
|
|
|
#define IROM0_LEN (0x100000 - 0x2010)
|
|
|
|
#else /*FLASH_SIZE*/
|
|
|
|
#error "Unknown flash size for linker script. Check the FLASH_SIZE variable in your Makefile."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-04-30 04:00:03 +00:00
|
|
|
/* Linker Script for ld -N */
|
|
|
|
MEMORY
|
|
|
|
{
|
|
|
|
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
|
|
|
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
2015-07-09 03:48:47 +00:00
|
|
|
iram1_0_seg : org = 0x40100000, len = 0x08000
|
2015-07-21 05:02:09 +00:00
|
|
|
irom0_0_seg : org = IROM0_START, len = IROM0_LEN
|
2015-04-30 04:00:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PHDRS
|
|
|
|
{
|
|
|
|
dport0_0_phdr PT_LOAD;
|
|
|
|
dram0_0_phdr PT_LOAD;
|
|
|
|
dram0_0_bss_phdr PT_LOAD;
|
|
|
|
iram1_0_phdr PT_LOAD;
|
|
|
|
irom0_0_phdr PT_LOAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Default entry point: */
|
2015-06-03 04:29:56 +00:00
|
|
|
ENTRY(call_user_start)
|
2015-04-30 04:00:03 +00:00
|
|
|
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
|
|
|
/* Various memory-map dependent cache attribute settings: */
|
|
|
|
_memmap_cacheattr_wb_base = 0x00000110;
|
|
|
|
_memmap_cacheattr_wt_base = 0x00000110;
|
|
|
|
_memmap_cacheattr_bp_base = 0x00000220;
|
|
|
|
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
|
|
|
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
|
|
|
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
|
|
|
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
|
|
|
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
|
|
|
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
|
|
|
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
|
|
|
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
|
|
|
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
|
|
|
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
|
|
|
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
|
|
|
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
|
|
|
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
|
|
|
|
.dport0.rodata : ALIGN(4)
|
|
|
|
{
|
|
|
|
_dport0_rodata_start = ABSOLUTE(.);
|
|
|
|
*(.dport0.rodata)
|
|
|
|
*(.dport.rodata)
|
|
|
|
_dport0_rodata_end = ABSOLUTE(.);
|
|
|
|
} >dport0_0_seg :dport0_0_phdr
|
|
|
|
|
|
|
|
.dport0.literal : ALIGN(4)
|
|
|
|
{
|
|
|
|
_dport0_literal_start = ABSOLUTE(.);
|
|
|
|
*(.dport0.literal)
|
|
|
|
*(.dport.literal)
|
|
|
|
_dport0_literal_end = ABSOLUTE(.);
|
|
|
|
} >dport0_0_seg :dport0_0_phdr
|
|
|
|
|
|
|
|
.dport0.data : ALIGN(4)
|
|
|
|
{
|
|
|
|
_dport0_data_start = ABSOLUTE(.);
|
|
|
|
*(.dport0.data)
|
|
|
|
*(.dport.data)
|
|
|
|
_dport0_data_end = ABSOLUTE(.);
|
|
|
|
} >dport0_0_seg :dport0_0_phdr
|
|
|
|
|
|
|
|
.data : ALIGN(4)
|
|
|
|
{
|
|
|
|
_data_start = ABSOLUTE(.);
|
|
|
|
*(.data)
|
|
|
|
*(.data.*)
|
|
|
|
*(.gnu.linkonce.d.*)
|
|
|
|
*(.data1)
|
|
|
|
*(.sdata)
|
|
|
|
*(.sdata.*)
|
|
|
|
*(.gnu.linkonce.s.*)
|
|
|
|
*(.sdata2)
|
|
|
|
*(.sdata2.*)
|
|
|
|
*(.gnu.linkonce.s2.*)
|
|
|
|
*(.jcr)
|
|
|
|
_data_end = ABSOLUTE(.);
|
|
|
|
} >dram0_0_seg :dram0_0_phdr
|
|
|
|
|
|
|
|
.rodata : ALIGN(4)
|
|
|
|
{
|
|
|
|
_rodata_start = ABSOLUTE(.);
|
|
|
|
*(.rodata)
|
|
|
|
*(.rodata.*)
|
|
|
|
*(.gnu.linkonce.r.*)
|
|
|
|
*(.rodata1)
|
|
|
|
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
|
|
|
*(.xt_except_table)
|
|
|
|
*(.gcc_except_table)
|
|
|
|
*(.gnu.linkonce.e.*)
|
|
|
|
*(.gnu.version_r)
|
|
|
|
*(.eh_frame)
|
2015-07-30 17:34:13 +00:00
|
|
|
. = (. + 3) & ~ 3;
|
2015-04-30 04:00:03 +00:00
|
|
|
/* C++ constructor and destructor tables, properly ordered: */
|
2015-07-30 17:34:13 +00:00
|
|
|
__init_array_start = ABSOLUTE(.);
|
2015-04-30 04:00:03 +00:00
|
|
|
KEEP (*crtbegin.o(.ctors))
|
|
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
|
|
|
KEEP (*(SORT(.ctors.*)))
|
|
|
|
KEEP (*(.ctors))
|
2015-07-30 17:34:13 +00:00
|
|
|
__init_array_end = ABSOLUTE(.);
|
2015-04-30 04:00:03 +00:00
|
|
|
KEEP (*crtbegin.o(.dtors))
|
|
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
|
|
|
KEEP (*(SORT(.dtors.*)))
|
|
|
|
KEEP (*(.dtors))
|
|
|
|
/* C++ exception handlers table: */
|
|
|
|
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
|
|
|
*(.xt_except_desc)
|
|
|
|
*(.gnu.linkonce.h.*)
|
|
|
|
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
|
|
|
*(.xt_except_desc_end)
|
|
|
|
*(.dynamic)
|
|
|
|
*(.gnu.version_d)
|
|
|
|
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
|
|
|
_bss_table_start = ABSOLUTE(.);
|
|
|
|
LONG(_bss_start)
|
|
|
|
LONG(_bss_end)
|
|
|
|
_bss_table_end = ABSOLUTE(.);
|
|
|
|
_rodata_end = ABSOLUTE(.);
|
|
|
|
} >dram0_0_seg :dram0_0_phdr
|
|
|
|
|
|
|
|
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
|
|
|
{
|
|
|
|
. = ALIGN (8);
|
|
|
|
_bss_start = ABSOLUTE(.);
|
|
|
|
*(.dynsbss)
|
|
|
|
*(.sbss)
|
|
|
|
*(.sbss.*)
|
|
|
|
*(.gnu.linkonce.sb.*)
|
|
|
|
*(.scommon)
|
|
|
|
*(.sbss2)
|
|
|
|
*(.sbss2.*)
|
|
|
|
*(.gnu.linkonce.sb2.*)
|
|
|
|
*(.dynbss)
|
|
|
|
*(.bss)
|
|
|
|
*(.bss.*)
|
|
|
|
*(.gnu.linkonce.b.*)
|
|
|
|
*(COMMON)
|
|
|
|
. = ALIGN (8);
|
|
|
|
_bss_end = ABSOLUTE(.);
|
2015-06-15 06:51:06 +00:00
|
|
|
_heap_start = ABSOLUTE(.);
|
2015-04-30 04:00:03 +00:00
|
|
|
/* _stack_sentry = ALIGN(0x8); */
|
|
|
|
} >dram0_0_seg :dram0_0_bss_phdr
|
|
|
|
/* __stack = 0x3ffc8000; */
|
|
|
|
|
2015-07-09 03:48:47 +00:00
|
|
|
.text : ALIGN(4) /* IRAM */
|
2015-04-30 04:00:03 +00:00
|
|
|
{
|
|
|
|
_stext = .;
|
|
|
|
_text_start = ABSOLUTE(.);
|
|
|
|
. = ALIGN (16);
|
2015-07-28 01:01:57 +00:00
|
|
|
*(.vecbase.text)
|
2015-04-30 04:00:03 +00:00
|
|
|
*(.entry.text)
|
|
|
|
*(.init.literal)
|
|
|
|
*(.init)
|
2015-07-09 03:48:47 +00:00
|
|
|
/* esp-open-rtos compiled source files use the .iram1.* section names for IRAM
|
|
|
|
functions, etc. */
|
|
|
|
*(.iram1.*)
|
|
|
|
/* SDK libraries expect their .text sections to link to iram, not irom */
|
|
|
|
*sdklib*:*(.literal .text .literal.* .text.*)
|
2015-07-29 00:34:09 +00:00
|
|
|
/* libgcc integer functions also need to be in .text, as some are called before
|
2015-07-09 03:48:47 +00:00
|
|
|
flash is mapped (also performance)
|
|
|
|
*/
|
2015-07-29 00:34:09 +00:00
|
|
|
*libgcc.a:*i3.o(.literal .text .literal.* .text.*)
|
|
|
|
|
|
|
|
/* libc also in IRAM */
|
|
|
|
*libc.a:*malloc.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*mallocr.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*freer.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*memcpy.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*memset.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*memcmp.o(.literal .text .literal.* .text.*)
|
2015-08-10 01:53:37 +00:00
|
|
|
*libc.a:*memmove.o(.literal .text .literal.* .text.*)
|
2015-07-29 00:34:09 +00:00
|
|
|
*libc.a:*rand.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*bzero.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*lock.o(.literal .text .literal.* .text.*)
|
|
|
|
|
|
|
|
*libc.a:*printf.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*findfp.o(.literal .text .literal.* .text.*)
|
|
|
|
*libc.a:*fputwc.o(.literal .text .literal.* .text.*)
|
|
|
|
|
|
|
|
/* xthal_set_intset() called from PendSV in NMI context */
|
|
|
|
*libhal.a:*set_intset.o(.literal .text .literal.* .text.*)
|
2015-07-09 03:48:47 +00:00
|
|
|
|
|
|
|
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
2015-04-30 04:00:03 +00:00
|
|
|
*(.fini.literal)
|
|
|
|
*(.fini)
|
|
|
|
*(.gnu.version)
|
|
|
|
_text_end = ABSOLUTE(.);
|
|
|
|
_etext = .;
|
|
|
|
} >iram1_0_seg :iram1_0_phdr
|
|
|
|
|
2015-07-09 03:48:47 +00:00
|
|
|
.irom0.text : ALIGN(4)
|
|
|
|
{
|
|
|
|
_irom0_text_start = ABSOLUTE(.);
|
|
|
|
/* esp-open-rtos compiled code goes into IROM by default
|
|
|
|
(except for libgcc which is matched above.)
|
|
|
|
*/
|
|
|
|
*(.literal .text .literal.* .text.*)
|
2015-08-27 20:54:30 +00:00
|
|
|
/* Anything explicitly marked as "irom" or "irom0" should go here */
|
|
|
|
*(.irom.* .irom.*.* .irom0.*)
|
2015-07-09 03:48:47 +00:00
|
|
|
_irom0_text_end = ABSOLUTE(.);
|
|
|
|
} >irom0_0_seg :irom0_0_phdr
|
|
|
|
|
2015-04-30 04:00:03 +00:00
|
|
|
.lit4 : ALIGN(4)
|
|
|
|
{
|
|
|
|
_lit4_start = ABSOLUTE(.);
|
|
|
|
*(*.lit4)
|
|
|
|
*(.lit4.*)
|
|
|
|
*(.gnu.linkonce.lit4.*)
|
|
|
|
_lit4_end = ABSOLUTE(.);
|
|
|
|
} >iram1_0_seg :iram1_0_phdr
|
|
|
|
}
|