-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlinkscript.ld.old
261 lines (186 loc) · 5.14 KB
/
linkscript.ld.old
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
ENTRY(_start2)
/*STARTUP(objs/main.o)*/
OUTPUT_FORMAT("elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
rom : ORIGIN = 0x08000000, LENGTH = 32M
iwram : ORIGIN = 0x03000000, LENGTH = 32K
ewram : ORIGIN = 0x02000000, LENGTH = 256K
sram : ORIGIN = 0x0e000000, LENGTH = 64K
}
__text_start = ORIGIN(rom);
__ewram_start = ORIGIN(ewram);
__iwram_start = ORIGIN(iwram);
__sram_start = ORIGIN(sram);
SECTIONS
{
. = __text_start;
.startup :
{
*(.startup);
*(.asm_text);
. = ALIGN(4);
} >rom
startup_section_size = SIZEOF(.startup);
.text :
{
CREATE_OBJECT_SYMBOLS
/*
*(.text .text.* .gnu.linkonce.t.*)
*/
*(.text .gnu.linkonce.t.*)
*(.plt)
*(.gnu_warning)
*(.glue_7t) *(.glue_7)
. = ALIGN(4);
KEEP(*crtbegin.o(.ctors))
KEEP(*(EXCLUDE_FILE(*crtend.o) .ctors))
KEEP(*(SORT(.ctors.*)))
KEEP(*crtend.o(.ctors))
KEEP(*ctrbegin.o(.dtors))
KEEP(*(EXCLUDE_FILE(*crtend.o) .dtors))
KEEP(*(SORT(.dtors.*)))
KEEP(*ctrend.o(.dtors))
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.init)
*(.fini)
. = ALIGN(4);
} >rom
text_section_size = SIZEOF(.text);
.text_hot :
{
text_hot_rom_start = LOADADDR(.text_hot);
text_hot_iwram_start = .;
*(.text.hot*);
. = ALIGN(4);
} >iwram AT >rom
text_hot_section_size = SIZEOF(.text_hot);
/*
*(.text.*) is put AFTER *(.text.hot*) so that the .text_hot section
goes into IWRAM
*/
.text_extra :
{
*(.text.*)
. = ALIGN(4);
} >rom
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >rom
__exidx_start = .;
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >rom
__exidx_end = .;
.ARM.attributes : { *(.ARM.attributes) } >rom
.init_array : ALIGN(4)
{
__init_array_load = LOADADDR(.init_array);
__init_array_start = .;
*(.init_array)
*(SORT_BY_INIT_PRIORITY(.init_array.*))
__init_array_end = .;
} >ewram AT >rom
init_array_section_size = SIZEOF(.init_array);
/* Initialized data in EWRAM */
.data :
{
__data_load = LOADADDR(.data);
__data_start = .;
KEEP(*(.jcr))
*(.got.plt) *(.got)
*(.shdata)
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
__data_end = .;
} >ewram AT >rom
data_section_size = SIZEOF(.data);
/* Initialized data in IWRAM */
.iwram_data :
{
__iwram_data_load = LOADADDR(.iwram_data);
__iwram_data_start = .;
*(.iwram_data .iwram_data.*)
. = ALIGN(4);
__iwram_data_end = .;
} >iwram AT >rom
iwram_data_section_size = SIZEOF(.iwram_data);
/* Non .text.hot* Code to be copied to IWRAM */
.iwram_code :
{
/* The start of code to be copied to IWRAM*/
iwram_code_rom_start = LOADADDR(.iwram_code);
iwram_code_iwram_start = .;
*(.iwram_code);
. = ALIGN(4);
} >iwram AT >rom
iwram_code_section_size = SIZEOF(.iwram_code);
/* MaxMOD puts SOME code in the .iwram segment, so it will be treated as
such here also */
.some_maxmod_code :
{
. = ALIGN(4);
/* The start of some MaxMOD code to be copied to IWRAM*/
some_maxmod_code_rom_start = LOADADDR(.some_maxmod_code);
some_maxmod_code_iwram_start = .;
/* Some of MaxMOD's code goes into the ".iwram" section */
*(.iwram);
some_maxmod_code_iwram_end = .;
. = ALIGN(4);
} >iwram AT >rom
some_maxmod_code_section_size = SIZEOF(.some_maxmod_code);
/* Uninitialized variables that go into IWRAM*/
.iwram_bss :
{
*(.iwram_bss);
. = ALIGN(4);
/* The symbols end or __end__ are used to tell where malloc, new, and friends have free access. */
/*end = .;*/
/*__end__ = .;*/
} >iwram
iwram_bss_section_size = SIZEOF(.iwram_bss);
total_iwram_var_size = iwram_data_section_size + iwram_bss_section_size;
total_iwram_code_size = text_hot_section_size + iwram_code_section_size + some_maxmod_code_section_size;
/* total_iwram_code_size = iwram_code_section_size + * some_maxmod_code_section_size; */
total_iwram_usage = total_iwram_var_size + total_iwram_code_size;
.ewram_code :
{
/* The start of code to be copied to EWRAM */
ewram_code_rom_start = LOADADDR(.ewram_code);
ewram_code_ewram_start = .;
*(.ewram_code);
. = ALIGN(4);
} >ewram AT >rom
ewram_code_section_size = SIZEOF(.ewram_code);
/* Uninitialized (set to zero) variables that go into EWRAM */
.bss :
{
__bss_start__ = .;
*(.bss .bss.* .gnu.linkonce.b.*)
*(.ewram .ewram.*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
/* The symbols end or __end__ are used to tell where malloc, new, and friends have free access. */
end = .;
__end__ = .;
} >ewram
bss_section_size = SIZEOF(.bss);
total_ewram_var_size = init_array_section_size + data_section_size + bss_section_size;
total_ewram_code_size = ewram_code_section_size;
total_ewram_usage = total_ewram_var_size + total_ewram_code_size;
/*
__iwram_size = SIZEOF(.iwram);
__iwram_used = iwram_code_size + __iwram_size;
__iwram_remaining = LENGTH(iwram) - __iwram_used;
*/
.sram :
{
*(.sram .sram.*);
. = ALIGN(4);
} >sram
sram_section_size = SIZEOF(.sram);
.stab : { *(.stab) } AT >rom
.stabstr : { *(.stabstr) } AT >rom
.comment : { *(.comment) } AT >rom
.debug_frame : { *(.debug_frame) } AT >rom
}
/*PROVIDE( _HEAP_START = 0x020200000 );
PROVIDE( _HEAP_END = 0x020300000 );*/