123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- /* Linker script to configure memory regions. */
- MEMORY {
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
- SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 96K
- }
- SECTIONS {
- .text :
- {
- _text = .;
- KEEP(*(.isr_vector))
- *(.text*) /* program code */
- *(.rodata*) /* read-only data: "const" */
- KEEP(*(.init))
- KEEP(*(.fini))
- /* C++ Exception handling */
- KEEP(*(.eh_frame*))
- /* 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 = .;
- . = ALIGN(4);
- PROVIDE(__ctors_start__ = .);
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- PROVIDE(__ctors_end__ = .);
- . = ALIGN(4);
- _etext = .;
- } > FLASH
- /* it's used for C++ exception handling */
- /* we need to keep this to avoid overlapping */
- .ARM.exidx :
- {
- __exidx_start = .;
- *(.ARM.exidx*)
- __exidx_end = .;
- } > FLASH
- .data :
- {
- _data = ALIGN(., 4);
- *(.data*) /*read-write initialized data: initialized global variable*/
- *(.spix_config*) /* SPIX configuration functions need to be run from SRAM */
- /* These array sections are used by __libc_init_array to call static C++ constructors */
- . = 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 = .);
- _edata = ALIGN(., 4);
- } > SRAM AT>FLASH
- __load_data = LOADADDR(.data);
- .bss :
- {
- . = ALIGN(4);
- _bss = .;
- *(.bss*) /*read-write zero initialized data: uninitialzed global variable*/
- *(COMMON)
- _ebss = ALIGN(., 4);
- } > SRAM
- /* Set stack top to end of RAM, and stack limit move down by
- * size of stack_dummy section */
- __StackTop = ORIGIN(SRAM) + LENGTH(SRAM);
- __StackLimit = __StackTop - SIZEOF(.stack_dummy);
- /* .stack_dummy section doesn't contains any symbols. It is only
- * used for linker to calculate size of stack sections, and assign
- * values to stack symbols later */
- .stack_dummy (COPY):
- {
- *(.stack*)
- } > SRAM
- .heap (COPY):
- {
- . = ALIGN(4);
- *(.heap*)
- __HeapLimit = ABSOLUTE(__StackLimit);
- } > SRAM
- PROVIDE(__stack = __StackTop);
- /* Check if data + heap + stack exceeds RAM limit */
- ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack")
- }
|