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