The RockboxUtilityQt wiki page has been renamed to RockboxUtility
[Rockbox.git] / firmware / app.lds
blob87f3d2ae23c2b5f2a5c6ffe6b99f524e44b14098
1 #include "config.h"
3 ENTRY(start)
4 #ifdef CPU_COLDFIRE
5 OUTPUT_FORMAT(elf32-m68k)
6 INPUT(target/coldfire/crt0.o)
7 #elif defined(CPU_ARM)
8 OUTPUT_FORMAT(elf32-littlearm)
9 OUTPUT_ARCH(arm)
10 #ifdef CPU_PP
11 INPUT(target/arm/crt0-pp.o)
12 #elif CONFIG_CPU==DM320
13 INPUT(target/arm/tms320dm320/crt0.o)
14 #elif CONFIG_CPU==S3C2440
15 INPUT(target/arm/s3c2440/crt0.o)
16 #elif CONFIG_CPU == PNX0101
17 INPUT(target/arm/pnx0101/crt0-pnx0101.o)
18 #elif defined(CPU_ARM)
19 INPUT(target/arm/crt0.o)
20 #endif
21 #else
22 OUTPUT_FORMAT(elf32-sh)
23 INPUT(target/sh/crt0.o)
24 #endif
26 #define PLUGINSIZE PLUGIN_BUFFER_SIZE
27 #define CODECSIZE CODEC_SIZE
29 #ifdef DEBUG
30 #define STUBOFFSET 0x10000
31 #else
32 #define STUBOFFSET 0
33 #endif
35 #if CONFIG_CPU==S3C2440
36 #include "s3c2440.h"
37 #define DRAMSIZE (MEMORYSIZE * 0x100000) - 0x100 - PLUGINSIZE - STUBOFFSET - CODECSIZE - LCD_BUFFER_SIZE - TTB_SIZE
38 #elif CONFIG_CPU==DM320
39 #include "dm320.h"
40 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE - LCD_BUFFER_SIZE - TTB_SIZE
41 #else
42 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
43 #endif
45 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300)
46 #define DRAMORIG 0x31000000 + STUBOFFSET
47 #define IRAMORIG 0x10000000
48 #define IRAMSIZE 0xc000
49 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
50 #define DRAMORIG 0x31000000 + STUBOFFSET
51 #define IRAMORIG 0x10000000
52 #define IRAMSIZE 0x10000
53 #elif defined(CPU_PP)
54 #define DRAMORIG 0x00000000 + STUBOFFSET
55 #define IRAMORIG 0x40000000
56 #define IRAMSIZE 0xc000
57 #elif CONFIG_CPU==PNX0101
58 #define DRAMORIG 0xc00000 + STUBOFFSET
59 #define IRAM0ORIG 0x000000
60 #define IRAM0SIZE 0x7000
61 #define IRAMORIG 0x400000
62 #define IRAMSIZE 0x7000
63 #elif CONFIG_CPU==S3C2440
64 #define DRAMORIG 0x00000100 + STUBOFFSET
65 #define IRAMORIG DRAMORIG
66 #define IRAM DRAM
67 #define IRAMSIZE 0x1000
68 #elif CONFIG_CPU==DM320
69 #define DRAMORIG 0x00900000 + STUBOFFSET
70 #define IRAMORIG 0x00000000
71 #define IRAMSIZE 0x4000
72 #elif CONFIG_CPU==IMX31L
73 #define DRAMORIG (0x88000000 + STUBOFFSET)
74 #define IRAMORIG 0x1FFFC000
75 #define IRAMSIZE 0x4000
76 #else
77 #define DRAMORIG 0x09000000 + STUBOFFSET
78 #define IRAMORIG 0x0f000000
79 #define IRAMSIZE 0x1000
80 #endif
82 /* End of the audio buffer, where the codec buffer starts */
83 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
85 /* Where the codec buffer ends, and the plugin buffer starts */
86 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
88 MEMORY
90     DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
91 #if CONFIG_CPU != S3C2440
92     IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
93 #endif
94 #if CONFIG_CPU==PNX0101
95     IRAM0 : ORIGIN = IRAM0ORIG, LENGTH = IRAM0SIZE
96 #endif
99 SECTIONS
101 #if (CONFIG_CPU==DM320)
102     .text :
103     {
104         loadaddress = .;
105         _loadaddress = .;
106         . = ALIGN(0x200);
107         *(.init.text)
108         *(.text*)
109         *(.glue_7)
110         *(.glue_7t)
111         . = ALIGN(0x4);
112     } > DRAM
114     .rodata :
115     {
116         *(.rodata)  /* problems without this, dunno why */
117         *(.rodata*)
118         *(.rodata.str1.1)
119         *(.rodata.str1.4)
120         . = ALIGN(0x4);
122         /* Pseudo-allocate the copies of the data sections */
123         _datacopy = .;
124     } > DRAM
126     /* TRICK ALERT! For RAM execution, we put the .data section at the
127        same load address as the copy. Thus, we don't waste extra RAM
128        when we don't actually need the copy.  */
129     .data : AT ( _datacopy )
130     {
131         _datastart = .;
132         *(.data*)
133         . = ALIGN(0x4);
134         _dataend  = .;
135     } > DRAM
137     /DISCARD/ :
138     {
139         *(.eh_frame)
140     }
142     .vectors IRAMORIG :
143     {
144         _vectorsstart = .;
145         *(.vectors);
146         _vectorsend = .;
147     } > IRAM AT> DRAM
149     _vectorscopy = LOADADDR(.vectors);
151     .iram :
152     {
153         _iramstart = .;
154         *(.icode)
155         *(.irodata)
156         *(.idata)
157         _iramend = .;
158     } > IRAM AT> DRAM
160     _iramcopy = LOADADDR(.iram);
162     .ibss (NOLOAD) :
163     {
164         _iedata = .;
165         *(.ibss)
166         . = ALIGN(0x4);
167         _iend = .;
168     } > IRAM
170     .stack :
171     {
172        *(.stack)
173        stackbegin = .;
174        . += 0x2000;
175        stackend = .;
176     } > IRAM
178     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
179     {
180        _edata = .;
181         *(.bss*)
182         *(COMMON)
183         . = ALIGN(0x4);
184        _end = .;
185     } > DRAM
187 #elif CONFIG_CPU==S3C2440
188     .text :
189     {
190         loadaddress = .;
191         _loadaddress = .;
192         . = ALIGN(0x200);
193         *(.init.text)
194         *(.text*)
195         *(.glue_7)
196         *(.glue_7t)
197         . = ALIGN(0x4);
198     } > DRAM
200     .rodata :
201     {
202         *(.rodata)  /* problems without this, dunno why */
203         *(.rodata*)
204         *(.rodata.str1.1)
205         *(.rodata.str1.4)
206         . = ALIGN(0x4);
208         /* Pseudo-allocate the copies of the data sections */
209         _datacopy = .;
210     } > DRAM
212     /* TRICK ALERT! For RAM execution, we put the .data section at the
213        same load address as the copy. Thus, we don't waste extra RAM
214        when we don't actually need the copy.  */
215     .data : AT ( _datacopy )
216     {
217         _datastart = .;
218         *(.data*)
219         . = ALIGN(0x4);
220         _dataend  = .;
221     } > DRAM
223     /DISCARD/ :
224     {
225         *(.eh_frame)
226     }
228     .vectors 0x0 :
229     {
230         _vectorsstart = .;
231         *(.vectors);
232         _vectorsend = .;
233     } AT> DRAM
235     _vectorscopy = LOADADDR(.vectors);
237     .iram :
238     {
239         _iramstart = .;
240         *(.icode)
241         *(.irodata)
242         *(.idata)
243         _iramend = .;
244     } > DRAM
246     _iramcopy = LOADADDR(.iram);
248     .ibss (NOLOAD) :
249     {
250         _iedata = .;
251         *(.ibss)
252         . = ALIGN(0x4);
253         _iend = .;
254     } > DRAM
256     .stack :
257     {
258        *(.stack)
259        stackbegin = .;
260        . += 0x2000;
261        stackend = .;
262     } > DRAM
264     .bss :
265     {
266        _edata = .;
267         *(.bss*)
268         *(COMMON)
269         . = ALIGN(0x4);
270        _end = .;
271     } > DRAM
273 #else /* End CONFIG_CPU */
275 #if !defined(CPU_ARM)
276     .vectors :
277     {
278         loadaddress = .;
279         _loadaddress = .;
280         KEEP(*(.resetvectors));
281         *(.resetvectors);
282         KEEP(*(.vectors));
283         *(.vectors);
284     } > DRAM
286     .text :
287     {
288 #else
289     .text :
290     {
291         loadaddress = .;
292         _loadaddress = .;
293 #endif
294         . = ALIGN(0x200);
295         *(.init.text)
296         *(.text*)
297 #ifdef CPU_ARM
298         *(.glue_7)
299         *(.glue_7t)
300 #endif
301         . = ALIGN(0x4);
302     } > DRAM
304     .rodata :
305     {
306         *(.rodata)  /* problems without this, dunno why */
307         *(.rodata*)
308         *(.rodata.str1.1)
309         *(.rodata.str1.4)
310         . = ALIGN(0x4);
312         /* Pseudo-allocate the copies of the data sections */
313         _datacopy = .;
314     } > DRAM
316     /* TRICK ALERT! For RAM execution, we put the .data section at the
317        same load address as the copy. Thus, we don't waste extra RAM
318        when we don't actually need the copy.  */
319     .data : AT ( _datacopy )
320     {
321         _datastart = .;
322         *(.data*)
323         . = ALIGN(0x4);
324         _dataend  = .;
325     } > DRAM
327     /DISCARD/ :
328     {
329         *(.eh_frame)
330     }
332 #if defined(CPU_ARM)
333     .vectors 0x0 :
334     {
335         _vectorsstart = .;
336         *(.vectors);
337         _vectorsend = .;
338 #if CONFIG_CPU==PNX0101
339         *(.dmabuf)
340     } >IRAM0 AT> DRAM
341 #else
342     } AT> DRAM
343 #endif
345     _vectorscopy = LOADADDR(.vectors);
346 #endif
348 #if CONFIG_CPU==PNX0101
349     .iram IRAMORIG + SIZEOF(.vectors) :
350 #else
351     .iram IRAMORIG :
352 #endif
353     {
354         _iramstart = .;
355         *(.icode)
356         *(.irodata)
357         *(.idata)
358         _iramend = .;
359     } > IRAM AT> DRAM
361     _iramcopy = LOADADDR(.iram);
363     .ibss (NOLOAD) :
364     {
365         _iedata = .;
366         *(.ibss)
367         . = ALIGN(0x4);
368         _iend = .;
369     } > IRAM
371 #if defined(CPU_COLDFIRE) || defined(CPU_ARM)
372 #ifdef CPU_PP
373     .idle_stacks :
374     {
375        *(.idle_stacks)
376 #if NUM_CORES > 1
377        cpu_idlestackbegin = .;
378        . += IDLE_STACK_SIZE;
379        cpu_idlestackend = .;
380 #endif
381        cop_idlestackbegin = .;
382        . += IDLE_STACK_SIZE;
383        cop_idlestackend = .;
384     } > IRAM
385 #endif
387     .stack :
388     {
389        *(.stack)
390        stackbegin = .;
391        . += 0x2000;
392        stackend = .;
393     } > IRAM
395 #else
396     /* TRICK ALERT! We want 0x2000 bytes of stack, but we set the section
397        size smaller, and allow the stack to grow into the .iram copy */
398     .stack ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
399     {
400        *(.stack)
401        _stackbegin = . - SIZEOF(.iram);
402        . += 0x2000 - SIZEOF(.iram);
403        _stackend = .;
404     } > DRAM
405 #endif
407 #if defined(CPU_COLDFIRE)
408     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
409 #elif defined(CPU_ARM)
410     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
411 #else
412     .bss :
413 #endif
414     {
415        _edata = .;
416         *(.bss*)
417         *(COMMON)
418         . = ALIGN(0x4);
419        _end = .;
420     } > DRAM
421     
422 #endif
424     .audiobuf ALIGN(4) :
425     {
426         _audiobuffer = .;
427         audiobuffer = .;
428     } > DRAM
430     .audiobufend ENDAUDIOADDR:
431     {
432         audiobufend = .;
433         _audiobufend = .;
434     } > DRAM
436     .codec ENDAUDIOADDR:
437     {
438         codecbuf = .;
439         _codecbuf = .;
440     }
442     .plugin ENDADDR:
443     {
444         _pluginbuf = .;
445         pluginbuf = .;
446     }