change the SCREEN_ROTATE define to be more meaningful, and set the mr500 orientation...
[Rockbox.git] / firmware / app.lds
blob3b53c6e46a4cbd6c26116def460c52cdf86e8375
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 defined(OLYMPUS_MROBE_500)
13 INPUT(target/arm/tms320dm320/crt0.o)
14 #elif CONFIG_CPU == PNX0101
15 INPUT(target/arm/pnx0101/crt0-pnx0101.o)
16 #elif defined(CPU_ARM)
17 INPUT(target/arm/crt0.o)
18 #endif
19 #else
20 OUTPUT_FORMAT(elf32-sh)
21 INPUT(target/sh/crt0.o)
22 #endif
24 #define PLUGINSIZE PLUGIN_BUFFER_SIZE
25 #define CODECSIZE CODEC_SIZE
27 #ifdef DEBUG
28 #define STUBOFFSET 0x10000
29 #else
30 #define STUBOFFSET 0
31 #endif
33 #if CONFIG_CPU==S3C2440
34 #include "s3c2440.h"
35 #define DRAMSIZE (MEMORYSIZE * 0x100000) - 0x100 - PLUGINSIZE - STUBOFFSET - CODECSIZE - LCD_BUFFER_SIZE - TTB_SIZE
36 #elif CONFIG_CPU==DM320
37 #include "dm320.h"
38 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE - LCD_BUFFER_SIZE - TTB_SIZE
39 #else
40 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
41 #endif
43 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300)
44 #define DRAMORIG 0x31000000 + STUBOFFSET
45 #define IRAMORIG 0x10000000
46 #define IRAMSIZE 0xc000
47 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
48 #define DRAMORIG 0x31000000 + STUBOFFSET
49 #define IRAMORIG 0x10000000
50 #define IRAMSIZE 0x10000
51 #elif defined(CPU_PP)
52 #define DRAMORIG 0x00000000 + STUBOFFSET
53 #define IRAMORIG 0x40000000
54 #define IRAMSIZE 0xc000
55 #elif CONFIG_CPU==PNX0101
56 #define DRAMORIG 0xc00000 + STUBOFFSET
57 #define IRAM0ORIG 0x000000
58 #define IRAM0SIZE 0x7000
59 #define IRAMORIG 0x400000
60 #define IRAMSIZE 0x7000
61 #elif CONFIG_CPU==S3C2440
62 #define DRAMORIG 0x00000100 + STUBOFFSET
63 #define IRAMORIG DRAMORIG
64 #define IRAMSIZE 0x1000
65 #define IRAM DRAM
66 #elif CONFIG_CPU==DM320
67 #define DRAMORIG 0x00900000 + STUBOFFSET
68 #define IRAMORIG 0x00000000
69 #define IRAMSIZE 0x4000
70 #elif CONFIG_CPU==IMX31L
71 #define DRAMORIG (0x80000000 + STUBOFFSET)
72 #define IRAMORIG 0x1FFFC000
73 #define IRAMSIZE 0x4000
74 #else
75 #define DRAMORIG 0x09000000 + STUBOFFSET
76 #define IRAMORIG 0x0f000000
77 #define IRAMSIZE 0x1000
78 #endif
80 /* End of the audio buffer, where the codec buffer starts */
81 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
83 /* Where the codec buffer ends, and the plugin buffer starts */
84 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
86 MEMORY
88     DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
89 #if CONFIG_CPU != S3C2440
90     IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
91 #endif
92 #if CONFIG_CPU==PNX0101
93     IRAM0 : ORIGIN = IRAM0ORIG, LENGTH = IRAM0SIZE
94 #endif
97 SECTIONS
99 #if (CONFIG_CPU==DM320)
100     .text :
101     {
102         loadaddress = .;
103         _loadaddress = .;
104         . = ALIGN(0x200);
105         *(.init.text)
106         *(.text*)
107         *(.glue_7)
108         *(.glue_7t)
109         . = ALIGN(0x4);
110     } > DRAM
112     .rodata :
113     {
114         *(.rodata)  /* problems without this, dunno why */
115         *(.rodata*)
116         *(.rodata.str1.1)
117         *(.rodata.str1.4)
118         . = ALIGN(0x4);
120         /* Pseudo-allocate the copies of the data sections */
121         _datacopy = .;
122     } > DRAM
124     /* TRICK ALERT! For RAM execution, we put the .data section at the
125        same load address as the copy. Thus, we don't waste extra RAM
126        when we don't actually need the copy.  */
127     .data : AT ( _datacopy )
128     {
129         _datastart = .;
130         *(.data*)
131         . = ALIGN(0x4);
132         _dataend  = .;
133     } > DRAM
135     /DISCARD/ :
136     {
137         *(.eh_frame)
138     }
140     .vectors IRAMORIG :
141     {
142         _vectorsstart = .;
143         *(.vectors);
144         _vectorsend = .;
145     } > IRAM AT> DRAM
147     _vectorscopy = LOADADDR(.vectors);
149     .iram :
150     {
151         _iramstart = .;
152         *(.icode)
153         *(.irodata)
154         *(.idata)
155         _iramend = .;
156     } > IRAM AT> DRAM
158     _iramcopy = LOADADDR(.iram);
160     .ibss (NOLOAD) :
161     {
162         _iedata = .;
163         *(.ibss)
164         . = ALIGN(0x4);
165         _iend = .;
166     } > IRAM
168     .stack :
169     {
170        *(.stack)
171        stackbegin = .;
172        . += 0x2000;
173        stackend = .;
174     } > IRAM
176     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
177     {
178        _edata = .;
179         *(.bss*)
180         *(COMMON)
181         . = ALIGN(0x4);
182        _end = .;
183     } > DRAM
185 #else /* End DM320 */
186 #if !defined(CPU_ARM)
187     .vectors :
188     {
189         loadaddress = .;
190         _loadaddress = .;
191         KEEP(*(.resetvectors));
192         *(.resetvectors);
193         KEEP(*(.vectors));
194         *(.vectors);
195     } > DRAM
197     .text :
198     {
199 #else
200     .text :
201     {
202         loadaddress = .;
203         _loadaddress = .;
204 #endif
205         . = ALIGN(0x200);
206         *(.init.text)
207         *(.text*)
208 #ifdef CPU_ARM
209         *(.glue_7)
210         *(.glue_7t)
211 #endif
212         . = ALIGN(0x4);
213     } > DRAM
215     .rodata :
216     {
217         *(.rodata)  /* problems without this, dunno why */
218         *(.rodata*)
219         *(.rodata.str1.1)
220         *(.rodata.str1.4)
221         . = ALIGN(0x4);
223         /* Pseudo-allocate the copies of the data sections */
224         _datacopy = .;
225     } > DRAM
227     /* TRICK ALERT! For RAM execution, we put the .data section at the
228        same load address as the copy. Thus, we don't waste extra RAM
229        when we don't actually need the copy.  */
230     .data : AT ( _datacopy )
231     {
232         _datastart = .;
233         *(.data*)
234         . = ALIGN(0x4);
235         _dataend  = .;
236     } > DRAM
238     /DISCARD/ :
239     {
240         *(.eh_frame)
241     }
243 #if defined(CPU_ARM)
244 #if CONFIG_CPU==DM320
245     .vectors IRAMORIG :
246 #else
247     .vectors 0x0 :
248 #endif
249     {
250         _vectorsstart = .;
251         *(.vectors);
252         _vectorsend = .;
253 #if CONFIG_CPU==PNX0101
254         *(.dmabuf)
255     } >IRAM0 AT> DRAM
256 #elif CONFIG_CPU==DM320
257     } > IRAM AT> DRAM
258 #else
259     } AT> DRAM
260 #endif
262     _vectorscopy = LOADADDR(.vectors);
263 #endif
265 #if CONFIG_CPU==PNX0101
266     .iram IRAMORIG + SIZEOF(.vectors) :
267 #elif CONFIG_CPU==S3C2440 || CONFIG_CPU==DM320
268     .iram :
269 #else
270     .iram IRAMORIG :
271 #endif
272     {
273         _iramstart = .;
274         *(.icode)
275         *(.irodata)
276         *(.idata)
277         _iramend = .;
278     } > IRAM AT> DRAM
280     _iramcopy = LOADADDR(.iram);
282     .ibss (NOLOAD) :
283     {
284         _iedata = .;
285         *(.ibss)
286         . = ALIGN(0x4);
287         _iend = .;
288     } > IRAM
290 #if defined(CPU_COLDFIRE) || defined(CPU_ARM)
291     .stack :
292     {
293        *(.stack)
294        stackbegin = .;
295        . += 0x2000;
296        stackend = .;
297     } > IRAM
299 #ifdef CPU_PP
300     .idle_stacks :
301     {
302        *(.idle_stacks)
303 #if NUM_CORES > 1
304        cpu_idlestackbegin = .;
305        . += IDLE_STACK_SIZE;
306        cpu_idlestackend = .;
307 #endif
308        cop_idlestackbegin = .;
309        . += IDLE_STACK_SIZE;
310        cop_idlestackend = .;
311     } > IRAM
312 #endif
314 #else
315     /* TRICK ALERT! We want 0x2000 bytes of stack, but we set the section
316        size smaller, and allow the stack to grow into the .iram copy */
317     .stack ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
318     {
319        *(.stack)
320        _stackbegin = . - SIZEOF(.iram);
321        . += 0x2000 - SIZEOF(.iram);
322        _stackend = .;
323     } > DRAM
324 #endif
326 #if defined(CPU_COLDFIRE)
327     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
328 #elif defined(CPU_ARM) && CONFIG_CPU != S3C2440
329     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
330 #else
331     .bss :
332 #endif
333     {
334        _edata = .;
335         *(.bss*)
336         *(COMMON)
337         . = ALIGN(0x4);
338        _end = .;
339     } > DRAM
340     
341 #endif
343     .audiobuf ALIGN(4) :
344     {
345         _audiobuffer = .;
346         audiobuffer = .;
347     } > DRAM
349     .audiobufend ENDAUDIOADDR:
350     {
351         audiobufend = .;
352         _audiobufend = .;
353     } > DRAM
355     .codec ENDAUDIOADDR:
356     {
357         codecbuf = .;
358         _codecbuf = .;
359     }
361     .plugin ENDADDR:
362     {
363         _pluginbuf = .;
364         pluginbuf = .;
365     }