1/* 2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17/****************************************************************************** 18 * @file gcc_csky.ld 19 * @brief csky linker file 20 * @version V1.0 21 * @date 02. June 2017 22 ******************************************************************************/ 23MEMORY 24{ 25 I-SRAM : ORIGIN = 0x080d0400 , LENGTH = 0x120000 /* I-SRAM 1M+128KB */ 26 D-SRAM : ORIGIN = 0x20000100 , LENGTH = 0x47f00 /* D-SRAM 288KB */ 27 V-SRAM : ORIGIN = 0x20000000 , LENGTH = 0x100 /* off-chip SRAM 8MB */ 28} 29 30__min_heap_size = 0x18000; 31PROVIDE (__ram_end = 0x2003A000); 32PROVIDE (__heap_end = __ram_end); 33 34REGION_ALIAS("REGION_TEXT", I-SRAM); 35REGION_ALIAS("REGION_RODATA", I-SRAM); 36REGION_ALIAS("REGION_VDATA", V-SRAM); 37REGION_ALIAS("REGION_DATA", D-SRAM); 38REGION_ALIAS("REGION_BSS", D-SRAM); 39 40ENTRY(Reset_Handler) 41SECTIONS 42{ 43 .text : { 44 . = ALIGN(0x4) ; 45 KEEP(*startup.o(.vectors)) 46 __stext = . ; 47 *(.text) 48 *(.text*) 49 *(.text.*) 50 *(.gnu.warning) 51 *(.stub) 52 *(.gnu.linkonce.t*) 53 *(.glue_7t) 54 *(.glue_7) 55 *(.jcr) 56 KEEP (*(.init)) 57 KEEP (*(.fini)) 58 . = ALIGN (4) ; 59 PROVIDE(__ctbp = .); 60 *(.call_table_data) 61 *(.call_table_text) 62 . = ALIGN(0x10) ; 63 __etext = . ; 64 } > REGION_TEXT 65 .rodata : { 66 . = ALIGN(0x4) ; 67 __srodata = .; 68 . = ALIGN(0x4) ; 69 *(.rodata.g_hdfConfigEntrySymbol) 70 *(.rdata) 71 *(.rdata*) 72 *(.rdata1) 73 *(.rdata.*) 74 *(.rodata) 75 *(.rodata1) 76 *(.rodata*) 77 *(.rodata.*) 78 *(.rodata.str1.4) 79 . = ALIGN(0x4) ; 80 __ctor_start__ = .; 81 KEEP (*crtbegin.o(.ctors)) 82 KEEP (*crtbegin?.o(.ctors)) 83 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 84 KEEP (*(SORT(.ctors.*))) 85 KEEP (*(.ctors)) 86 __ctor_end__ = .; 87 KEEP (*crtbegin.o(.dtors)) 88 KEEP (*crtbegin?.o(.dtors)) 89 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 90 KEEP (*(SORT(.dtors.*))) 91 KEEP (*(.dtors)) 92 __dtor_end__ = .; 93 . = ALIGN(0x4) ; 94 __erodata = .; 95 } > REGION_RODATA 96 .vdata : { 97 . = ALIGN(0x4) ; 98 __vdata_start__ = . ; 99 KEEP(*startup.o(.vdata)) 100 . = ALIGN(0x4) ; 101 __vdata_end__ = .; 102 } > REGION_VDATA 103 .data : { 104 . = ALIGN(0x4) ; 105 __sdata = . ; 106 __data_start__ = . ; 107 data_start = . ; 108 *(.got.plt) 109 *(.got) 110 *(.gnu.linkonce.r*) 111 *(.data) 112 *(.data*) 113 *(.data1) 114 *(.data.*) 115 *(.gnu.linkonce.d*) 116 *(.data1) 117 *(.gcc_except_table) 118 *(.gcc_except_table*) 119 __start_init_call = .; 120 *(.initcall.init) 121 __stop_init_call = .; 122 __start_cmd = .; 123 *(.bootloaddata.cmd) 124 . = ALIGN(4) ; 125 __stop_cmd = .; 126 *(.sdata) 127 *(.sdata.*) 128 *(.gnu.linkonce.s.*) 129 *(__libc_atexit) 130 *(__libc_subinit) 131 *(__libc_subfreeres) 132 *(.note.ABI-tag) 133 134 . = ALIGN(4); 135 _hdf_drivers_start = .; 136 KEEP(*(.hdf.driver)) 137 _hdf_drivers_end = .; 138 139 . = ALIGN(0x4) ; 140 __edata = .; 141 __data_end__ = .; 142 } > REGION_DATA AT > REGION_RODATA 143 144 .zinitcall_array : 145 { 146 . = ALIGN(0x4) ; 147 PROVIDE_HIDDEN (__zinitcall_core_start = .); 148 KEEP (*(SORT(.zinitcall.core*))) 149 KEEP (*(.zinitcall.core*)) 150 PROVIDE_HIDDEN (__zinitcall_core_end = .); 151 . = ALIGN(0x4) ; 152 PROVIDE_HIDDEN (__zinitcall_device_start = .); 153 KEEP (*(SORT(.zinitcall.device*))) 154 KEEP (*(.zinitcall.device*)) 155 PROVIDE_HIDDEN (__zinitcall_device_end = .); 156 . = ALIGN(0x4) ; 157 PROVIDE_HIDDEN (__zinitcall_bsp_start = .); 158 KEEP (*(SORT(.zinitcall.bsp*))) 159 KEEP (*(.zinitcall.bsp*)) 160 PROVIDE_HIDDEN (__zinitcall_bsp_end = .); 161 . = ALIGN(0x4) ; 162 PROVIDE_HIDDEN (__zinitcall_sys_service_start = .); 163 KEEP (*(SORT(.zinitcall.sys.service*))) 164 KEEP (*(.zinitcall.sys.service*)) 165 PROVIDE_HIDDEN (__zinitcall_sys_service_end = .); 166 . = ALIGN(0x4) ; 167 PROVIDE_HIDDEN (__zinitcall_app_service_start = .); 168 KEEP (*(SORT(.zinitcall.app.service*))) 169 KEEP (*(.zinitcall.app.service*)) 170 PROVIDE_HIDDEN (__zinitcall_app_service_end = .); 171 . = ALIGN(0x4) ; 172 PROVIDE_HIDDEN (__zinitcall_sys_feature_start = .); 173 KEEP (*(SORT(.zinitcall.sys.feature*))) 174 KEEP (*(.zinitcall.sys.feature*)) 175 PROVIDE_HIDDEN (__zinitcall_sys_feature_end = .); 176 . = ALIGN(0x4) ; 177 PROVIDE_HIDDEN (__zinitcall_app_feature_start = .); 178 KEEP (*(SORT(.zinitcall.app.feature*))) 179 KEEP (*(.zinitcall.app.feature*)) 180 PROVIDE_HIDDEN (__zinitcall_app_feature_end = .); 181 . = ALIGN(0x4) ; 182 PROVIDE_HIDDEN (__zinitcall_run_start = .); 183 KEEP (*(SORT(.zinitcall.run*))) 184 KEEP (*(.zinitcall.run*)) 185 PROVIDE_HIDDEN (__zinitcall_run_end = .); 186 . = ALIGN(0x4) ; 187 PROVIDE_HIDDEN (__zinitcall_test_start = .); 188 KEEP (*(SORT(.zinitcall.test*))) 189 KEEP (*(.zinitcall.test*)) 190 PROVIDE_HIDDEN (__zinitcall_test_end = .); 191 . = ALIGN(0x4) ; 192 PROVIDE_HIDDEN (__zinitcall_exit_start = .); 193 KEEP (*(SORT(.zinitcall.exit*))) 194 KEEP (*(.zinitcall.exit*)) 195 PROVIDE_HIDDEN (__zinitcall_exit_end = .); 196 } > REGION_RODATA 197 .bss : { 198 . = ALIGN(0x4) ; 199 __sbss = ALIGN(0x4) ; 200 __bss_start__ = . ; 201 *(.dynsbss) 202 *(.sbss) 203 *(.sbss.*) 204 *(.scommon) 205 *(.dynbss) 206 *(.bss) 207 *(.bss.*) 208 *(COMMON) 209 . = ALIGN(0x4) ; 210 __ebss = . ; 211 __end = . ; 212 end = . ; 213 __bss_end__ = .; 214 } > REGION_BSS 215 ._user_heap : { 216 . = ALIGN(0x4) ; 217 __heap_start = .; 218 . += __min_heap_size; 219 . = ALIGN(0x4) ; 220 } > REGION_BSS 221 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } > REGION_BSS 222 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } > REGION_BSS 223 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 224 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 225 .eh_frame_hdr : { *(.eh_frame_hdr) } 226 .preinit_array : 227 { 228 PROVIDE_HIDDEN (__preinit_array_start = .); 229 KEEP (*(.preinit_array)) 230 PROVIDE_HIDDEN (__preinit_array_end = .); 231 } 232 .init_array : 233 { 234 PROVIDE_HIDDEN (__init_array_start = .); 235 KEEP (*(SORT(.init_array.*))) 236 KEEP (*(.init_array)) 237 PROVIDE_HIDDEN (__init_array_end = .); 238 } 239 .fini_array : 240 { 241 PROVIDE_HIDDEN (__fini_array_start = .); 242 KEEP (*(.fini_array)) 243 KEEP (*(SORT(.fini_array.*))) 244 PROVIDE_HIDDEN (__fini_array_end = .); 245 } 246 .junk 0 : { *(.rel*) *(.rela*) } 247 .stab 0 : { *(.stab) } 248 .stabstr 0 : { *(.stabstr) } 249 .stab.excl 0 : { *(.stab.excl) } 250 .stab.exclstr 0 : { *(.stab.exclstr) } 251 .stab.index 0 : { *(.stab.index) } 252 .stab.indexstr 0 : { *(.stab.indexstr) } 253 .comment 0 : { *(.comment) } 254 .debug 0 : { *(.debug) } 255 .line 0 : { *(.line) } 256 .debug_srcinfo 0 : { *(.debug_srcinfo) } 257 .debug_sfnames 0 : { *(.debug_sfnames) } 258 .debug_aranges 0 : { *(.debug_aranges) } 259 .debug_pubnames 0 : { *(.debug_pubnames) } 260 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 261 .debug_abbrev 0 : { *(.debug_abbrev) } 262 .debug_line 0 : { *(.debug_line) } 263 .debug_frame 0 : { *(.debug_frame) } 264 .debug_str 0 : { *(.debug_str) } 265 .debug_loc 0 : { *(.debug_loc) } 266 .debug_macinfo 0 : { *(.debug_macinfo) } 267 .debug_weaknames 0 : { *(.debug_weaknames) } 268 .debug_funcnames 0 : { *(.debug_funcnames) } 269 .debug_typenames 0 : { *(.debug_typenames) } 270 .debug_varnames 0 : { *(.debug_varnames) } 271 .debug_pubtypes 0 : { *(.debug_pubtypes) } 272 .debug_ranges 0 : { *(.debug_ranges) } 273 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 274 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 275} 276