1/* Linker script to configure memory regions. */ 2 3MEMORY { 4 FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K 5 SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 96K 6} 7 8 9SECTIONS { 10 .text : 11 { 12 _text = .; 13 KEEP(*(.isr_vector)) 14 *(.text*) /* program code */ 15 *(.rodata*) /* read-only data: "const" */ 16 17 KEEP(*(.init)) 18 KEEP(*(.fini)) 19 20 /* C++ Exception handling */ 21 KEEP(*(.eh_frame*)) 22 23 /* section information for finsh shell */ 24 . = ALIGN(4); 25 __fsymtab_start = .; 26 KEEP(*(FSymTab)) 27 __fsymtab_end = .; 28 29 . = ALIGN(4); 30 __vsymtab_start = .; 31 KEEP(*(VSymTab)) 32 __vsymtab_end = .; 33 34 /* section information for initial. */ 35 . = ALIGN(4); 36 __rt_init_start = .; 37 KEEP(*(SORT(.rti_fn*))) 38 __rt_init_end = .; 39 40 . = ALIGN(4); 41 42 PROVIDE(__ctors_start__ = .); 43 KEEP (*(SORT(.init_array.*))) 44 KEEP (*(.init_array)) 45 PROVIDE(__ctors_end__ = .); 46 47 . = ALIGN(4); 48 49 _etext = .; 50 } > FLASH 51 52 /* it's used for C++ exception handling */ 53 /* we need to keep this to avoid overlapping */ 54 .ARM.exidx : 55 { 56 __exidx_start = .; 57 *(.ARM.exidx*) 58 __exidx_end = .; 59 } > FLASH 60 61 .data : 62 { 63 _data = ALIGN(., 4); 64 *(.data*) /*read-write initialized data: initialized global variable*/ 65 *(.spix_config*) /* SPIX configuration functions need to be run from SRAM */ 66 67 /* These array sections are used by __libc_init_array to call static C++ constructors */ 68 . = ALIGN(4); 69 /* preinit data */ 70 PROVIDE_HIDDEN (__preinit_array_start = .); 71 KEEP(*(.preinit_array)) 72 PROVIDE_HIDDEN (__preinit_array_end = .); 73 74 . = ALIGN(4); 75 /* init data */ 76 PROVIDE_HIDDEN (__init_array_start = .); 77 KEEP(*(SORT(.init_array.*))) 78 KEEP(*(.init_array)) 79 PROVIDE_HIDDEN (__init_array_end = .); 80 81 . = ALIGN(4); 82 /* finit data */ 83 PROVIDE_HIDDEN (__fini_array_start = .); 84 KEEP(*(SORT(.fini_array.*))) 85 KEEP(*(.fini_array)) 86 PROVIDE_HIDDEN (__fini_array_end = .); 87 88 _edata = ALIGN(., 4); 89 } > SRAM AT>FLASH 90 __load_data = LOADADDR(.data); 91 92 .bss : 93 { 94 . = ALIGN(4); 95 _bss = .; 96 *(.bss*) /*read-write zero initialized data: uninitialzed global variable*/ 97 *(COMMON) 98 _ebss = ALIGN(., 4); 99 } > SRAM 100 101 /* Set stack top to end of RAM, and stack limit move down by 102 * size of stack_dummy section */ 103 __StackTop = ORIGIN(SRAM) + LENGTH(SRAM); 104 __StackLimit = __StackTop - SIZEOF(.stack_dummy); 105 106 /* .stack_dummy section doesn't contains any symbols. It is only 107 * used for linker to calculate size of stack sections, and assign 108 * values to stack symbols later */ 109 .stack_dummy (COPY): 110 { 111 *(.stack*) 112 } > SRAM 113 114 .heap (COPY): 115 { 116 . = ALIGN(4); 117 *(.heap*) 118 __HeapLimit = ABSOLUTE(__StackLimit); 119 } > SRAM 120 121 PROVIDE(__stack = __StackTop); 122 123 /* Check if data + heap + stack exceeds RAM limit */ 124 ASSERT(__StackLimit >= _ebss, "region RAM overflowed with stack") 125} 126 127 128 129 130