1ENTRY( _start ) 2 3__stack_size = 2048; 4 5PROVIDE( _stack_size = __stack_size ); 6 7 8MEMORY 9{ 10 FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 224K 11 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K 12} 13 14 15SECTIONS 16{ 17 18 .init : 19 { 20 _sinit = .; 21 . = ALIGN(4); 22 KEEP(*(SORT_NONE(.init))) 23 . = ALIGN(4); 24 _einit = .; 25 } >FLASH AT>FLASH 26 27 .vector : 28 { 29 *(.vector); 30 . = ALIGN(64); 31 } >FLASH AT>FLASH 32 33 .text : 34 { 35 . = ALIGN(4); 36 *(.text) 37 *(.text.*) 38 *(.rodata) 39 *(.rodata*) 40 *(.glue_7) 41 *(.glue_7t) 42 *(.gnu.linkonce.t.*) 43 44 /* section information for finsh shell */ 45 . = ALIGN(4); 46 __fsymtab_start = .; 47 KEEP(*(FSymTab)) 48 __fsymtab_end = .; 49 . = ALIGN(4); 50 __vsymtab_start = .; 51 KEEP(*(VSymTab)) 52 __vsymtab_end = .; 53 . = ALIGN(4); 54 55 /* section information for initial. */ 56 . = ALIGN(4); 57 __rt_init_start = .; 58 KEEP(*(SORT(.rti_fn*))) 59 __rt_init_end = .; 60 . = ALIGN(4); 61 62 /* section information for modules */ 63 . = ALIGN(4); 64 __rtmsymtab_start = .; 65 KEEP(*(RTMSymTab)) 66 __rtmsymtab_end = .; 67 . = ALIGN(4); 68 69 /* section information for initial. */ 70 . = ALIGN(4); 71 __rt_init_start = .; 72 KEEP(*(SORT(.rti_fn*))) 73 __rt_init_end = .; 74 75 . = ALIGN(4); 76 77 PROVIDE(__ctors_start__ = .); 78 KEEP (*(SORT(.init_array.*))) 79 KEEP (*(.init_array)) 80 PROVIDE(__ctors_end__ = .); 81 82 . = ALIGN(4); 83 84 _etext = .; 85 86 } >FLASH AT>FLASH 87 88 .fini : 89 { 90 KEEP(*(SORT_NONE(.fini))) 91 . = ALIGN(4); 92 } >FLASH AT>FLASH 93 94 PROVIDE( _etext = . ); 95 PROVIDE( _eitcm = . ); 96 97 .preinit_array : 98 { 99 PROVIDE_HIDDEN (__preinit_array_start = .); 100 KEEP (*(.preinit_array)) 101 PROVIDE_HIDDEN (__preinit_array_end = .); 102 } >FLASH AT>FLASH 103 104 .init_array : 105 { 106 PROVIDE_HIDDEN (__init_array_start = .); 107 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 108 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) 109 PROVIDE_HIDDEN (__init_array_end = .); 110 } >FLASH AT>FLASH 111 112 .fini_array : 113 { 114 PROVIDE_HIDDEN (__fini_array_start = .); 115 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 116 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) 117 PROVIDE_HIDDEN (__fini_array_end = .); 118 } >FLASH AT>FLASH 119 120 .ctors : 121 { 122 /* gcc uses crtbegin.o to find the start of 123 the constructors, so we make sure it is 124 first. Because this is a wildcard, it 125 doesn't matter if the user does not 126 actually link against crtbegin.o; the 127 linker won't look for a file to match a 128 wildcard. The wildcard also means that it 129 doesn't matter which directory crtbegin.o 130 is in. */ 131 KEEP (*crtbegin.o(.ctors)) 132 KEEP (*crtbegin?.o(.ctors)) 133 /* We don't want to include the .ctor section from 134 the crtend.o file until after the sorted ctors. 135 The .ctor section from the crtend file contains the 136 end of ctors marker and it must be last */ 137 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 138 KEEP (*(SORT(.ctors.*))) 139 KEEP (*(.ctors)) 140 } >FLASH AT>FLASH 141 142 .dtors : 143 { 144 KEEP (*crtbegin.o(.dtors)) 145 KEEP (*crtbegin?.o(.dtors)) 146 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 147 KEEP (*(SORT(.dtors.*))) 148 KEEP (*(.dtors)) 149 } >FLASH AT>FLASH 150 151 .dalign : 152 { 153 . = ALIGN(4); 154 PROVIDE(_data_vma = .); 155 } >RAM AT>FLASH 156 157 .dlalign : 158 { 159 . = ALIGN(4); 160 PROVIDE(_data_lma = .); 161 } >FLASH AT>FLASH 162 163 .data : 164 { 165 *(.gnu.linkonce.r.*) 166 *(.data .data.*) 167 *(.gnu.linkonce.d.*) 168 . = ALIGN(8); 169 PROVIDE( __global_pointer$ = . + 0x800 ); 170 *(.sdata .sdata.*) 171 *(.sdata2.*) 172 *(.gnu.linkonce.s.*) 173 . = ALIGN(8); 174 *(.srodata.cst16) 175 *(.srodata.cst8) 176 *(.srodata.cst4) 177 *(.srodata.cst2) 178 *(.srodata .srodata.*) 179 . = ALIGN(4); 180 PROVIDE( _edata = .); 181 } >RAM AT>FLASH 182 183 .bss : 184 { 185 . = ALIGN(4); 186 PROVIDE( _sbss = .); 187 *(.sbss*) 188 *(.gnu.linkonce.sb.*) 189 *(.bss*) 190 *(.gnu.linkonce.b.*) 191 *(COMMON*) 192 . = ALIGN(4); 193 PROVIDE( _ebss = .); 194 } >RAM AT>FLASH 195 196 PROVIDE( _end = _ebss); 197 PROVIDE( end = . ); 198 199 .stack ORIGIN(RAM) + LENGTH(RAM) - __stack_size : 200 { 201 PROVIDE( _heap_end = . ); 202 . = ALIGN(4); 203 PROVIDE(_susrstack = . ); 204 . = . + __stack_size; 205 PROVIDE( _eusrstack = .); 206 PROVIDE( __rt_rvstack = . ); 207 } >RAM 208 209} 210