1/* 2 * linker script for STM32F4xx with GNU ld 3 * bernard.xiong 2009-10-14 4 */ 5 6/* Program Entry, set to mark it as "used" and avoid gc */ 7MEMORY 8{ 9 ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K 10 DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 11 FLASH (rx) : ORIGIN = 0x90000000, LENGTH = 1M 12 RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K 13 RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K 14 RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K 15} 16ENTRY(Reset_Handler) 17_system_stack_size = 0x400; 18 19SECTIONS 20{ 21 .ram_d1(NOLOAD) : { 22 . = ALIGN(4); 23 *(.ram_d1) 24 *(.ram_d1.*) 25 . = ALIGN(4); 26 } >RAM_D1 27 28 .ram_d2(NOLOAD) : { 29 . = ALIGN(4); 30 *(.ram_d2) 31 *(.ram_d2.*) 32 . = ALIGN(4); 33 } >RAM_D2 34 35 .ram_d3(NOLOAD) : { 36 . = ALIGN(4); 37 *(.ram_d3) 38 *(.ram_d3.*) 39 . = ALIGN(4); 40 } >RAM_D3 41 42 _ramfunc_start_lma = LOADADDR(.ramfunc); 43 .ramfunc : { 44 . = ALIGN(4); 45 _ramfunc_start_vma = .; 46 *(.RamFunc) /* .RamFunc sections */ 47 *(.RamFunc*) /* .RamFunc* sections */ 48 . = ALIGN(4); 49 _ramfunc_end = .; /* define a global symbol at data end */ 50 } >ITCMRAM AT>FLASH 51 52 .text : 53 { 54 . = ALIGN(4); 55 _stext = .; 56 KEEP(*(.isr_vector)) /* Startup code */ 57 58 . = ALIGN(4); 59 *(.text) /* remaining code */ 60 *(.text.*) /* remaining code */ 61 *(.rodata) /* read-only data (constants) */ 62 *(.rodata*) 63 *(.glue_7) 64 *(.glue_7t) 65 *(.gnu.linkonce.t*) 66 67 /* section information for finsh shell */ 68 . = ALIGN(4); 69 __fsymtab_start = .; 70 KEEP(*(FSymTab)) 71 __fsymtab_end = .; 72 73 . = ALIGN(4); 74 __vsymtab_start = .; 75 KEEP(*(VSymTab)) 76 __vsymtab_end = .; 77 78 /* section information for utest */ 79 . = ALIGN(4); 80 __rt_utest_tc_tab_start = .; 81 KEEP(*(UtestTcTab)) 82 __rt_utest_tc_tab_end = .; 83 84 /* section information for at server */ 85 . = ALIGN(4); 86 __rtatcmdtab_start = .; 87 KEEP(*(RtAtCmdTab)) 88 __rtatcmdtab_end = .; 89 . = ALIGN(4); 90 91 /* section information for modules */ 92 . = ALIGN(4); 93 __rtmsymtab_start = .; 94 KEEP(*(RTMSymTab)) 95 __rtmsymtab_end = .; 96 97 /* section information for initial. */ 98 . = ALIGN(4); 99 __rt_init_start = .; 100 KEEP(*(SORT(.rti_fn*))) 101 __rt_init_end = .; 102 103 . = ALIGN(4); 104 105 PROVIDE(__ctors_start__ = .); 106 KEEP (*(SORT(.init_array.*))) 107 KEEP (*(.init_array)) 108 PROVIDE(__ctors_end__ = .); 109 110 PROVIDE(__dtors_start__ = .); 111 KEEP (*(SORT(.fini_array.*))) 112 KEEP (*(.fini_array)) 113 KEEP(*(SORT(.dtors.*))) 114 KEEP(*(.dtors)) 115 PROVIDE(__dtors_end__ = .); 116 117 . = ALIGN(4); 118 119 _etext = .; 120 } >FLASH 121 122 /* .ARM.exidx is sorted, so has to go in its own output section. */ 123 .ARM.exidx : 124 { 125 . = ALIGN(4); 126 __exidx_start = .; 127 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 128 *(.ARM.extab*) 129 . = ALIGN(4); 130 __exidx_end = .; 131 } >FLASH 132 133 /* .data section which is used for initialized data */ 134 135 _sidata = LOADADDR(.data); 136 _data_start_lma = LOADADDR(.data); 137 .data : 138 { 139 . = ALIGN(4); 140 /* This is used by the startup in order to initialize the .data secion */ 141 _sdata = . ; 142 _data_start_vma = .; 143 144 *(.data) 145 *(.data.*) 146 *(.gnu.linkonce.d*) 147 148 149 . = ALIGN(4); 150 /* This is used by the startup in order to initialize the .data secion */ 151 _edata = . ; 152 _data_end = .; 153 } >DTCMRAM AT>FLASH 154 155 __bss_start = .; 156 .bss (NOLOAD): 157 { 158 . = ALIGN(4); 159 /* This is used by the startup in order to initialize the .bss secion */ 160 _sbss = .; 161 162 *(.bss) 163 *(.bss.*) 164 *(COMMON) 165 166 . = ALIGN(4); 167 /* This is used by the startup in order to initialize the .bss secion */ 168 _ebss = . ; 169 170 *(.bss.init) 171 } > DTCMRAM 172 __bss_end = .; 173 _heap_start = .; 174 _end = .; 175 176 _heap_end = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM) - _system_stack_size; 177 _sstack = _heap_end; 178 _estack = _heap_end + _system_stack_size; 179 180 /* Stabs debugging sections. */ 181 .stab 0 : { *(.stab) } 182 .stabstr 0 : { *(.stabstr) } 183 .stab.excl 0 : { *(.stab.excl) } 184 .stab.exclstr 0 : { *(.stab.exclstr) } 185 .stab.index 0 : { *(.stab.index) } 186 .stab.indexstr 0 : { *(.stab.indexstr) } 187 .comment 0 : { *(.comment) } 188 /* DWARF debug sections. 189 * Symbols in the DWARF debugging sections are relative to the beginning 190 * of the section so we begin them at 0. */ 191 /* DWARF 1 */ 192 .debug 0 : { *(.debug) } 193 .line 0 : { *(.line) } 194 /* GNU DWARF 1 extensions */ 195 .debug_srcinfo 0 : { *(.debug_srcinfo) } 196 .debug_sfnames 0 : { *(.debug_sfnames) } 197 /* DWARF 1.1 and DWARF 2 */ 198 .debug_aranges 0 : { *(.debug_aranges) } 199 .debug_pubnames 0 : { *(.debug_pubnames) } 200 /* DWARF 2 */ 201 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 202 .debug_abbrev 0 : { *(.debug_abbrev) } 203 .debug_line 0 : { *(.debug_line) } 204 .debug_frame 0 : { *(.debug_frame) } 205 .debug_str 0 : { *(.debug_str) } 206 .debug_loc 0 : { *(.debug_loc) } 207 .debug_macinfo 0 : { *(.debug_macinfo) } 208 /* SGI/MIPS DWARF 2 extensions */ 209 .debug_weaknames 0 : { *(.debug_weaknames) } 210 .debug_funcnames 0 : { *(.debug_funcnames) } 211 .debug_typenames 0 : { *(.debug_typenames) } 212 .debug_varnames 0 : { *(.debug_varnames) } 213} 214