-
Notifications
You must be signed in to change notification settings - Fork 28
/
linkscript.ld
148 lines (123 loc) · 3.09 KB
/
linkscript.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
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_Reset)
MEMORY
{
ROM (rx) : ORIGIN = 0xC2000040, LENGTH = 0x0DFFFFC0
RAM (rw): ORIGIN = 0xC0200000, LENGTH = 0x01D00000
HEAP (rw) : ORIGIN = 0xD0000000, LENGTH = 128M
VIRTDRIVE (rw) : ORIGIN = 0xD8000000, LENGTH = 128M
SRAM1 (rwx) : ORIGIN = 0x10000000, LENGTH = 128K
SRAM2 (rwx) : ORIGIN = 0x10020000, LENGTH = 128K
SRAM3 (rwx) : ORIGIN = 0x10040000, LENGTH = 64K
SRAM4 (rwx) : ORIGIN = 0x10050000, LENGTH = 64K
SYSRAM (rw) : ORIGIN = 0x2FFC0000, LENGTH = 256K
}
__HEAP_SIZE = LENGTH(HEAP);
SECTIONS
{
.text : {
*(.vector_table)
*(.resethandler)
*(.irqhandler)
*(.text)
*(.text*)
/* Todo: check if we need the next 3 lines */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init)) /* libc ctors */
KEEP (*(.fini)) /* libc dtors */
. = ALIGN(8);
} > ROM
/* .rodata sections (constants, strings, etc.) */
.rodata :
{
. = ALIGN(8);
*(.rodata)
*(.rodata*)
. = ALIGN(8);
} > ROM
/* used for unwinding (probably not used, but is ignored if your app doens't use exceptions */
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >ROM
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >ROM
.preinit_array :
{
. = ALIGN(8);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(8);
} > ROM
.init_array :
{
. = ALIGN(8);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(8);
} > ROM
.fini_array :
{
. = ALIGN(8);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
. = ALIGN(8);
} > ROM
_text_end = .;
.data : AT(_text_end)
{
. = ALIGN(8);
_data_start = .;
*(.data)
*(.data*)
. = ALIGN(8);
_data_end = .;
} > RAM
.bss : {
. = ALIGN(8);
_bss_start = .;
*(.bss)
*(.bss*) /* required for some malloc calls */
*(COMMON) /* required for libc, such as __lock___atexit_recursive_mutex */
. = ALIGN(8);
_bss_end = .;
. = ALIGN(256);
_ram_aligned_end = .;
} > RAM
.heap (NOLOAD):
{
. = ALIGN(8);
_sheap = .;
. += __HEAP_SIZE;
_eheap = .;
} > HEAP
end = _sheap;
.virtdrive (NOLOAD):
{
*(.virtdrive)
} > VIRTDRIVE
_user_stack_start = _ram_aligned_end;
_user_stack_end = _user_stack_start + 0x10000;
_svc_stack_start = _user_stack_end;
_svc_stack_end = _svc_stack_start + 0x1000;
_irq_stack_start = _svc_stack_end;
_irq_stack_end = _irq_stack_start + 0x1000;
_fiq_stack_start = _irq_stack_end;
_fiq_stack_end = _fiq_stack_start + 0x1000;
/* Remove information from the compiler libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}