forked from mosiu/bldc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker_script.ld
276 lines (243 loc) · 8.04 KB
/
linker_script.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
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/**
* @file XMC4500x1024.ld
* @date 2015-07-07
*
* @cond
*********************************************************************************************************************
* Linker file for the GNU C Compiler v1.5
* Supported devices: XMC4500-E144x1024
* XMC4500-F144x1024
* XMC4500-F100x1024
*
* Copyright (c) 2015, Infineon Technologies AG
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
* following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
* disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with
* Infineon Technologies AG [email protected]).
*********************************************************************************************************************
*
* Change History
* --------------
*
* 2015-07-07:
* - Product splitting
* - Copyright notice update
*
* @endcond
*
*/
OUTPUT_FORMAT("elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(Reset_Handler)
MEMORY
{
FLASH_1_cached(RX) : ORIGIN = 0x08000000, LENGTH = 0x100000
FLASH_1_uncached(RX) : ORIGIN = 0x0C000000, LENGTH = 0x100000
PSRAM_1(!RX) : ORIGIN = 0x10000000, LENGTH = 0x10000
DSRAM_1_system(!RX) : ORIGIN = 0x20000000, LENGTH = 0x10000
DSRAM_2_comm(!RX) : ORIGIN = 0x30000000, LENGTH = 0x8000
}
stack_size = 2048;
SECTIONS
{
/* TEXT section */
.text : AT(ORIGIN(FLASH_1_uncached))
{
sText = .;
KEEP(*(.reset));
*(.text .text.* .gnu.linkonce.t.*);
/* ARM <->THUMB interworking */
*(.glue*)
*(.v4*)
*(.vfp11_veneer)
/* C++ Support */
KEEP(*(.init))
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
KEEP(*(.fini))
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
/* Exception handling support */
__extab_start = .;
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
__extab_end = ABSOLUTE(.);
} > FLASH_1_cached
/* Exception handling, exidx needs a dedicated section */
.ARM.exidx ABSOLUTE(__extab_end): AT(__extab_end | 0x04000000)
{
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
. = ALIGN(4);
__exidx_end = ABSOLUTE(.);
} > FLASH_1_cached
/* CONST data section */
.rodata ABSOLUTE(__exidx_end): AT(__exidx_end | 0x04000000)
{
*(.rodata .rodata.*)
*(.gnu.linkonce.r*)
} > FLASH_1_cached
. = ALIGN(16);
/* End of RO-DATA and start of LOAD region for DATA */
__ram_load = . | 0x04000000;
/* DSRAM layout (Lowest to highest)*/
Stack (NOLOAD) :
{
. = . + stack_size;
__initial_sp = .;
} > PSRAM_1
/* functions with __attribute__((section(".ram_code"))) */
.ram_code : AT(__ram_load)
{
__ram_code_start = .;
*(.ram_code)
. = ALIGN(4);
__ram_code_end = .;
} > PSRAM_1
__ram_code_load = LOADADDR (.ram_code);
__ram_code_size = __ram_code_end - __ram_code_start;
PSRAM_DATA : AT(LOADADDR(.ram_code) + SIZEOF(.ram_code))
{
__data3_start = .;
*(PSRAM_DATA)
. = ALIGN(4);
__data3_end = .;
} > PSRAM_1
__data3_load = LOADADDR (PSRAM_DATA);
__data3_size = __data3_end - __data3_start;
PSRAM_BSS (NOLOAD) :
{
__bss3_start = .;
*(PSRAM_BSS)
. = ALIGN(4);
__bss3_end = .;
. = ALIGN(8);
Heap_Bank3_Start = .;
} > PSRAM_1
__bss3_size = __bss3_end - __bss3_start;
/* Standard DATA and user defined DATA/BSS/CONST sections */
.data : AT(LOADADDR(PSRAM_DATA) + SIZEOF(PSRAM_DATA))
{
__data_start = .;
* (.data);
* (.data*);
*(*.data);
*(.gnu.linkonce.d*)
. = ALIGN(4);
__data_end = .;
} > DSRAM_1_system
__data_load = LOADADDR (.data);
__data_size = __data_end - __data_start;
/* BSS section */
.bss (NOLOAD) :
{
__bss_start = .;
* (.bss);
* (.bss*);
* (COMMON);
*(.gnu.linkonce.b*)
. = ALIGN(4);
__bss_end = .;
. = ALIGN(8);
Heap_Bank1_Start = .;
} > DSRAM_1_system
__bss_size = __bss_end - __bss_start;
/* .no_init section */
.no_init 0x2000FFC0 (NOLOAD) :
{
Heap_Bank1_End = .;
* (.no_init);
} > DSRAM_1_system
DSRAM2_DATA : AT(LOADADDR(.data) + SIZEOF(.data))
{
__data2_start = .;
*(DSRAM2_DATA)
. = ALIGN(4);
__data2_end = .;
} > DSRAM_2_comm
__data2_load = LOADADDR(DSRAM2_DATA);
__data2_size = __data2_end - __data2_start;
DSRAM2_BSS (NOLOAD) :
{
__bss2_start = .;
*(ETH_RAM)
*(USB_RAM)
*(DSRAM2_BSS)
. = ALIGN(4);
__bss2_end = .;
. = ALIGN(8);
Heap_Bank2_Start = .;
} > DSRAM_2_comm
__bss2_size = __bss2_end - __bss2_start;
Heap_Bank1_Size = Heap_Bank1_End - Heap_Bank1_Start;
Heap_Bank2_Size = LENGTH(DSRAM_2_comm) - (Heap_Bank2_Start - ORIGIN(DSRAM_2_comm));
Heap_Bank3_Size = LENGTH(PSRAM_1) - (Heap_Bank3_Start - ORIGIN(PSRAM_1));
/DISCARD/ :
{
*(.comment)
}
.stab 0 (NOLOAD) : { *(.stab) }
.stabstr 0 (NOLOAD) : { *(.stabstr) }
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_pubtypes 0 : { *(.debug_pubtypes) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* DWARF 2.1 */
.debug_ranges 0 : { *(.debug_ranges) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* Build attributes */
.build_attributes 0 : { *(.ARM.attributes) }
}