1/* 2 * linker script for STM32F10x with GNU ld 3 */ 4 5/* Program Entry, set to mark it as "used" and avoid gc */ 6MEMORY 7{ 8 ROM (rx) : ORIGIN = 0x08000000, LENGTH = 512k /* 128KB flash */ 9 RAM (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 20K sram */ 10} 11ENTRY(Reset_Handler) 12_system_stack_size = 0x400; 13 14SECTIONS 15{ 16 .text : 17 { 18 . = ALIGN(4); 19 _stext = .; 20 KEEP(*(.isr_vector)) /* Startup code */ 21 22 . = ALIGN(4); 23 *(.text) /* remaining code */ 24 *(.text.*) /* remaining code */ 25 *(.rodata) /* read-only data (constants) */ 26 *(.rodata*) 27 *(.glue_7) 28 *(.glue_7t) 29 *(.gnu.linkonce.t*) 30 31 /* section information for finsh shell */ 32 . = ALIGN(4); 33 __fsymtab_start = .; 34 KEEP(*(FSymTab)) 35 __fsymtab_end = .; 36 37 . = ALIGN(4); 38 __vsymtab_start = .; 39 KEEP(*(VSymTab)) 40 __vsymtab_end = .; 41 42 /* section information for initial. */ 43 . = ALIGN(4); 44 __rt_init_start = .; 45 KEEP(*(SORT(.rti_fn*))) 46 __rt_init_end = .; 47 48 . = ALIGN(4); 49 _etext = .; 50 } > ROM = 0 51 52 /* .ARM.exidx is sorted, so has to go in its own output section. */ 53 __exidx_start = .; 54 .ARM.exidx : 55 { 56 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 57 58 /* This is used by the startup in order to initialize the .data secion */ 59 _sidata = .; 60 } > ROM 61 __exidx_end = .; 62 63 /* .data section which is used for initialized data */ 64 65 .data : AT (_sidata) 66 { 67 . = ALIGN(4); 68 /* This is used by the startup in order to initialize the .data secion */ 69 _sdata = . ; 70 71 *(.data) 72 *(.data.*) 73 *(.gnu.linkonce.d*) 74 75 . = ALIGN(4); 76 /* This is used by the startup in order to initialize the .data secion */ 77 _edata = . ; 78 } >RAM 79 80 .stack : 81 { 82 . = ALIGN(4); 83 _sstack = .; 84 . = . + _system_stack_size; 85 . = ALIGN(4); 86 _estack = .; 87 } >RAM 88 89 __bss_start = .; 90 .bss : 91 { 92 . = ALIGN(4); 93 /* This is used by the startup in order to initialize the .bss secion */ 94 _sbss = .; 95 96 *(.bss) 97 *(.bss.*) 98 *(COMMON) 99 100 . = ALIGN(4); 101 /* This is used by the startup in order to initialize the .bss secion */ 102 _ebss = . ; 103 104 *(.bss.init) 105 } > RAM 106 __bss_end = .; 107 108 _end = .; 109 110 /* Stabs debugging sections. */ 111 .stab 0 : { *(.stab) } 112 .stabstr 0 : { *(.stabstr) } 113 .stab.excl 0 : { *(.stab.excl) } 114 .stab.exclstr 0 : { *(.stab.exclstr) } 115 .stab.index 0 : { *(.stab.index) } 116 .stab.indexstr 0 : { *(.stab.indexstr) } 117 .comment 0 : { *(.comment) } 118 /* DWARF debug sections. 119 * Symbols in the DWARF debugging sections are relative to the beginning 120 * of the section so we begin them at 0. */ 121 /* DWARF 1 */ 122 .debug 0 : { *(.debug) } 123 .line 0 : { *(.line) } 124 /* GNU DWARF 1 extensions */ 125 .debug_srcinfo 0 : { *(.debug_srcinfo) } 126 .debug_sfnames 0 : { *(.debug_sfnames) } 127 /* DWARF 1.1 and DWARF 2 */ 128 .debug_aranges 0 : { *(.debug_aranges) } 129 .debug_pubnames 0 : { *(.debug_pubnames) } 130 /* DWARF 2 */ 131 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 132 .debug_abbrev 0 : { *(.debug_abbrev) } 133 .debug_line 0 : { *(.debug_line) } 134 .debug_frame 0 : { *(.debug_frame) } 135 .debug_str 0 : { *(.debug_str) } 136 .debug_loc 0 : { *(.debug_loc) } 137 .debug_macinfo 0 : { *(.debug_macinfo) } 138 /* SGI/MIPS DWARF 2 extensions */ 139 .debug_weaknames 0 : { *(.debug_weaknames) } 140 .debug_funcnames 0 : { *(.debug_funcnames) } 141 .debug_typenames 0 : { *(.debug_typenames) } 142 .debug_varnames 0 : { *(.debug_varnames) } 143} 144