1/* 2 * linker script for LPC1768 (512kB Flash, 32kB + 32kB SRAM ) with GNU ld 3 * bernard.xiong 2012-01-13 4 */ 5 6/* Program Entry, set to mark it as "used" and avoid gc */ 7MEMORY 8{ 9 CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000 10 DATA (rw) : ORIGIN = 0x10000000, LENGTH = 0x00008000 11} 12ENTRY(Reset_Handler) 13_system_stack_size = 0x200; 14 15SECTIONS 16{ 17 .text : 18 { 19 . = ALIGN(4); 20 KEEP(*(.interrupt_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 40 . = ALIGN(4); 41 __rt_init_start = .; 42 KEEP(*(SORT(.rti_fn*))) 43 __rt_init_end = .; 44 . = ALIGN(4); 45 46 PROVIDE(__ctors_start__ = .); 47 /* old GCC version uses .ctors */ 48 KEEP(*(SORT(.ctors.*))) 49 KEEP(*(.ctors)) 50 /* new GCC version uses .init_array */ 51 KEEP (*(SORT(.init_array.*))) 52 KEEP (*(.init_array)) 53 PROVIDE(__ctors_end__ = .); 54 55 /* section information for modules */ 56 . = ALIGN(4); 57 __rtmsymtab_start = .; 58 KEEP(*(RTMSymTab)) 59 __rtmsymtab_end = .; 60 61 . = ALIGN(4); 62 _etext = .; 63 } > CODE = 0 64 65 /* .ARM.exidx is sorted, so has to go in its own output section. */ 66 __exidx_start = .; 67 .ARM.exidx : 68 { 69 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 70 71 /* This is used by the startup in order to initialize the .data secion */ 72 _sidata = .; 73 } > CODE 74 __exidx_end = .; 75 76 /* .data section which is used for initialized data */ 77 78 .data : AT (_sidata) 79 { 80 . = ALIGN(4); 81 /* This is used by the startup in order to initialize the .data secion */ 82 _sdata = . ; 83 84 *(.data) 85 *(.data.*) 86 *(.gnu.linkonce.d*) 87 88 . = ALIGN(4); 89 /* This is used by the startup in order to initialize the .data secion */ 90 _edata = . ; 91 } >DATA 92 93 .stack : 94 { 95 . = . + _system_stack_size; 96 . = ALIGN(4); 97 _estack = .; 98 } >DATA 99 100 __bss_start = .; 101 .bss : 102 { 103 . = ALIGN(4); 104 /* This is used by the startup in order to initialize the .bss secion */ 105 _sbss = .; 106 107 *(.bss) 108 *(.bss.*) 109 *(COMMON) 110 111 . = ALIGN(4); 112 /* This is used by the startup in order to initialize the .bss secion */ 113 _ebss = . ; 114 *(.bss.init) 115 } > DATA 116 __bss_end = .; 117 118 _end = .; 119 120 /* Stabs debugging sections. */ 121 .stab 0 : { *(.stab) } 122 .stabstr 0 : { *(.stabstr) } 123 .stab.excl 0 : { *(.stab.excl) } 124 .stab.exclstr 0 : { *(.stab.exclstr) } 125 .stab.index 0 : { *(.stab.index) } 126 .stab.indexstr 0 : { *(.stab.indexstr) } 127 .comment 0 : { *(.comment) } 128 /* DWARF debug sections. 129 * Symbols in the DWARF debugging sections are relative to the beginning 130 * of the section so we begin them at 0. */ 131 /* DWARF 1 */ 132 .debug 0 : { *(.debug) } 133 .line 0 : { *(.line) } 134 /* GNU DWARF 1 extensions */ 135 .debug_srcinfo 0 : { *(.debug_srcinfo) } 136 .debug_sfnames 0 : { *(.debug_sfnames) } 137 /* DWARF 1.1 and DWARF 2 */ 138 .debug_aranges 0 : { *(.debug_aranges) } 139 .debug_pubnames 0 : { *(.debug_pubnames) } 140 /* DWARF 2 */ 141 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 142 .debug_abbrev 0 : { *(.debug_abbrev) } 143 .debug_line 0 : { *(.debug_line) } 144 .debug_frame 0 : { *(.debug_frame) } 145 .debug_str 0 : { *(.debug_str) } 146 .debug_loc 0 : { *(.debug_loc) } 147 .debug_macinfo 0 : { *(.debug_macinfo) } 148 /* SGI/MIPS DWARF 2 extensions */ 149 .debug_weaknames 0 : { *(.debug_weaknames) } 150 .debug_funcnames 0 : { *(.debug_funcnames) } 151 .debug_typenames 0 : { *(.debug_typenames) } 152 .debug_varnames 0 : { *(.debug_varnames) } 153} 154