-
Notifications
You must be signed in to change notification settings - Fork 1
/
link.ld
121 lines (105 loc) · 2.63 KB
/
link.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
/*
* Copyright 2020 ETH Zurich
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* not needed, but we need separate linker scripts anyway */
OUTPUT_ARCH(riscv)
SEARCH_DIR(.)
MEMORY
{
ROM (rx) : ORIGIN = 0x1A000000, LENGTH = 0x2000
L2 (!rx) : ORIGIN = 0x1C000004, LENGTH = 0x4000
}
/* We have to align each sector to word boundaries as our current s19->slm
* conversion scripts are not able to handle non-word aligned sections. */
SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 0x800;
.text :
{
. = ALIGN(4);
__vector_start = .;
KEEP(*(.vectors))
_stext = .;
*(.text)
*(.text.*)
_etext = .;
*(.boot)
*(.eh_frame*)
_endtext = .;
} > ROM
.rodata : ALIGN(4)
{
*(.rodata);
*(.rodata.*)
} > ROM
.data : ALIGN(4)
{
__lma_data_start = LOADADDR(.data); /* for rom -> l2 ram transfer on boot */
sdata = .;
_sdata = .;
__data_begin = .;
*(.boot.data)
*(.data_fc)
*(.data_fc.*)
*(.data);
*(.data.*)
__sdata_begin = .;
*(.sdata);
*(.sdata.*)
*(.sdata2.*)
. = ALIGN(4);
edata = .;
_edata = .; /* man 3 end: first addr after data */
} > L2 AT> ROM
/* uninitialized variables to reduce startup time */
.noinit (NOLOAD) : ALIGN(4)
{
*(.noinit)
} > L2
.bss : ALIGN(8)
{
_bss_start = .;
__bss_start = .;
*(.shbss) /* don't even know where this is from */
*(.bss)
*(.bss.*)
*(.sbss)
*(.sbss.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
_bss_end = .;
_end = .; /* man 3 end: first addr after bss */
} > L2
/* The compiler uses this to access data in the .sdata, .data, .sbss and .bss
sections with fewer instructions (relaxation). This reduces code size. */
PROVIDE(__global_pointer$ = MIN(__sdata_begin + 0x800,
MAX(__data_begin + 0x800, __bss_end - 0x800)));
.stack :
{
. = ALIGN(16);
__stack_bottom = .;
. += __stack_size;
__stack_top = .;
} > L2
.stab 0 (NOLOAD) :
{
[ .stab ]
}
.stabstr 0 (NOLOAD) :
{
[ .stabstr ]
}
}