-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlink.x
225 lines (179 loc) · 6.15 KB
/
link.x
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
ENTRY(_start);
PROVIDE(_stack_size = 0x4000);
__stack_size = DEFINED(_stack_size) ? _stack_size : 0x4000;
ASSERT(__stack_size >= 0x400, "Stack size too small");
PROVIDE(_stext = ORIGIN(REGION_TEXT));
PROVIDE(_stack_start = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK));
PROVIDE(_max_hart_id = 0);
PROVIDE(_hart_stack_size = 2K);
PROVIDE(_heap_size = 0);
PROVIDE(InstructionMisaligned = ExceptionHandler);
PROVIDE(InstructionFault = ExceptionHandler);
PROVIDE(IllegalInstruction = ExceptionHandler);
PROVIDE(Breakpoint = ExceptionHandler);
PROVIDE(LoadMisaligned = ExceptionHandler);
PROVIDE(LoadFault = ExceptionHandler);
PROVIDE(StoreMisaligned = ExceptionHandler);
PROVIDE(StoreFault = ExceptionHandler);;
PROVIDE(UserEnvCall = ExceptionHandler);
PROVIDE(SupervisorEnvCall = ExceptionHandler);
PROVIDE(MachineEnvCall = ExceptionHandler);
PROVIDE(InstructionPageFault = ExceptionHandler);
PROVIDE(LoadPageFault = ExceptionHandler);
PROVIDE(StorePageFault = ExceptionHandler);
PROVIDE(SupervisorSoft = DefaultCoreInterruptHandler);
PROVIDE(MachineSoft = DefaultCoreInterruptHandler);
PROVIDE(SupervisorTimer = DefaultCoreInterruptHandler);
PROVIDE(MachineTimer = DefaultCoreInterruptHandler);
PROVIDE(SupervisorExternal = DefaultCoreInterruptHandler);
PROVIDE(MachineExternal = DefaultCoreInterruptHandler);
PROVIDE(DefaultCoreInterruptHandler = DefaultInterruptHandler);
PROVIDE(DefaultHandler = DefaultInterruptHandler);
PROVIDE(ExceptionHandler = DefaultExceptionHandler);
SECTIONS
{
.start : {
. = ALIGN(8);
KEEP(*(.start))
} > REGION_TEXT
.vectors : ALIGN(8) {
/* . = ALIGN(8); */
__vector_ram_start__ = .;
KEEP(*(.vector_table))
KEEP(*(.vector_table.*))
KEEP(*(.isr_vector))
KEEP(*(.vector_s_table))
KEEP(*(.isr_s_vector))
. = ALIGN(8);
__vector_ram_end__ = .;
} > REGION_FASTTEXT AT > REGION_TEXT
__vector_load_addr__ = LOADADDR(.vectors);
.text : ALIGN(8) {
. = ALIGN(8);
*(.text)
*(.text*)
/* section information for usbh class */
. = ALIGN(8);
__usbh_class_info_start__ = .;
KEEP(*(.usbh_class_info))
__usbh_class_info_end__ = .;
/* RT-Thread related sections - end */
. = ALIGN(8);
} > REGION_TEXT
.rodata : ALIGN(8) {
. = ALIGN(8);
*(.rodata .rodata.*)
*(.srodata .srodata.*)
. = ALIGN(8);
} > REGION_RODATA
.data : ALIGN(8) {
. = ALIGN(8);
__data_start__ = .;
__global_pointer$ = . + 0x800;
*(.sdata .sdata.* .sdata2 .sdata2.*);
*(.data .data.*);
} > REGION_DATA AT > REGION_RODATA
/* Allow sections from user `memory.x` injected using `INSERT AFTER .data` */
. = ALIGN(8);
__data_end__ = .;
__data_load_addr__ = LOADADDR(.data);
.fast : ALIGN(8) {
. = ALIGN(8);
__fast_text_start__ = .;
*(.fast.text)
*(.fast.text.*)
. = ALIGN(8);
__fast_text_end__ = .;
} > REGION_FASTTEXT AT > REGION_TEXT
__fast_text_load_addr__ = LOADADDR(.fast);
.fastdata : ALIGN(8) {
. = ALIGN(8);
__fast_data_start__ = .;
*(.fast.data)
*(.fast.data.*)
. = ALIGN(8);
__fast_data_end__ = .;
} > REGION_FASTDATA AT > REGION_RODATA
__fast_data_load_addr__ = LOADADDR(.fastdata);
.fastbss (NOLOAD) : ALIGN(8) {
. = ALIGN(8);
__fast_bss_start__ = .;
*(.fast.bss)
*(.fast.bss.*)
. = ALIGN(8);
__fast_bss_end__ = .;
} > REGION_FASTDATA
.bss (NOLOAD) : ALIGN(8) {
. = ALIGN(8);
__bss_start__ = .;
*(.sbss .sbss.* .bss .bss.*);
} > REGION_BSS
. = ALIGN(8);
__bss_end__ = .;
/* Non-cacheable data and bss */
.noncacheable.data : ALIGN(8) {
. = ALIGN(8);
__noncacheable_data_start__ = .;
KEEP(*(.noncacheable.data))
. = ALIGN(8);
__noncacheable_data_end__ = .;
} > REGION_NONCACHEABLE_RAM AT > REGION_RODATA
__noncacheable_data_load_addr__ = LOADADDR(.noncacheable.data);
.noncacheable.bss (NOLOAD) : {
. = ALIGN(8);
KEEP(*(.noncacheable))
__noncacheable_bss_start__ = .;
KEEP(*(.noncacheable.bss))
__noncacheable_bss_end__ = .;
. = ALIGN(8);
} > REGION_NONCACHEABLE_RAM
/*
.sh_mem (NOLOAD) : {
KEEP(*(.sh_mem))
} > SHARE_RAM
*/
.ahb_sram (NOLOAD) : {
KEEP(*(.ahb_sram))
} > AHB_SRAM
.heap (NOLOAD) :
{
__heap_start__ = .;
. += _heap_size;
. = ALIGN(4);
__heap_end__ = .;
} > REGION_HEAP
.stack (NOLOAD) :
{
. = ALIGN(16);
__stack_end__ = .;
. = ABSOLUTE(_stack_start);
__stack_start__ = .;
PROVIDE (__stack_safe = .);
} > REGION_STACK
.got (INFO) :
{
KEEP(*(.got .got.*));
}
.eh_frame (INFO) : { KEEP(*(.eh_frame)) }
.eh_frame_hdr (INFO) : { *(.eh_frame_hdr) }
}
/* Do not exceed this mark in the error messages above | */
ASSERT(ORIGIN(REGION_TEXT) % 4 == 0, "
ERROR(riscv-rt): the start of the REGION_TEXT must be 4-byte aligned");
ASSERT(ORIGIN(REGION_RODATA) % 4 == 0, "
ERROR(riscv-rt): the start of the REGION_RODATA must be 4-byte aligned");
ASSERT(ORIGIN(REGION_DATA) % 4 == 0, "
ERROR(riscv-rt): the start of the REGION_DATA must be 4-byte aligned");
ASSERT(ORIGIN(REGION_HEAP) % 4 == 0, "
ERROR(riscv-rt): the start of the REGION_HEAP must be 4-byte aligned");
ASSERT(ORIGIN(REGION_STACK) % 4 == 0, "
ERROR(riscv-rt): the start of the REGION_STACK must be 4-byte aligned");
ASSERT(SIZEOF(.stack) > (_max_hart_id + 1) * _hart_stack_size, "
ERROR(riscv-rt): .stack section is too small for allocating stacks for all the harts.
Consider changing `_max_hart_id` or `_hart_stack_size`.");
/* # Other checks */
ASSERT(SIZEOF(.got) == 0, "
ERROR(riscv-rt): .got section detected in the input files. Dynamic relocations are not
supported. If you are linking to C code compiled using the `cc` crate then modify your
build script to compile the C code _without_ the -fPIC flag. See the documentation of
the `cc::Build.pic` method for details.");