1/*
2 * Copyright (C) 2017-2019 Alibaba Group Holding Limited
3 */
4
5/******************************************************************************
6 * @file     gcc_csky.ld
7 * @brief    csky linker file
8 * @version  V1.0
9 * @date     02. June 2017
10 ******************************************************************************/
11MEMORY
12{
13	SRAM   : ORIGIN = 0x00000000 , LENGTH = 0x100000   /* on-chip SRAM 128KB */
14}
15
16__min_heap_size = 0x200;
17PROVIDE (__ram_end  = 0x00040000 - 0x1000 - 0x8);
18PROVIDE (__heap_end = __ram_end);
19
20REGION_ALIAS("REGION_TEXT",    SRAM);
21REGION_ALIAS("REGION_RODATA",  SRAM);
22REGION_ALIAS("REGION_DATA",    SRAM);
23REGION_ALIAS("REGION_BSS",     SRAM);
24
25ENTRY(Reset_Handler)
26SECTIONS
27{
28 .text : {
29  . = ALIGN(0x4) ;
30  __stext = . ;
31/*  KEEP(*startup.o(*.text*))*/
32  KEEP(*startup.o)
33  *(.text)
34  *(.text*)
35  *(.text.*)
36  *(.gnu.warning)
37  *(.stub)
38  *(.gnu.linkonce.t*)
39  *(.glue_7t)
40  *(.glue_7)
41  *(.jcr)
42  KEEP (*(.init))
43  KEEP (*(.fini))
44  . = ALIGN (4) ;
45  PROVIDE(__ctbp = .);
46  *(.call_table_data)
47  *(.call_table_text)
48  . = ALIGN(0x10) ;
49  __etext = . ;
50 } > REGION_TEXT
51 .eh_frame_hdr : {
52  *(.eh_frame_hdr)
53 } > REGION_TEXT
54 .eh_frame : ONLY_IF_RO {
55  KEEP (*(.eh_frame))
56 } > REGION_TEXT
57 .gcc_except_table : ONLY_IF_RO {
58  *(.gcc_except_table .gcc_except_table.*)
59 } > REGION_TEXT
60 .rodata : {
61  . = ALIGN(0x4) ;
62  __srodata = .;
63  *(.rdata)
64  *(.rdata*)
65  *(.rdata1)
66  *(.rdata.*)
67  *(.rodata)
68  *(.rodata1)
69  *(.rodata*)
70  *(.rodata.*)
71  *(.rodata.str1.4)
72  *(.srodata*)
73  . = ALIGN(0x4) ;
74  __ctor_start__ = .;
75  KEEP (*(SORT(.ctors.*)))
76  KEEP (*(.ctors))
77  __ctor_end__ = .;
78  KEEP (*(SORT(.dtors.*)))
79  KEEP (*(.dtors))
80  __dtor_end__ = .;
81  . = ALIGN(0x4) ;
82  __erodata = .;
83  __rodata_end__ = .;
84 } > REGION_RODATA
85 .data : {
86  . = ALIGN(0x4) ;
87  __sdata = . ;
88  __data_start__ = . ;
89  data_start = . ;
90/*  KEEP(*startup.o(*.vectors*))*/
91  *(.got.plt)
92  *(.got)
93  *(.gnu.linkonce.r*)
94  *(.data)
95  *(.data*)
96  *(.data1)
97  *(.data.*)
98  *(.gnu.linkonce.d*)
99  *(.data1)
100  *(.gcc_except_table)
101  *(.gcc_except_table*)
102  __start_init_call = .;
103  *(.initcall.init)
104  __stop_init_call = .;
105  __start_cmd = .;
106  *(.bootloaddata.cmd)
107  . = ALIGN(4) ;
108  __stop_cmd = .;
109  __global_pointer$ = .;
110  *(.sdata)
111  *(.sdata.*)
112  *(.sdata2.*)
113  *(.gnu.linkonce.s.*)
114  *(__libc_atexit)
115  *(__libc_subinit)
116  *(__libc_subfreeres)
117  *(.note.ABI-tag)
118  __edata = .;
119  __data_end__ = .;
120  . = ALIGN(0x4) ;
121 } > REGION_DATA
122 .eh_frame : ONLY_IF_RW {
123  KEEP (*(.eh_frame))
124 } > REGION_DATA
125 .gcc_except_table : ONLY_IF_RW {
126  *(.gcc_except_table .gcc_except_table.*)
127  __edata = .;
128  __data_end__ = .;
129 } > REGION_DATA
130 .bss : {
131  . = ALIGN(0x4) ;
132  __sbss = ALIGN(0x4) ;
133  __bss_start__ = . ;
134  *(.dynsbss)
135  *(.sbss)
136  *(.sbss.*)
137  *(.scommon)
138  *(.dynbss)
139  *(.bss)
140  *(.bss.*)
141  *(COMMON)
142  . = ALIGN(0x4) ;
143  __ebss = . ;
144  __bss_end__ = .;
145  __end = . ;
146  end = . ;
147 } > REGION_BSS
148 ._user_heap : {
149  . = ALIGN(0x8) ;
150  __heap_start = .;
151  . += __min_heap_size;
152  . = ALIGN(0x8) ;
153 } > REGION_BSS
154}
155