2023-01-09 10:16:47 +08:00
|
|
|
/* Linker script to configure memory regions.
|
|
|
|
* Need modifying for a specific board.
|
2019-03-27 16:49:26 +08:00
|
|
|
* FLASH.ORIGIN: starting address of flash
|
|
|
|
* FLASH.LENGTH: length of flash
|
|
|
|
* RAM.ORIGIN: starting address of RAM bank 0
|
|
|
|
* RAM.LENGTH: length of RAM bank 0
|
|
|
|
*/
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
2019-08-03 10:39:03 +08:00
|
|
|
FLASH (rx) : ORIGIN = 0x8010100, LENGTH = 959K /* 960K-256B */
|
|
|
|
RAM (rw) : ORIGIN = 0x20000000, LENGTH = 0x28000 /* 160K */
|
2019-08-11 15:18:37 +08:00
|
|
|
RAM2 (rw) : ORIGIN = 0x20028000, LENGTH = 0x14000 /* 80K */
|
2019-03-27 16:49:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Linker script to place sections and symbol values. Should be used together
|
|
|
|
* with other linker script that defines memory regions FLASH and RAM.
|
|
|
|
* It references following symbols, which must be defined in code:
|
|
|
|
* Reset_Handler : Entry of reset handler
|
2023-01-09 10:16:47 +08:00
|
|
|
*
|
2019-03-27 16:49:26 +08:00
|
|
|
* It defines following symbols, which code can use without definition:
|
|
|
|
* __exidx_start
|
|
|
|
* __exidx_end
|
|
|
|
* __copy_table_start__
|
|
|
|
* __copy_table_end__
|
|
|
|
* __zero_table_start__
|
|
|
|
* __zero_table_end__
|
|
|
|
* __etext
|
|
|
|
* __data_start__
|
|
|
|
* __preinit_array_start
|
|
|
|
* __preinit_array_end
|
|
|
|
* __init_array_start
|
|
|
|
* __init_array_end
|
|
|
|
* __fini_array_start
|
|
|
|
* __fini_array_end
|
|
|
|
* __data_end__
|
|
|
|
* __bss_start__
|
|
|
|
* __bss_end__
|
|
|
|
* __end__
|
|
|
|
* end
|
|
|
|
* __HeapLimit
|
|
|
|
* __StackLimit
|
|
|
|
* __StackTop
|
|
|
|
* __stack
|
|
|
|
*/
|
|
|
|
ENTRY(Reset_Handler)
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
.text :
|
|
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
|
|
_stext = .;
|
|
|
|
KEEP(*(.isr_vector))
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
|
|
|
*(.text) /* remaining code */
|
|
|
|
*(.text.*) /* remaining code */
|
|
|
|
*(.rodata) /* read-only data (constants) */
|
|
|
|
*(.rodata*)
|
|
|
|
*(.glue_7)
|
|
|
|
*(.glue_7t)
|
|
|
|
*(.gnu.linkonce.t*)
|
2023-01-09 10:16:47 +08:00
|
|
|
|
2019-03-27 16:49:26 +08:00
|
|
|
/* section information for finsh shell */
|
|
|
|
. = ALIGN(4);
|
|
|
|
__fsymtab_start = .;
|
|
|
|
KEEP(*(FSymTab))
|
|
|
|
__fsymtab_end = .;
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
__vsymtab_start = .;
|
|
|
|
KEEP(*(VSymTab))
|
|
|
|
__vsymtab_end = .;
|
|
|
|
|
|
|
|
/* section information for initial. */
|
|
|
|
. = ALIGN(4);
|
|
|
|
__rt_init_start = .;
|
|
|
|
KEEP(*(SORT(.rti_fn*)))
|
|
|
|
__rt_init_end = .;
|
|
|
|
|
2019-08-03 10:39:03 +08:00
|
|
|
. = ALIGN(4);
|
|
|
|
__rtatcmdtab_start = .;
|
|
|
|
KEEP(*(RtAtCmdTab))
|
|
|
|
__rtatcmdtab_end = .;
|
|
|
|
. = ALIGN(4);
|
|
|
|
|
2019-03-27 16:49:26 +08:00
|
|
|
. = ALIGN(4);
|
|
|
|
KEEP(*(.init))
|
|
|
|
KEEP(*(.fini))
|
|
|
|
|
|
|
|
/* .ctors */
|
|
|
|
*crtbegin.o(.ctors)
|
|
|
|
*crtbegin?.o(.ctors)
|
|
|
|
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
|
|
|
*(SORT(.ctors.*))
|
|
|
|
*(.ctors)
|
|
|
|
|
|
|
|
/* .dtors */
|
|
|
|
*crtbegin.o(.dtors)
|
|
|
|
*crtbegin?.o(.dtors)
|
|
|
|
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
|
|
|
*(SORT(.dtors.*))
|
|
|
|
*(.dtors)
|
|
|
|
|
|
|
|
*(.rodata*)
|
|
|
|
|
|
|
|
KEEP(*(.eh_frame*))
|
|
|
|
} > FLASH
|
|
|
|
|
2023-01-09 10:16:47 +08:00
|
|
|
.ARM.extab :
|
2019-03-27 16:49:26 +08:00
|
|
|
{
|
|
|
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
|
|
|
} > FLASH
|
|
|
|
|
|
|
|
__exidx_start = .;
|
|
|
|
.ARM.exidx :
|
|
|
|
{
|
|
|
|
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
|
|
|
} > FLASH
|
|
|
|
__exidx_end = .;
|
|
|
|
|
|
|
|
__etext = .;
|
|
|
|
|
|
|
|
.data : AT (__etext)
|
|
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
|
|
__data_start__ = .;
|
|
|
|
*(vtable)
|
|
|
|
*(.data*)
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
/* preinit data */
|
|
|
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
|
|
KEEP(*(.preinit_array))
|
|
|
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
/* init data */
|
|
|
|
PROVIDE_HIDDEN (__init_array_start = .);
|
|
|
|
KEEP(*(SORT(.init_array.*)))
|
|
|
|
KEEP(*(.init_array))
|
|
|
|
PROVIDE_HIDDEN (__init_array_end = .);
|
|
|
|
|
|
|
|
|
|
|
|
. = ALIGN(4);
|
|
|
|
/* finit data */
|
|
|
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
|
|
KEEP(*(SORT(.fini_array.*)))
|
|
|
|
KEEP(*(.fini_array))
|
|
|
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
|
|
|
|
|
|
KEEP(*(.jcr*))
|
|
|
|
. = ALIGN(4);
|
|
|
|
/* All data end */
|
|
|
|
__data_end__ = .;
|
|
|
|
|
|
|
|
} > RAM
|
|
|
|
|
|
|
|
.stack_dummy (COPY):
|
|
|
|
{
|
|
|
|
. = ALIGN(8);
|
|
|
|
__stack_start__ = .;
|
|
|
|
*(.stack*)
|
|
|
|
__stack_end__ = .;
|
|
|
|
} > RAM
|
|
|
|
|
2019-08-11 15:18:37 +08:00
|
|
|
._bss :
|
|
|
|
{
|
|
|
|
. = ALIGN(8);
|
|
|
|
__bss2_start__ = .;
|
|
|
|
__bss2_end__ = .;
|
|
|
|
} > RAM2
|
|
|
|
|
2019-03-27 16:49:26 +08:00
|
|
|
.bss __stack_end__ :
|
|
|
|
{
|
|
|
|
. = ALIGN(4);
|
|
|
|
__bss_start__ = .;
|
|
|
|
*(.bss*)
|
|
|
|
*(COMMON)
|
|
|
|
. = ALIGN(4);
|
|
|
|
__bss_end__ = .;
|
2023-01-09 10:16:47 +08:00
|
|
|
} > RAM
|
2019-03-27 16:49:26 +08:00
|
|
|
|
|
|
|
ASSERT(__StackTop <= 0x20028000, "stack address error")
|
|
|
|
}
|