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