forked from mithris/lpc_jtag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ld1_RAM.ld
202 lines (174 loc) · 16.3 KB
/
ld1_RAM.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
/* ****************************************************************************************************** */
/* demo2148_blink_flash.cmd LINKER SCRIPT */
/* */
/* */
/* The Linker Script defines how the code and data emitted by the GNU C compiler and assembler are */
/* to be loaded into memory (code goes into FLASH, variables go into RAM). */
/* */
/* Any symbols defined in the Linker Script are automatically global and available to the rest of the */
/* program. */
/* */
/* To force the linker to use this LINKER SCRIPT, just add the -T demo2148_blink_flash.cmd directive */
/* to the linker flags in the makefile. */
/* */
/* LFLAGS = -Map main.map -nostartfiles -T demo2148_blink_flash.cmd */
/* */
/* */
/* The Philips boot loader supports the ISP (In System Programming) via the serial port and the IAP */
/* (In Application Programming) for flash programming from within your application. */
/* */
/* The boot loader uses RAM memory and we MUST NOT load variables or code in these areas. */
/* */
/* RAM used by boot loader: 0x40000120 - 0x400001FF (223 bytes) for ISP variables */
/* 0x40007FE0 - 0x4000FFFF (32 bytes) for ISP and IAP variables */
/* 0x40007EE0 - 0x40007FE0 (256 bytes) stack for ISP and IAP */
/* */
/* */
/* MEMORY MAP */
/* | |0x40008000 */
/* .-------->|---------------------------------| */
/* . | variables and stack |0x40007FFF */
/* ram_isp_high | for Philips boot loader | */
/* . | 32 + 256 = 288 bytes | */
/* . | | */
/* . | Do not put anything here |0x40007EE0 */
/* .-------->|---------------------------------| */
/* | UDF Stack 4 bytes |0x40007EDC <---------- _stack_end */
/* .-------->|---------------------------------| */
/* | ABT Stack 4 bytes |0x40007ED8 */
/* .-------->|---------------------------------| */
/* | FIQ Stack 4 bytes |0x40007ED4 */
/* .-------->|---------------------------------| */
/* | IRQ Stack 4 bytes |0x40007ED0 */
/* .-------->|---------------------------------| */
/* | SVC Stack 4 bytes |0x40007ECC */
/* .-------->|---------------------------------| */
/* . | |0x40007EC8 */
/* . | stack area for user program | */
/* . | | | */
/* . | | | */
/* . | | | */
/* . | V | */
/* . | | */
/* . | | */
/* . | | */
/* . | free ram | */
/* ram | | */
/* . | | */
/* . | | */
/* . |.................................|0x40000234 <---------- _bss_end */
/* . | | */
/* . | .bss uninitialized variables | */
/* . |.................................|0x40000218 <---------- _bss_start, _edata */
/* . | | */
/* . | .data initialized variables | */
/* . | |0x40000200 <---------- _data */
/* .-------->|---------------------------------| */
/* . | variables used by |0x400001FF */
/* ram_isp_low | Philips boot loader | */
/* . | 223 bytes |0x40000120 */
/* .-------->|---------------------------------| */
/* . | |0x4000011F */
/* ram_vectors | free ram | */
/* . |---------------------------------|0x40000040 */
/* . | |0x4000003F */
/* . | Interrupt Vectors (re-mapped) | */
/* . | 64 bytes |0x40000000 */
/* .-------->|---------------------------------| */
/* | | */
/* */
/* */
/* */
/* | | */
/* .--------> |---------------------------------| */
/* . | |0x0001FFFF */
/* . | | */
/* . | | */
/* . | | */
/* . | | */
/* . | | */
/* . | unused flash eprom | */
/* . | | */
/* . |.................................|0x0000032c */
/* . | | */
/* . | copy of .data area | */
/* flash | | */
/* . |---------------------------------|0x00000314 <----------- _etext */
/* . | | */
/* . | |0x00000180 main */
/* . | |0x00000278 feed */
/* . | main() |0x000002c4 FIQ_Routine */
/* . | |0x000002d8 SWI_Routine */
/* . | |0x000002ec UNDEF_Routine */
/* . | |0x000002b0 IRQ_routine */
/* . |---------------------------------|0x000001cc initialize */
/* . | |0x000000D4 */
/* . | Startup Code | */
/* . | (assembler) | */
/* . | | */
/* . |---------------------------------|0x00000040 Reset_Handler */
/* . | |0x0000003F */
/* . | Interrupt Vector Table (unused) | */
/* . | 64 bytes | */
/* .--------->|---------------------------------|0x00000000 _startup *
/* */
/* */
/* The easy way to prevent the linker from loading anything into a memory area is to define */
/* a MEMORY region for it and then avoid assigning any .text, .data or .bss sections into it. */
/* */
/* */
/* MEMORY */
/* { */
/* ram_isp_low(A) : ORIGIN = 0x40000120, LENGTH = 223 */
/* */
/* } */
/* */
/* */
/* Author: James P. Lynch */
/* */
/* ****************************************************************************************************** */
/* identify the Entry Point */
ENTRY(_startup)
/* specify the LPC2148 memory areas */
MEMORY
{
flash : ORIGIN = 0, LENGTH = 512K /* FLASH ROM */
/*ram_isp_low(A) : ORIGIN = 0x40000120, LENGTH = 223 /* variables used by Philips ISP bootloader */
ram : ORIGIN = 0x40000200, LENGTH = 32k /*32513 /* free RAM area */
/*ram_isp_high(A) : ORIGIN = 0x40007FE0, LENGTH = 32 /* variables used by Philips ISP bootloader */
ram_usb_dma : ORIGIN = 0x7FD00000, LENGTH = 8192 /* on-chip USB DMA RAM area (not used) */
}
/* define a global symbol _stack_end */
_stack_end = 0x40007EDC;
/* now define the output sections */
SECTIONS
{
. = 0; /* set location counter to address zero */
startup : { *(.startup)} >ram /* the startup code goes into FLASH */
.text : /* collect all sections that should go into FLASH after startup */
{
*(.text) /* all .text sections (code) */
*(.rodata) /* all .rodata sections (constants, strings, etc.) */
*(.rodata*) /* all .rodata* sections (constants, strings, etc.) */
*(.glue_7) /* all .glue_7 sections (no idea what these are) */
*(.glue_7t) /* all .glue_7t sections (no idea what these are) */
*(.gnu.linkonce.t*)
*(.gnu.linkonce.r*)
_etext = .; /* define a global symbol _etext just after the last code byte */
} >ram /* put all the above into RAM */
.data : /* collect all initialized .data sections that go into RAM */
{
_data = .; /* create a global symbol marking the start of the .data section */
*(.data) /* all .data sections */
_edata = .; /* define a global symbol marking the end of the .data section */
} >ram /* put all the above into RAM (but load the LMA copy into FLASH) */
.bss : /* collect all uninitialized .bss sections that go into RAM */
{
_bss_start = .; /* define a global symbol marking the start of the .bss section */
*(.bss) /* all .bss sections */
} >ram /* put all the above in RAM (it will be cleared in the startup code */
. = ALIGN(4); /* advance location counter to the next 32-bit boundary */
_bss_end = . ; /* define a global symbol marking the end of the .bss section */
__eheap_start = . ;
}
_end = .; /* define a global symbol marking the end of application RAM */