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