No bufclosing of handles after track change
[Rockbox.git] / firmware / app.lds
blobf77d0a1c2276bef5ade8a371755ad3ee7d513536
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 IRAMORIG 0x400000
58 #define IRAMSIZE 0x7000
59 #elif CONFIG_CPU==S3C2440
60 #define DRAMORIG 0x00000100 + STUBOFFSET
61 #define IRAMORIG DRAMORIG
62 #define IRAMSIZE 0x1000
63 #define IRAM DRAM
64 #elif CONFIG_CPU==DM320
65 #define DRAMORIG 0x00900000 + STUBOFFSET
66 #define IRAMORIG 0x00000000
67 #define IRAMSIZE 0x4000
68 #elif CONFIG_CPU==IMX31L
69 #define DRAMORIG (0x80000000 + STUBOFFSET)
70 #define IRAMORIG 0x1FFFC000
71 #define IRAMSIZE 0x4000
72 #else
73 #define DRAMORIG 0x09000000 + STUBOFFSET
74 #define IRAMORIG 0x0f000000
75 #define IRAMSIZE 0x1000
76 #endif
78 /* End of the audio buffer, where the codec buffer starts */
79 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
81 /* Where the codec buffer ends, and the plugin buffer starts */
82 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
84 MEMORY
86    DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
87 #if CONFIG_CPU != S3C2440
88    IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
89 #endif
90 #if CONFIG_CPU==PNX0101
91    IRAM0 : ORIGIN = 0x0, LENGTH = IRAMSIZE
92 #endif
95 SECTIONS
97 #if !defined(CPU_ARM)
98     .vectors :
99     {
100         loadaddress = .;
101         _loadaddress = .;
102         KEEP(*(.resetvectors));
103         *(.resetvectors);
104         KEEP(*(.vectors));
105         *(.vectors);
106     } > DRAM
108     .text :
109     {
110 #else
111     .text :
112     {
113         loadaddress = .;
114         _loadaddress = .;
115 #endif
116         . = ALIGN(0x200);
117         *(.init.text)
118         *(.text*)
119 #ifdef CPU_ARM
120         *(.glue_7)
121         *(.glue_7t)
122 #endif
123         . = ALIGN(0x4);
124     } > DRAM
126     .rodata :
127     {
128         *(.rodata)  /* problems without this, dunno why */
129         *(.rodata*)
130         *(.rodata.str1.1)
131         *(.rodata.str1.4)
132         . = ALIGN(0x4);
134         /* Pseudo-allocate the copies of the data sections */
135         _datacopy = .;
136     } > DRAM
138     /* TRICK ALERT! For RAM execution, we put the .data section at the
139        same load address as the copy. Thus, we don't waste extra RAM
140        when we don't actually need the copy.  */
141     .data : AT ( _datacopy )
142     {
143         _datastart = .;
144         *(.data*)
145         . = ALIGN(0x4);
146         _dataend  = .;
147     } > DRAM
149     /DISCARD/ :
150     {
151         *(.eh_frame)
152     }
154 #if defined(CPU_ARM)
155 #if CONFIG_CPU==DM320
156     .vectors IRAMORIG :
157 #else
158     .vectors 0x0 :
159 #endif
160     {
161         _vectorsstart = .;
162         *(.vectors);
163         _vectorsend = .;
164 #if CONFIG_CPU==PNX0101
165         *(.dmabuf)
166     } >IRAM0 AT> DRAM
167 #elif CONFIG_CPU==DM320
168     } > IRAM AT> DRAM
169 #else
170     } AT> DRAM
171 #endif
173     _vectorscopy = LOADADDR(.vectors);
174 #endif
176 #if CONFIG_CPU==PNX0101
177     .iram IRAMORIG + SIZEOF(.vectors) :
178 #elif CONFIG_CPU==S3C2440 || CONFIG_CPU==DM320
179     .iram :
180 #else
181     .iram IRAMORIG :
182 #endif
183     {
184         _iramstart = .;
185         *(.icode)
186         *(.irodata)
187         *(.idata)
188         _iramend = .;
189     } > IRAM AT> DRAM
191     _iramcopy = LOADADDR(.iram);
193     .ibss (NOLOAD) :
194     {
195         _iedata = .;
196         *(.ibss)
197         . = ALIGN(0x4);
198         _iend = .;
199     } > IRAM
201 #if defined(CPU_COLDFIRE) || defined(CPU_ARM)
202     .stack :
203     {
204        *(.stack)
205        stackbegin = .;
206        . += 0x2000;
207        stackend = .;
208     } > IRAM
210 #ifdef CPU_PP
211     .idle_stacks :
212     {
213        *(.idle_stacks)
214 #if NUM_CORES > 1
215        cpu_idlestackbegin = .;
216        . += IDLE_STACK_SIZE;
217        cpu_idlestackend = .;
218 #endif
219        cop_idlestackbegin = .;
220        . += IDLE_STACK_SIZE;
221        cop_idlestackend = .;
222     } > IRAM
223 #endif
225 #else
226     /* TRICK ALERT! We want 0x2000 bytes of stack, but we set the section
227        size smaller, and allow the stack to grow into the .iram copy */
228     .stack ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
229     {
230        *(.stack)
231        _stackbegin = . - SIZEOF(.iram);
232        . += 0x2000 - SIZEOF(.iram);
233        _stackend = .;
234     } > DRAM
235 #endif
237 #if defined(CPU_COLDFIRE)
238     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
239 #elif defined(CPU_ARM) && CONFIG_CPU != S3C2440
240     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
241 #else
242     .bss :
243 #endif
244     {
245        _edata = .;
246         *(.bss*)
247         *(COMMON)
248         . = ALIGN(0x4);
249        _end = .;
250     } > DRAM
252     .audiobuf ALIGN(4) :
253     {
254         _audiobuffer = .;
255         audiobuffer = .;
256     } > DRAM
258     .audiobufend ENDAUDIOADDR:
259     {
260         audiobufend = .;
261         _audiobufend = .;
262     } > DRAM
264     .codec ENDAUDIOADDR:
265     {
266         codecbuf = .;
267         _codecbuf = .;
268     }
270     .plugin ENDADDR:
271     {
272         _pluginbuf = .;
273         pluginbuf = .;
274     }