Fix the c200 manual which was broken by yesterday's button action macros in the radio...
[Rockbox.git] / firmware / app.lds
blobc5c4e6e30ef39bf2ad8c1eb92e1aa80c3d12dbf7
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 defined(CPU_TCC780X)
17 INPUT(target/arm/tcc780x/crt0.o)
18 #elif CONFIG_CPU == PNX0101
19 INPUT(target/arm/pnx0101/crt0-pnx0101.o)
20 #elif CONFIG_CPU == IMX31L
21 INPUT(target/arm/imx31/crt0.o)
22 #elif defined(CPU_ARM)
23 INPUT(target/arm/crt0.o)
24 #endif
25 #else
26 OUTPUT_FORMAT(elf32-sh)
27 INPUT(target/sh/crt0.o)
28 #endif
30 #define PLUGINSIZE PLUGIN_BUFFER_SIZE
31 #define CODECSIZE CODEC_SIZE
33 #ifdef DEBUG
34 #define STUBOFFSET 0x10000
35 #else
36 #define STUBOFFSET 0
37 #endif
39 #if CONFIG_CPU==S3C2440
40 #include "s3c2440.h"
41 #define DRAMSIZE (MEMORYSIZE * 0x100000) - 0x100 - PLUGINSIZE - STUBOFFSET - CODECSIZE - LCD_BUFFER_SIZE - TTB_SIZE
42 #elif CONFIG_CPU==DM320
43 #include "dm320.h"
44 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE - LCD_BUFFER_SIZE - TTB_SIZE
45 #else
46 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
47 #endif
49 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300)
50 #define DRAMORIG 0x31000000 + STUBOFFSET
51 #define IRAMORIG 0x10000000
52 #define IRAMSIZE 0xc000
53 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
54 #define DRAMORIG 0x31000000 + STUBOFFSET
55 #define IRAMORIG 0x10000000
56 #define IRAMSIZE 0x10000
57 #elif defined(CPU_PP)
58 #define DRAMORIG 0x00000000 + STUBOFFSET
59 #define IRAMORIG 0x40000000
60 #define IRAMSIZE 0xc000
61 #elif CONFIG_CPU==PNX0101
62 #define DRAMORIG 0xc00000 + STUBOFFSET
63 #define IRAM0ORIG 0x000000
64 #define IRAM0SIZE 0x7000
65 #define IRAMORIG 0x400000
66 #define IRAMSIZE 0x7000
67 #elif CONFIG_CPU==S3C2440
68 #define DRAMORIG 0x00000100 + STUBOFFSET
69 #define IRAMORIG DRAMORIG
70 #define IRAM DRAM
71 #define IRAMSIZE 0x1000
72 #elif CONFIG_CPU==DM320
73 #define DRAMORIG 0x00900000 + STUBOFFSET
74 #define IRAMORIG 0x00000000
75 #define IRAMSIZE 0x4000
76 #elif CONFIG_CPU==IMX31L
77 #define DRAMORIG (0x0 + STUBOFFSET)
78 #define IRAMORIG 0x1FFFC000
79 #define IRAMSIZE 0x4000
80 #elif defined(CPU_TCC780X)
81 #define DRAMORIG 0x20000000 + STUBOFFSET
82 #define ITCMORIG 0x00000000
83 #define ITCMSIZE 0x1000
84 #define DTCMORIG 0xA0000000
85 #define DTCMSIZE 0x2000
86 #define SRAMORIG 0x10000000
87 #define SRAMSIZE 0xc000
88 #else
89 #define DRAMORIG 0x09000000 + STUBOFFSET
90 #define IRAMORIG 0x0f000000
91 #define IRAMSIZE 0x1000
92 #endif
94 /* End of the audio buffer, where the codec buffer starts */
95 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
97 /* Where the codec buffer ends, and the plugin buffer starts */
98 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
100 MEMORY
102     DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
103 #if defined(CPU_TCC780X)
104     /* Seperate data & instruction TCMs plus SRAM. */
105     ITCM : ORIGIN = ITCMORIG, LENGTH = ITCMSIZE
106     DTCM : ORIGIN = DTCMORIG, LENGTH = DTCMSIZE
107     SRAM : ORIGIN = SRAMORIG, LENGTH = SRAMSIZE
108 #elif CONFIG_CPU != S3C2440
109     IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
110 #endif
111 #if CONFIG_CPU==PNX0101
112     IRAM0 : ORIGIN = IRAM0ORIG, LENGTH = IRAM0SIZE
113 #endif
116 SECTIONS
118 #if (CONFIG_CPU==DM320)
119     .text :
120     {
121         loadaddress = .;
122         _loadaddress = .;
123         . = ALIGN(0x200);
124         *(.init.text)
125         *(.text*)
126         *(.glue_7)
127         *(.glue_7t)
128         . = ALIGN(0x4);
129     } > DRAM
131     .rodata :
132     {
133         *(.rodata)  /* problems without this, dunno why */
134         *(.rodata*)
135         *(.rodata.str1.1)
136         *(.rodata.str1.4)
137         . = ALIGN(0x4);
139         /* Pseudo-allocate the copies of the data sections */
140         _datacopy = .;
141     } > DRAM
143     /* TRICK ALERT! For RAM execution, we put the .data section at the
144        same load address as the copy. Thus, we don't waste extra RAM
145        when we don't actually need the copy.  */
146     .data : AT ( _datacopy )
147     {
148         _datastart = .;
149         *(.data*)
150         . = ALIGN(0x4);
151         _dataend  = .;
152     } > DRAM
154     /DISCARD/ :
155     {
156         *(.eh_frame)
157     }
159     .vectors IRAMORIG :
160     {
161         _vectorsstart = .;
162         *(.vectors);
163         _vectorsend = .;
164     } > IRAM AT> DRAM
166     _vectorscopy = LOADADDR(.vectors);
168     .iram :
169     {
170         _iramstart = .;
171         *(.icode)
172         *(.irodata)
173         *(.idata)
174         . = ALIGN(0x4);        
175         _iramend = .;
176     } > IRAM AT> DRAM
178     _iramcopy = LOADADDR(.iram);
180     .ibss (NOLOAD) :
181     {
182         _iedata = .;
183         *(.ibss)
184         . = ALIGN(0x4);
185         _iend = .;
186     } > IRAM
188     .stack :
189     {
190        *(.stack)
191        stackbegin = .;
192        . += 0x2000;
193        stackend = .;
194     } > IRAM
196     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
197     {
198        _edata = .;
199         *(.bss*)
200         *(COMMON)
201         . = ALIGN(0x4);
202        _end = .;
203     } > DRAM
205 #elif defined(CPU_TCC780X)
206     .text :
207     {
208         loadaddress = .;
209         _loadaddress = .;
210         . = ALIGN(0x200);
211         *(.init.text)
212         *(.text*)
213         *(.glue_7)
214         *(.glue_7t)
215         . = ALIGN(0x4);
216     } > DRAM
218     .rodata :
219     {
220         *(.rodata)  /* problems without this, dunno why */
221         *(.rodata*)
222         *(.rodata.str1.1)
223         *(.rodata.str1.4)
224         . = ALIGN(0x4);
226         /* Pseudo-allocate the copies of the data sections */
227         _datacopy = .;
228     } > DRAM
230     /* TRICK ALERT! For RAM execution, we put the .data section at the
231        same load address as the copy. Thus, we don't waste extra RAM
232        when we don't actually need the copy.  */
233     .data : AT ( _datacopy )
234     {
235         _datastart = .;
236         *(.data*)
237         . = ALIGN(0x4);
238         _dataend  = .;
239     } > DRAM
241     /DISCARD/ :
242     {
243         *(.eh_frame)
244     }
246     .vectors ITCMORIG :
247     {
248         _vectorsstart = .;
249         *(.vectors);
250         _vectorsend = .;
251     } > ITCM AT> DRAM
253     _vectorscopy = LOADADDR(.vectors);
255     .itcm :
256     {
257         _itcmstart = .;
258         *(.icode)
259         _itcmend = .;
260     } > ITCM AT> DRAM
262     _itcmcopy = LOADADDR(.itcm);
263     
264     .dtcm :
265     {
266         _dtcmstart = .;
267         *(.irodata)
268         *(.idata)
269         _dtcmend = .;
270     } > DTCM AT> DRAM
272     _dtcmcopy = LOADADDR(.dtcm);
274     .ibss (NOLOAD) :
275     {
276         _iedata = .;
277         *(.ibss)
278         . = ALIGN(0x4);
279         _iend = .;
280     } > SRAM
282     .stack :
283     {
284        *(.stack)
285        stackbegin = .;
286        . += 0x2000;
287        stackend = .;
288     } > SRAM
290     .bss :
291     {
292        _edata = .;
293         *(.bss*)
294         *(COMMON)
295         . = ALIGN(0x4);
296        _end = .;
297     } > DRAM
299 #elif CONFIG_CPU==S3C2440
300     .text :
301     {
302         loadaddress = .;
303         _loadaddress = .;
304         . = ALIGN(0x200);
305         *(.init.text)
306         *(.text*)
307         *(.glue_7)
308         *(.glue_7t)
309         . = ALIGN(0x4);
310     } > DRAM
312     .rodata :
313     {
314         *(.rodata)  /* problems without this, dunno why */
315         *(.rodata*)
316         *(.rodata.str1.1)
317         *(.rodata.str1.4)
318         . = ALIGN(0x4);
320         /* Pseudo-allocate the copies of the data sections */
321         _datacopy = .;
322     } > DRAM
324     /* TRICK ALERT! For RAM execution, we put the .data section at the
325        same load address as the copy. Thus, we don't waste extra RAM
326        when we don't actually need the copy.  */
327     .data : AT ( _datacopy )
328     {
329         _datastart = .;
330         *(.data*)
331         . = ALIGN(0x4);
332         _dataend  = .;
333     } > DRAM
335     /DISCARD/ :
336     {
337         *(.eh_frame)
338     }
340     .vectors 0x0 :
341     {
342         _vectorsstart = .;
343         *(.vectors);
344         _vectorsend = .;
345     } AT> DRAM
347     _vectorscopy = LOADADDR(.vectors);
349     .iram :
350     {
351         _iramstart = .;
352         *(.icode)
353         *(.irodata)
354         *(.idata)
355         _iramend = .;
356     } > DRAM
358     _iramcopy = LOADADDR(.iram);
360     .ibss (NOLOAD) :
361     {
362         _iedata = .;
363         *(.ibss)
364         . = ALIGN(0x4);
365         _iend = .;
366     } > DRAM
368     .stack :
369     {
370        *(.stack)
371        stackbegin = .;
372        . += 0x2000;
373        stackend = .;
374     } > DRAM
376     .bss :
377     {
378        _edata = .;
379         *(.bss*)
380         *(COMMON)
381         . = ALIGN(0x4);
382        _end = .;
383     } > DRAM
385 #else /* End CONFIG_CPU */
387 #if !defined(CPU_ARM)
388     .vectors :
389     {
390         loadaddress = .;
391         _loadaddress = .;
392         KEEP(*(.resetvectors));
393         *(.resetvectors);
394         KEEP(*(.vectors));
395         *(.vectors);
396     } > DRAM
398     .text :
399     {
400 #else
401     .text :
402     {
403         loadaddress = .;
404         _loadaddress = .;
405 #endif
406         . = ALIGN(0x200);
407         *(.init.text)
408         *(.text*)
409 #ifdef CPU_ARM
410         *(.glue_7)
411         *(.glue_7t)
412 #endif
413         . = ALIGN(0x4);
414     } > DRAM
416     .rodata :
417     {
418         *(.rodata)  /* problems without this, dunno why */
419         *(.rodata*)
420         *(.rodata.str1.1)
421         *(.rodata.str1.4)
422         . = ALIGN(0x4);
424         /* Pseudo-allocate the copies of the data sections */
425         _datacopy = .;
426     } > DRAM
428     /* TRICK ALERT! For RAM execution, we put the .data section at the
429        same load address as the copy. Thus, we don't waste extra RAM
430        when we don't actually need the copy.  */
431     .data : AT ( _datacopy )
432     {
433         _datastart = .;
434         *(.data*)
435         . = ALIGN(0x4);
436         _dataend  = .;
437     } > DRAM
439     /DISCARD/ :
440     {
441         *(.eh_frame)
442     }
444 #if defined(CPU_ARM)
445     .vectors 0x0 :
446     {
447         _vectorsstart = .;
448         *(.vectors);
449         _vectorsend = .;
450 #if CONFIG_CPU==PNX0101
451         *(.dmabuf)
452     } >IRAM0 AT> DRAM
453 #else
454     } AT> DRAM
455 #endif
457     _vectorscopy = LOADADDR(.vectors);
458 #endif
460 #if CONFIG_CPU==PNX0101
461     .iram IRAMORIG + SIZEOF(.vectors) :
462 #else
463     .iram IRAMORIG :
464 #endif
465     {
466         _iramstart = .;
467         *(.icode)
468         *(.irodata)
469         *(.idata)
470         _iramend = .;
471     } > IRAM AT> DRAM
473     _iramcopy = LOADADDR(.iram);
475     .ibss (NOLOAD) :
476     {
477         _iedata = .;
478         *(.ibss)
479         . = ALIGN(0x4);
480         _iend = .;
481     } > IRAM
483 #if defined(CPU_COLDFIRE) || defined(CPU_ARM)
484 #ifdef CPU_PP
485     .idle_stacks :
486     {
487        *(.idle_stacks)
488 #if NUM_CORES > 1
489        cpu_idlestackbegin = .;
490        . += IDLE_STACK_SIZE;
491        cpu_idlestackend = .;
492 #endif
493        cop_idlestackbegin = .;
494        . += IDLE_STACK_SIZE;
495        cop_idlestackend = .;
496     } > IRAM
497 #endif
499     .stack :
500     {
501        *(.stack)
502        stackbegin = .;
503        . += 0x2000;
504        stackend = .;
505     } > IRAM
507 #else
508     /* TRICK ALERT! We want 0x2000 bytes of stack, but we set the section
509        size smaller, and allow the stack to grow into the .iram copy */
510     .stack ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
511     {
512        *(.stack)
513        _stackbegin = . - SIZEOF(.iram);
514        . += 0x2000 - SIZEOF(.iram);
515        _stackend = .;
516     } > DRAM
517 #endif
519 #if defined(CPU_COLDFIRE)
520     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
521 #elif defined(CPU_ARM)
522     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
523 #else
524     .bss :
525 #endif
526     {
527        _edata = .;
528         *(.bss*)
529         *(COMMON)
530         . = ALIGN(0x4);
531        _end = .;
532     } > DRAM
533     
534 #endif
536     .audiobuf ALIGN(4) :
537     {
538         _audiobuffer = .;
539         audiobuffer = .;
540     } > DRAM
542     .audiobufend ENDAUDIOADDR:
543     {
544         audiobufend = .;
545         _audiobufend = .;
546     } > DRAM
548     .codec ENDAUDIOADDR:
549     {
550         codecbuf = .;
551         _codecbuf = .;
552     }
554     .plugin ENDADDR:
555     {
556         _pluginbuf = .;
557         pluginbuf = .;
558     }