-
Notifications
You must be signed in to change notification settings - Fork 0
/
FE310-G002.ld
141 lines (122 loc) · 3.51 KB
/
FE310-G002.ld
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* Copyright (C) 2017, 2019 Ken Rabold, Alexander Entinger
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
OUTPUT_ARCH( "riscv" )
ENTRY( __start )
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20010000, LENGTH = 0x0006a120
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x00004000
itim (wxa!ri) : ORIGIN = 0x08000000, LENGTH = 0x00002000
}
PHDRS
{
flash PT_LOAD;
ram_init PT_LOAD;
ram PT_NULL;
}
SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 1K;
__heap_size = DEFINED(__heap_size) ? __heap_size : 1k;
.init :
{
KEEP (*(SORT_NONE(.init)))
} >flash AT>flash :flash
.text :
{
*(.text.startup .text.startup.*)
*(.text .text.*)
} >flash AT>flash :flash
.fini :
{
KEEP (*(SORT_NONE(.fini)))
} >flash AT>flash :flash
PROVIDE (__preinit_array_start = .);
.preinit_array :
{
KEEP (*(.preinit_array))
} >flash AT>flash :flash
PROVIDE (__preinit_array_end = .);
PROVIDE (__init_array_start = .);
.init_array :
{
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
} >flash AT>flash :flash
PROVIDE (__init_array_end = .);
PROVIDE (__fini_array_start = .);
.fini_array :
{
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
} >flash AT>flash :flash
PROVIDE (__fini_array_end = .);
.ctors :
{
/* gcc uses crtbegin.o to find the start of the constructors, so we make sure it is
first. Because this is a wildcard, it doesn't matter if the user does not
actually link against crtbegin.o; the linker won't look for a file to match a
wildcard. The wildcard also means that it doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >flash AT>flash :flash
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >flash AT>flash :flash
.lalign :
{
. = ALIGN(4);
PROVIDE( __data_src_start = . );
} >flash AT>flash :flash
.dalign :
{
. = ALIGN(4);
PROVIDE( __data_dst_start = . );
} >ram AT>flash :ram_init
.data :
{
*(.data .data.*)
. = ALIGN(8);
PROVIDE( __global_pointer$ = . + 0x800 );
} >ram AT>flash :ram_init
. = ALIGN(4);
PROVIDE( __data_dst_end = . );
PROVIDE( __bss_start = . );
.bss :
{
*(.sbss*)
*(.bss .bss.*)
. = ALIGN(4);
} >ram AT>ram :ram
. = ALIGN(8);
PROVIDE( __bss_end = . );
.stack :
{
PROVIDE( __stack_start = . );
. = __stack_size;
PROVIDE( __stack_end = .) ;
} >ram AT>ram :ram
.heap :
{
PROVIDE( __heap_start = . );
. = __heap_size;
. = __heap_size == 0 ? 0 : ORIGIN(ram) + LENGTH(ram);
PROVIDE( __heap_end = . );
} >ram AT>ram :ram
}