1/* 2 * linker script for HC32L196 with GNU ld 3 */ 4 5/* Program Entry, set to mark it as "used" and avoid gc */ 6MEMORY 7{ 8 ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256k /* 256KB flash */ 9 RAM (rw) : ORIGIN = 0x20000000, LENGTH = 32k /* 32KB 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 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 50 PROVIDE(__ctors_start__ = .); 51 KEEP (*(SORT(.init_array.*))) 52 KEEP (*(.init_array)) 53 PROVIDE(__ctors_end__ = .); 54 55 . = ALIGN(4); 56 57 _etext = .; 58 } > ROM = 0 59 60 /* .ARM.exidx is sorted, so has to go in its own output section. */ 61 __exidx_start = .; 62 .ARM.exidx : 63 { 64 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 65 66 /* This is used by the startup in order to initialize the .data secion */ 67 _sidata = .; 68 } > ROM 69 __exidx_end = .; 70 71 /* .data section which is used for initialized data */ 72 73 .data : AT (_sidata) 74 { 75 . = ALIGN(4); 76 /* This is used by the startup in order to initialize the .data secion */ 77 _sdata = . ; 78 79 *(.data) 80 *(.data.*) 81 *(.gnu.linkonce.d*) 82 83 84 PROVIDE(__dtors_start__ = .); 85 KEEP(*(SORT(.dtors.*))) 86 KEEP(*(.dtors)) 87 PROVIDE(__dtors_end__ = .); 88 89 . = ALIGN(4); 90 /* This is used by the startup in order to initialize the .data secion */ 91 _edata = . ; 92 } > RAM 93 94 .stack : 95 { 96 . = ALIGN(4); 97 _sstack = .; 98 . = . + _system_stack_size; 99 . = ALIGN(4); 100 _estack = .; 101 } > RAM 102 103 __bss_start = .; 104 .bss : 105 { 106 . = ALIGN(4); 107 /* This is used by the startup in order to initialize the .bss secion */ 108 _sbss = .; 109 110 *(.bss) 111 *(.bss.*) 112 *(COMMON) 113 114 . = ALIGN(4); 115 /* This is used by the startup in order to initialize the .bss secion */ 116 _ebss = . ; 117 118 *(.bss.init) 119 } > RAM 120 __bss_end = .; 121 122 _end = .; 123 124 /* Stabs debugging sections. */ 125 .stab 0 : { *(.stab) } 126 .stabstr 0 : { *(.stabstr) } 127 .stab.excl 0 : { *(.stab.excl) } 128 .stab.exclstr 0 : { *(.stab.exclstr) } 129 .stab.index 0 : { *(.stab.index) } 130 .stab.indexstr 0 : { *(.stab.indexstr) } 131 .comment 0 : { *(.comment) } 132 /* DWARF debug sections. 133 * Symbols in the DWARF debugging sections are relative to the beginning 134 * of the section so we begin them at 0. */ 135 /* DWARF 1 */ 136 .debug 0 : { *(.debug) } 137 .line 0 : { *(.line) } 138 /* GNU DWARF 1 extensions */ 139 .debug_srcinfo 0 : { *(.debug_srcinfo) } 140 .debug_sfnames 0 : { *(.debug_sfnames) } 141 /* DWARF 1.1 and DWARF 2 */ 142 .debug_aranges 0 : { *(.debug_aranges) } 143 .debug_pubnames 0 : { *(.debug_pubnames) } 144 /* DWARF 2 */ 145 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 146 .debug_abbrev 0 : { *(.debug_abbrev) } 147 .debug_line 0 : { *(.debug_line) } 148 .debug_frame 0 : { *(.debug_frame) } 149 .debug_str 0 : { *(.debug_str) } 150 .debug_loc 0 : { *(.debug_loc) } 151 .debug_macinfo 0 : { *(.debug_macinfo) } 152 /* SGI/MIPS DWARF 2 extensions */ 153 .debug_weaknames 0 : { *(.debug_weaknames) } 154 .debug_funcnames 0 : { *(.debug_funcnames) } 155 .debug_typenames 0 : { *(.debug_typenames) } 156 .debug_varnames 0 : { *(.debug_varnames) } 157} 158