• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     liteos.ld
19 * @brief    csky linker file
20 * @version  V1.0
21 * @date     02. June 2017
22 ******************************************************************************/
23MEMORY
24{
25  I-SRAM : ORIGIN = 0x0        , LENGTH = 0x20000   /* I-SRAM  128KB */
26  D-SRAM : ORIGIN = 0x20000000 , LENGTH = 0x20000   /* D-SRAM  128KB */
27  O-SRAM : ORIGIN = 0x50000000 , LENGTH = 0x800000   /* off-chip SRAM 8MB */
28  SRAM   : ORIGIN = 0x60000000 , LENGTH = 0x20000   /* on-chip SRAM 128KB */
29}
30
31_Min_Heap_Size = 0x200;
32_Min_Stack_Size = 0x400;
33
34PROVIDE (__ram_end  = ORIGIN(O-SRAM) + LENGTH(O-SRAM));
35
36REGION_ALIAS("REGION_TEXT",    O-SRAM);
37REGION_ALIAS("REGION_RODATA",  O-SRAM);
38REGION_ALIAS("REGION_DATA",    O-SRAM);
39REGION_ALIAS("REGION_BSS",     O-SRAM);
40
41ENTRY(Reset_Handler)
42SECTIONS
43{
44  .text : {
45    . = ALIGN(0x4) ;
46    KEEP(*startup.o(.text))
47    __text_start = .;
48    __stext = . ;
49    *(.text)
50    *(.text*)
51    *(.text.*)
52    *(.stub)
53    *(.gnu.linkonce.t*)
54    *(.glue_7t)
55    *(.glue_7)
56    KEEP (*(.init))
57    KEEP (*(.fini))
58    . = ALIGN (4) ;
59    __etext = . ;
60    __text_end = .;
61  } > REGION_TEXT
62
63  .rodata : {
64    . = ALIGN(0x4) ;
65    __rodata_start = .;
66    __srodata = .;
67    *(.rdata)
68    *(.rdata*)
69    *(.rdata.*)
70    *(.rodata)
71    *(.rodata*)
72    *(.rodata.*)
73    *(.rodata.str1.4)
74    KEEP (*crtbegin.o(.ctors))
75    KEEP (*crtbegin?.o(.ctors))
76    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
77    KEEP (*(SORT(.ctors.*)))
78    KEEP (*(.ctors))
79    KEEP (*crtbegin.o(.dtors))
80    KEEP (*crtbegin?.o(.dtors))
81    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
82    KEEP (*(SORT(.dtors.*)))
83    KEEP (*(.dtors))
84    . = ALIGN(0x4) ;
85    __erodata = .;
86    __rodata_end = .;
87  } > REGION_RODATA
88
89  .preinit_array     :
90  {
91    PROVIDE_HIDDEN (__preinit_array_start = .);
92    KEEP (*(.preinit_array*))
93    PROVIDE_HIDDEN (__preinit_array_end = .);
94  } >REGION_RODATA
95
96  .init_array :
97  {
98    PROVIDE_HIDDEN (__init_array_start = .);
99    KEEP (*(SORT(.init_array.*)))
100    KEEP (*(.init_array*))
101    PROVIDE_HIDDEN (__init_array_end = .);
102  } >REGION_RODATA
103
104  .fini_array :
105  {
106    PROVIDE_HIDDEN (__fini_array_start = .);
107    KEEP (*(SORT(.fini_array.*)))
108    KEEP (*(.fini_array*))
109    PROVIDE_HIDDEN (__fini_array_end = .);
110  } >REGION_RODATA
111
112  .data : {
113    . = ALIGN(0x4) ;
114    __sdata = . ;
115    __data_start__ = . ;
116    __ram_data_start = __data_start__;
117    data_start = . ;
118    *(.sdata)
119    *(.sdata.*)
120    *(.data)
121    *(.data*)
122    *(.data.*)
123    *(__libc_subfreeres)
124    *(.note.ABI-tag)
125    KEEP(*( SORT (.liteos.table.*)));
126    . = ALIGN(0x4) ;
127    __edata = .;
128    __data_end__ = .;
129    __ram_data_end = __data_end__;
130  } > REGION_DATA AT > REGION_RODATA
131
132  .eh_frame : ONLY_IF_RW {
133    KEEP (*(.eh_frame))
134  } > REGION_DATA AT > REGION_RODATA
135
136  .gcc_except_table : ONLY_IF_RW {
137    *(.gcc_except_table .gcc_except_table.*)
138    __edata = .;
139    __data_end__ = .;
140  } > REGION_DATA AT > REGION_RODATA
141
142  .bss : {
143    . = ALIGN(0x4) ;
144    __sbss = ALIGN(0x4) ;
145    __bss_start = . ;
146    *(.sbss)
147    *(.sbss.*)
148    *(.bss)
149    *(.bss.*)
150    *(COMMON)
151    . = ALIGN(4);
152    __init_stack_s = ABSOLUTE(.);
153    . += 0x1000;
154    __init_stack_e = ABSOLUTE(.);
155    . = ALIGN(0x4) ;
156    __ebss = . ;
157    __bss_end = .;
158    __end = . ;
159    end = . ;
160  } > REGION_BSS
161
162  . = ALIGN(0x8);
163  __heap_start = .;
164  __heap_end = ORIGIN(O-SRAM) + LENGTH(O-SRAM) - _Min_Stack_Size - 4;
165  __heap_size = __heap_end - __heap_start;
166}
167