Correct compiler errors from last commit.
[Rockbox.git] / firmware / app.lds
blob0d7c191660330c4a72090b8102ab6f1142245306
1 #include "config.h"
3 ENTRY(start)
4 #ifdef CPU_COLDFIRE
5 OUTPUT_FORMAT(elf32-m68k)
6 INPUT(crt0.o)
7 #elif CONFIG_CPU == TCC730
8 OUTPUT_FORMAT(elf32-calmrisc16)
9 INPUT(crt0.o)
10 #elif defined(CPU_ARM)
11 OUTPUT_FORMAT(elf32-littlearm)
12 OUTPUT_ARCH(arm)
13 INPUT(crt0.o)
14 #else
15 OUTPUT_FORMAT(elf32-sh)
16 INPUT(crt0.o)
17 #endif
19 #if CONFIG_CPU == TCC730
20 MEMORY
22    FIRMWARE : ORIGIN = LOADADDRESS, LENGTH = 256K
23    FLASH (RX) : ORIGIN = 0x000000, LENGTH = 1024K
24    ICMEM (RX) : ORIGIN = 0x3FC000, LENGTH = 32K
25    IMEM1 : ORIGIN = 0x200000, LENGTH = 32K
26    IMEM2 : ORIGIN = 0x210000, LENGTH = 16K
27    IMEM3 : ORIGIN = 0x220000, LENGTH = 32K
28    IMEM4 : ORIGIN = 0x230000, LENGTH = 16K
30    DRAM : ORIGIN = 0x000000, LENGTH = 0x3F0000
33 SECTIONS
35 .text LOADADDRESS : {
36         *(.init.text)
37         *(.text) 
38         }> FLASH  AT> FIRMWARE 
40 .icode 0x3FC040: {
41         *(.vectors)
42         *(.icode)
43         }> ICMEM  AT> FIRMWARE
45 /* We start at 0x2000, to avoid overwriting Archos' loader datasegment.
46  * If it turns out that we won't call back the loader, this can be set to 0.
47  */
48 .bss 0x2000 : {
49         *(.bss)
50         . = ALIGN(2);
51         }> DRAM 
53 /* Data is put after BSS, to have all strings addresses > VIRT_PTR + VIRT_SIZE.
54    Strings are in rodata, so what we really assert is (.rodata > VIRT_PTR + VIRT_SIZE)
55    See settings.h for details */
56 .data ALIGN(2): { 
57         *(.data) 
58         . = ALIGN(2);
59         *(.rodata) 
60         . = ALIGN(2);
61         *(.rodata.str1.2)
62         . = ALIGN(2);
63         }> DRAM AT> FIRMWARE
66 .stack ALIGN(2) : {     
67    . = . + 0x2000;
68 }> DRAM
70 .idata 0x200000: {
71         *(.idata)
72 }> IMEM1
74 .idata2 0x220000: {
75         *(.idata2)
76 }> IMEM3
78 _codesize = SIZEOF(.text);
80 _icodecopy = LOADADDR(.icode);
81 _icodestart = ADDR(.icode);
82 _icodesize = SIZEOF(.icode);
84 _datacopy = LOADADDR(.data);
85 _datastart = ADDR(.data);
86 _datasize = SIZEOF(.data);
89 _bssstart = ADDR(.bss);
90 _bsssize = (SIZEOF(.bss) + 1) & ~ 1;
92 _stackbegin = ADDR(.stack);
93 _stackend = ADDR(.stack) + SIZEOF(.stack);
95 _idatastart = ADDR(.idata);
97 /* FIXME: Where to put audio buffer? */
99 _audiobuffer = 0;
100 _audiobufend = 0;
102 /* Plugins are not supported on the Gmini*/
104 _pluginbuf = 0;
107 #else
109 #define PLUGINSIZE PLUGIN_BUFFER_SIZE
110 #define CODECSIZE CODEC_SIZE
113 #ifdef DEBUG
114 #define STUBOFFSET 0x10000
115 #else
116 #define STUBOFFSET 0
117 #endif
119 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
121 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300)
122 #define DRAMORIG 0x31000000 + STUBOFFSET
123 #define IRAMORIG 0x10000000
124 #define IRAMSIZE 0xc000
125 #elif defined(IAUDIO_X5)
126 #define DRAMORIG 0x31000000 + STUBOFFSET
127 #define IRAMORIG 0x10000000
128 #define IRAMSIZE 0xc000
129 #elif (CONFIG_CPU==PP5002) || (CONFIG_CPU==PP5020)
130 #define DRAMORIG 0x00000000 + STUBOFFSET
131 #define IRAMORIG 0x40000000
132 #define IRAMSIZE 0xc000
133 #elif CONFIG_CPU==PNX0101
134 #define DRAMORIG 0xc00000 + STUBOFFSET
135 #define IRAMORIG 0x400000
136 #define IRAMSIZE 0x8000
137 #elif CONFIG_CPU==S3C2440
138 #define DRAMORIG 0x30000000 + STUBOFFSET
139 #define IRAMORIG 0x40000000
140 #define IRAMSIZE 4K
141 #else
142 #define DRAMORIG 0x09000000 + STUBOFFSET
143 #define IRAMORIG 0x0f000000
144 #define IRAMSIZE 0x1000
145 #endif
147 /* End of the audio buffer, where the codec buffer starts */
148 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
150 /* Where the codec buffer ends, and the plugin buffer starts */
151 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
153 MEMORY
155    DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
156    IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
159 SECTIONS
161 #ifndef CPU_ARM
162     .vectors :
163     {
164         loadaddress = .;
165         _loadaddress = .;
166         KEEP(*(.resetvectors));
167         *(.resetvectors);
168         KEEP(*(.vectors));
169         *(.vectors);
170     } > DRAM
172     .text :
173     {
174 #else
175     .text :
176     {
177         loadaddress = .;
178         _loadaddress = .;
179 #endif
180         . = ALIGN(0x200);
181         *(.init.text)
182         *(.text*)
183 #ifdef CPU_ARM
184         *(.glue_7)
185         *(.glue_7t)
186 #endif
187         . = ALIGN(0x4);
188     } > DRAM
190     .rodata :
191     {
192         *(.rodata)  /* problems without this, dunno why */
193         *(.rodata*)
194         *(.rodata.str1.1)
195         *(.rodata.str1.4)
196         . = ALIGN(0x4);
198         /* Pseudo-allocate the copies of the data sections */
199         _datacopy = .;
200     } > DRAM
202     /* TRICK ALERT! For RAM execution, we put the .data section at the
203        same load address as the copy. Thus, we don't waste extra RAM
204        when we don't actually need the copy.  */
205     .data : AT ( _datacopy )
206     {
207         _datastart = .;
208         *(.data*)
209         . = ALIGN(0x4);
210         _dataend  = .;
211     } > DRAM
213     /DISCARD/ : 
214     {
215         *(.eh_frame)
216     }
218 #ifdef CPU_ARM
219     .vectors 0x0 :
220     {
221         _vectorsstart = .;
222         *(.vectors);
223         _vectorsend = .;
224     } AT> DRAM
226     _vectorscopy = LOADADDR(.vectors);
227 #endif
229 #if CONFIG_CPU==PNX0101
230     .iram IRAMORIG + SIZEOF(.vectors) :
231 #else
232     .iram IRAMORIG :
233 #endif
234     {
235         _iramstart = .;
236         *(.icode)
237         *(.irodata)
238         *(.idata)
239         _iramend = .;
240     } > IRAM AT> DRAM
242     _iramcopy = LOADADDR(.iram);
243     
244     .ibss (NOLOAD) :
245     {
246         _iedata = .;
247         *(.ibss)
248         . = ALIGN(0x4);
249         _iend = .;
250     } > IRAM
252 #if defined(CPU_COLDFIRE) || defined(CPU_ARM)
253     .stack :
254     {
255        *(.stack)
256        stackbegin = .;
257        . += 0x2000;
258        stackend = .;
259     } > IRAM
260 #else
261     /* TRICK ALERT! We want 0x2000 bytes of stack, but we set the section
262        size smaller, and allow the stack to grow into the .iram copy */
263     .stack ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
264     {
265        *(.stack)
266        _stackbegin = . - SIZEOF(.iram);
267        . += 0x2000 - SIZEOF(.iram);
268        _stackend = .;
269     } > DRAM
270 #endif
272 #if defined(CPU_COLDFIRE)
273     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
274 #elif defined(CPU_ARM)
275     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram) + SIZEOF(.vectors):
276 #else
277     .bss :
278 #endif
279     {
280        _edata = .;
281         *(.bss*)
282         *(COMMON)
283         . = ALIGN(0x4);
284        _end = .;
285     } > DRAM
287     .audiobuf ALIGN(4) :
288     {
289         _audiobuffer = .;
290         audiobuffer = .;
291     } > DRAM
293     .audiobufend ENDAUDIOADDR:
294     {
295         audiobufend = .;
296         _audiobufend = .;
297     } > DRAM
299     .codec ENDAUDIOADDR:
300     {
301         codecbuf = .;
302         _codecbuf = .;
303     }
305     .plugin ENDADDR:
306     {
307         _pluginbuf = .;
308         pluginbuf = .;
309     }
312 #endif