1ENTRY( _start ) 2 3__stack_size = 2048; 4 5PROVIDE( _stack_size = __stack_size ); 6 7 8MEMORY 9{ 10 FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 64K 11 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K 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 } >FLASH AT>FLASH 70 71 .fini : 72 { 73 KEEP(*(SORT_NONE(.fini))) 74 . = ALIGN(4); 75 } >FLASH AT>FLASH 76 77 PROVIDE( _etext = . ); 78 PROVIDE( _eitcm = . ); 79 80 .preinit_array : 81 { 82 PROVIDE_HIDDEN (__preinit_array_start = .); 83 KEEP (*(.preinit_array)) 84 PROVIDE_HIDDEN (__preinit_array_end = .); 85 } >FLASH AT>FLASH 86 87 .init_array : 88 { 89 PROVIDE_HIDDEN (__init_array_start = .); 90 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 91 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) 92 PROVIDE_HIDDEN (__init_array_end = .); 93 } >FLASH AT>FLASH 94 95 .fini_array : 96 { 97 PROVIDE_HIDDEN (__fini_array_start = .); 98 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 99 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) 100 PROVIDE_HIDDEN (__fini_array_end = .); 101 } >FLASH AT>FLASH 102 103 .ctors : 104 { 105 /* gcc uses crtbegin.o to find the start of 106 the constructors, so we make sure it is 107 first. Because this is a wildcard, it 108 doesn't matter if the user does not 109 actually link against crtbegin.o; the 110 linker won't look for a file to match a 111 wildcard. The wildcard also means that it 112 doesn't matter which directory crtbegin.o 113 is in. */ 114 KEEP (*crtbegin.o(.ctors)) 115 KEEP (*crtbegin?.o(.ctors)) 116 /* We don't want to include the .ctor section from 117 the crtend.o file until after the sorted ctors. 118 The .ctor section from the crtend file contains the 119 end of ctors marker and it must be last */ 120 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 121 KEEP (*(SORT(.ctors.*))) 122 KEEP (*(.ctors)) 123 } >FLASH AT>FLASH 124 125 .dtors : 126 { 127 KEEP (*crtbegin.o(.dtors)) 128 KEEP (*crtbegin?.o(.dtors)) 129 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 130 KEEP (*(SORT(.dtors.*))) 131 KEEP (*(.dtors)) 132 } >FLASH AT>FLASH 133 134 .dalign : 135 { 136 . = ALIGN(4); 137 PROVIDE(_data_vma = .); 138 } >RAM AT>FLASH 139 140 .dlalign : 141 { 142 . = ALIGN(4); 143 PROVIDE(_data_lma = .); 144 } >FLASH AT>FLASH 145 146 .data : 147 { 148 *(.gnu.linkonce.r.*) 149 *(.data .data.*) 150 *(.gnu.linkonce.d.*) 151 . = ALIGN(8); 152 PROVIDE( __global_pointer$ = . + 0x800 ); 153 *(.sdata .sdata.*) 154 *(.sdata2.*) 155 *(.gnu.linkonce.s.*) 156 . = ALIGN(8); 157 *(.srodata.cst16) 158 *(.srodata.cst8) 159 *(.srodata.cst4) 160 *(.srodata.cst2) 161 *(.srodata .srodata.*) 162 . = ALIGN(4); 163 PROVIDE( _edata = .); 164 } >RAM AT>FLASH 165 166 .bss : 167 { 168 . = ALIGN(4); 169 PROVIDE( _sbss = .); 170 *(.sbss*) 171 *(.gnu.linkonce.sb.*) 172 *(.bss*) 173 *(.gnu.linkonce.b.*) 174 *(COMMON*) 175 . = ALIGN(4); 176 PROVIDE( _ebss = .); 177 } >RAM AT>FLASH 178 179 PROVIDE( _end = _ebss); 180 PROVIDE( end = . ); 181 182 .stack ORIGIN(RAM) + LENGTH(RAM) - __stack_size : 183 { 184 PROVIDE( _heap_end = . ); 185 . = ALIGN(4); 186 PROVIDE(_susrstack = . ); 187 . = . + __stack_size; 188 PROVIDE( _eusrstack = .); 189 PROVIDE( __rt_rvstack = .); 190 } >RAM 191 192} 193 194 195 196