-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathlinkerscript.ld
More file actions
157 lines (130 loc) · 3.04 KB
/
linkerscript.ld
File metadata and controls
157 lines (130 loc) · 3.04 KB
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
SEARCH_DIR(.);
/*
Format configurations
*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm");
OUTPUT_ARCH(arm);
/*
The stack size used by the application. NOTE: you need to adjust according to your application.
*/
STACK_SIZE = 0x100;
/*
Memories definitions
*/
MEMORY
{
ram (rwx) : org = 0x20000000, len = 32k
}
/*
Entry point
*/
ENTRY( __reset_handler );
/*
Sections
*/
SECTIONS
{
/* Flash os information */
PrgCode :
{
. = ALIGN(4);
KEEP(*(PrgCode PrgCode.*));
. = ALIGN(4);
} > ram
/* Vector table. Has the initial stack pointer and the initial
structure for the arm interrupts */
.vectors :
{
. = ALIGN(128);
/* vector table */
KEEP(*(.vectors .vectors.*));
. = ALIGN(4);
} > ram
/* Text segment, stores all user code */
.text :
{
. = ALIGN(4);
/* text segment */
*(.text .text.* .gnu.linkonce.t.*);
/* glue arm to thumb code, glue thumb to arm code*/
*(.glue_7t .glue_7);
/* c++ exceptions */
*(.eh_frame .eh_frame_hdr)
/* exception unwinding information */
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*);
*(.ARM.exidx*)
. = ALIGN(4);
KEEP(*(.init));
. = ALIGN(4);
KEEP(*(.fini));
. = ALIGN(4);
} > ram
/* Read only data */
.rodata :
{
. = ALIGN(4);
/* Constands, strings, etc */
*(.rodata .rodata.* .gnu.linkonce.r.*);
. = ALIGN(4);
} > ram
PrgData :
{
. = ALIGN(4);
KEEP(*(PrgData PrgData.*))
. = ALIGN(4);
} > ram
/* Data that needs to be initialized to a value different than 0 */
.data :
{
. = ALIGN(4);
PROVIDE(__data_init_start = LOADADDR(.data));
PROVIDE(__data_start = .);
. = ALIGN(4);
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
PROVIDE(__data_end = .);
PROVIDE(__data_init_end = LOADADDR(.data));
} > ram
/* Data that needs to be initialized to 0 */
.bss (NOLOAD) :
{
. = ALIGN(4);
PROVIDE(__bss_start = .);
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON);
. = ALIGN(4);
PROVIDE(__bss_end = .);
} > ram
/* Stack segment */
.stack (NOLOAD) :
{
. = ALIGN(8);
PROVIDE(__stack_start = .);
. = . + STACK_SIZE;
PROVIDE(__stack_end = .);
} > ram
/* Heap segment */
.heap (NOLOAD) :
{
. = ALIGN(4);
PROVIDE(__heap_start = .);
PROVIDE(__heap_end = (ORIGIN(ram) + LENGTH(ram)));
} > ram
/* Flash device information */
DevDscr :
{
. = ALIGN(4);
KEEP(*(DevDscr DevDscr.*));
. = ALIGN(4);
} > ram
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
*(.note.GNU-stack)
}
.ARM.attributes 0 : { KEEP(*(.ARM.attributes)) }
}