]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_GCC/bsp/metal.default.lds
RIS-V_RV32_SiFive_HiFive1_GCC project now running the blinky demo - still a work...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_GCC / bsp / metal.default.lds
1 /* Copyright 2019 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
3 /* ----------------------------------- */
4 /* ----------------------------------- */
5
6 OUTPUT_ARCH("riscv")
7
8 ENTRY(_enter)
9
10 MEMORY
11 {
12         ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x4000
13         flash (rxai!w) : ORIGIN = 0x20010000, LENGTH = 0x6a120
14 }
15
16 PHDRS
17 {
18         flash PT_LOAD;
19         ram_init PT_LOAD;
20         itim_init PT_LOAD;
21         ram PT_NULL;
22         itim PT_NULL;
23 }
24
25 SECTIONS
26 {
27         __stack_size = DEFINED(__stack_size) ? __stack_size : 0x400;
28         PROVIDE(__stack_size = __stack_size);
29         __heap_size = DEFINED(__heap_size) ? __heap_size : 0x400;
30         PROVIDE(__metal_boot_hart = 0);
31         PROVIDE(__metal_chicken_bit = 0);
32
33
34         .init           :
35         {
36                 KEEP (*(.text.metal.init.enter))
37                 KEEP (*(SORT_NONE(.init)))
38                 KEEP (*(.text.libgloss.start))
39         } >flash AT>flash :flash
40
41
42         .text           :
43         {
44                 *(.text.unlikely .text.unlikely.*)
45                 *(.text.startup .text.startup.*)
46                 *(.text .text.*)
47                 *(.itim .itim.*)
48                 *(.gnu.linkonce.t.*)
49         } >flash AT>flash :flash
50
51
52         .fini           :
53         {
54                 KEEP (*(SORT_NONE(.fini)))
55         } >flash AT>flash :flash
56
57
58         PROVIDE (__etext = .);
59         PROVIDE (_etext = .);
60         PROVIDE (etext = .);
61
62
63         .rodata                 :
64         {
65                 *(.rdata)
66                 *(.rodata .rodata.*)
67                 *(.gnu.linkonce.r.*)
68                 . = ALIGN(8);
69                 *(.srodata.cst16)
70                 *(.srodata.cst8)
71                 *(.srodata.cst4)
72                 *(.srodata.cst2)
73                 *(.srodata .srodata.*)
74         } >flash AT>flash :flash
75
76
77         . = ALIGN(4);
78
79
80         .preinit_array          :
81         {
82                 PROVIDE_HIDDEN (__preinit_array_start = .);
83                 KEEP (*(.preinit_array))
84                 PROVIDE_HIDDEN (__preinit_array_end = .);
85         } >flash AT>flash :flash
86
87
88         .init_array             :
89         {
90                 PROVIDE_HIDDEN (__init_array_start = .);
91                 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
92                 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
93                 PROVIDE_HIDDEN (__init_array_end = .);
94         } >flash AT>flash :flash
95
96
97         .fini_array             :
98         {
99                 PROVIDE_HIDDEN (__fini_array_start = .);
100                 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
101                 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
102                 PROVIDE_HIDDEN (__fini_array_end = .);
103         } >flash AT>flash :flash
104
105
106         .ctors          :
107         {
108                 /* gcc uses crtbegin.o to find the start of
109                    the constructors, so we make sure it is
110                    first.  Because this is a wildcard, it
111                    doesn't matter if the user does not
112                    actually link against crtbegin.o; the
113                    linker won't look for a file to match a
114                    wildcard.  The wildcard also means that it
115                    doesn't matter which directory crtbegin.o
116                    is in.  */
117                 KEEP (*crtbegin.o(.ctors))
118                 KEEP (*crtbegin?.o(.ctors))
119                 /* We don't want to include the .ctor section from
120                    the crtend.o file until after the sorted ctors.
121                    The .ctor section from the crtend file contains the
122                    end of ctors marker and it must be last */
123                 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
124                 KEEP (*(SORT(.ctors.*)))
125                 KEEP (*(.ctors))
126         } >flash AT>flash :flash
127
128
129         .dtors          :
130         {
131                 KEEP (*crtbegin.o(.dtors))
132                 KEEP (*crtbegin?.o(.dtors))
133                 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
134                 KEEP (*(SORT(.dtors.*)))
135                 KEEP (*(.dtors))
136         } >flash AT>flash :flash
137
138
139         .litimalign             :
140         {
141                 . = ALIGN(4);
142                 PROVIDE( metal_segment_itim_source_start = . );
143         } >flash AT>flash :flash
144
145
146         .ditimalign             :
147         {
148                 . = ALIGN(4);
149                 PROVIDE( metal_segment_itim_target_start = . );
150         } >ram AT>flash :ram_init
151
152
153         .itim           :
154         {
155                 *(.itim .itim.*)
156         } >flash AT>flash :flash
157
158
159         . = ALIGN(8);
160         PROVIDE( metal_segment_itim_target_end = . );
161
162
163         .lalign                 :
164         {
165                 . = ALIGN(4);
166                 PROVIDE( _data_lma = . );
167                 PROVIDE( metal_segment_data_source_start = . );
168         } >flash AT>flash :flash
169
170
171         .dalign                 :
172         {
173                 . = ALIGN(4);
174                 PROVIDE( metal_segment_data_target_start = . );
175         } >ram AT>flash :ram_init
176
177
178         .data           :
179         {
180                 *(.data .data.*)
181                 *(.gnu.linkonce.d.*)
182                 . = ALIGN(8);
183                 PROVIDE( __global_pointer$ = . + 0x800 );
184                 *(.sdata .sdata.* .sdata2.*)
185                 *(.gnu.linkonce.s.*)
186         } >ram AT>flash :ram_init
187
188
189         . = ALIGN(4);
190         PROVIDE( _edata = . );
191         PROVIDE( edata = . );
192         PROVIDE( metal_segment_data_target_end = . );
193         PROVIDE( _fbss = . );
194         PROVIDE( __bss_start = . );
195         PROVIDE( metal_segment_bss_target_start = . );
196
197
198         .bss            :
199         {
200                 *(.sbss*)
201                 *(.gnu.linkonce.sb.*)
202                 *(.bss .bss.*)
203                 *(.gnu.linkonce.b.*)
204                 *(COMMON)
205                 . = ALIGN(4);
206         } >ram AT>ram :ram
207
208
209         . = ALIGN(8);
210         PROVIDE( _end = . );
211         PROVIDE( end = . );
212         PROVIDE( metal_segment_bss_target_end = . );
213
214         .stack :
215         {
216                 . = ALIGN(16);
217                 metal_segment_stack_begin = .;
218                 . += __stack_size;
219                 _sp = .;
220                 PROVIDE(metal_segment_stack_end = .);
221                 __freertos_irq_stack_top = .;
222         } >ram AT>ram :ram
223
224
225         .heap :
226         {
227                 PROVIDE( metal_segment_heap_target_start = . );
228                 . = __heap_size;
229                 PROVIDE( metal_segment_heap_target_end = . );
230                 PROVIDE( _heap_end = . );
231         } >ram AT>ram :ram
232
233
234 }
235