Revert the recent change to bufread()
[Rockbox.git] / firmware / boot.lds
bloba8404134ae52cdd8ee1997379c33fc9b0ad39822
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-bl.o)
12 #elif defined(OLYMPUS_MROBE_500)
13 INPUT(target/arm/tms320dm320/crt0.o)
14 #else
15 INPUT(target/arm/crt0.o)
16 #endif
17 #else
18 OUTPUT_FORMAT(elf32-sh)
19 INPUT(target/sh/crt0.o)
20 #endif
22 #define DRAMSIZE (MEMORYSIZE * 0x100000)
24 #ifdef IRIVER_H100_SERIES
25 #define DRAMORIG 0x31000000
26 #define IRAMORIG 0x10000000
27 #define IRAMSIZE 0x18000
28 #define FLASHORIG 0x001f0000
29 #define FLASHSIZE 2M
30 #elif defined(IRIVER_H300_SERIES)
31 #define DRAMORIG 0x31000000
32 #define IRAMORIG 0x10000000
33 #define IRAMSIZE 0x18000
34 #define FLASHORIG 0x003f0000
35 #define FLASHSIZE 4M
36 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
37 #define DRAMORIG 0x31000000
38 #define IRAMORIG 0x10000000
39 #define IRAMSIZE 0x20000
40 #define FLASHORIG 0x00010000
41 #define FLASHSIZE 4M
42 #elif CONFIG_CPU == PP5020
43 #define DRAMORIG 0x10000000
44 #define IRAMORIG 0x40000000
45 #define IRAMSIZE 0x18000
46 #define FLASHORIG 0x001f0000
47 #define FLASHSIZE 2M
48 #elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024)
49 #define DRAMORIG 0x10000000
50 #ifndef IRAMORIG
51 #define IRAMORIG 0x40000000
52 #endif
53 #define IRAMSIZE 0x20000
54 #define FLASHORIG 0x001f0000
55 #define FLASHSIZE 2M
56 #elif CONFIG_CPU == S3C2440
57 #define DRAMORIG 0x30000000
58 #define IRAMORIG 0x40000000
59 #define IRAMSIZE 4K
60 #define FLASHORIG 0x0000000
61 #define FLASHSIZE 1M
62 #elif CONFIG_CPU == DM320
63 #define DRAMORIG 0x00900000
64 #define IRAMORIG 0x00000000
65 #define IRAMSIZE 16K
66 #define FLASHORIG 0x00100000
67 #define FLASHSIZE 8M
68 #elif CONFIG_CPU == PP5002
69 #define DRAMORIG 0x28000000
70 #define IRAMORIG 0x40000000
71 #define IRAMSIZE 0x18000
72 #define FLASHORIG 0x001f0000
73 #define FLASHSIZE 2M
74 #elif CONFIG_CPU == IMX31L
75 #define DRAMORIG 0x80000000
76 #define IRAMORIG 0x1FFFC000
77 #define IRAMSIZE 16K
78 #define FLASHORIG 0x0000000
79 #define FLASHSIZE 1M
80 #else
81 #define DRAMORIG 0x09000000
82 #define IRAMORIG 0x0f000000
83 #define IRAMSIZE 0x1000
84 #define FLASHORIG 0x02000000 + ROM_START
85 #define FLASHSIZE 256K - ROM_START
86 #endif
88 #if !defined(CPU_PP) && (CONFIG_CPU!=S3C2440) && (CONFIG_CPU!=IMX31L)
89 MEMORY
91    DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
92    IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
93    FLASH : ORIGIN = FLASHORIG, LENGTH = FLASHSIZE
95 #endif
97 SECTIONS
98 #ifdef CPU_PP
100   . = IRAMORIG;
102   .text : { 
103     *(.init.text)
104     *(.text*)
105   }
107   .data : {
108     *(.icode)
109     *(.irodata)
110     *(.idata)
111     *(.data*)
112     _dataend = . ;
113    }
115   .stack :
116   {
117      *(.stack)
118      _stackbegin = .;
119      stackbegin = .;
120      . += 0x2000;
121      _stackend = .;
122      stackend = .;
123   }
125   /* The bss section is too large for IRAM - we just move it 16MB into the
126      DRAM */
128   . = (DRAMORIG+16*1024*1024);
129   .bss : {
130      _edata = .;
131      *(.bss*);
132      *(.ibss);
133      _end = .;
134    }
136 #elif (CONFIG_CPU==S3C2440)
138     . = DRAMORIG + 0x1000000;
140     .text : {
141         *(.init.text)
142         *(.text*)
143     }
145     .data : {
146         *(.icode)
147         *(.irodata)
148         *(.idata)
149         *(.data*)
150         . = ALIGN(0x4);
151         _dataend = . ;
152      }
154     .stack :
155     {
156          *(.stack)
157          _stackbegin = .;
158          stackbegin = .;
159          . += 0x2000;
160          _stackend = .;
161          stackend = .;
162     }
163     .bss : {
164          _edata = .;
165          *(.bss*);
166          *(.ibss);
167          *(COMMON)
168          _end = .;
169      }
171 #elif (CONFIG_CPU==DM320)
173     . = DRAMORIG + 0x1000000;
175     .text : {
176         loadaddress = .;
177         _loadaddress = .;
178         *(.init.text)
179         *(.text*)
180         *(.glue_7)
181         *(.glue_7t)
182         . = ALIGN(0x4);
183     } > DRAM
185     .rodata :
186     {
187         *(.rodata)  /* problems without this, dunno why */
188         *(.rodata*)
189         *(.rodata.str1.1)
190         *(.rodata.str1.4)
191         . = ALIGN(0x4);
193         /* Pseudo-allocate the copies of the data sections */
194         _datacopy = .;
195     } > DRAM
197     .data : {
198         *(.icode)
199         *(.irodata)
200         *(.idata)
201         *(.data*)
202         . = ALIGN(0x4);
203         _dataend = . ;
204     } > DRAM
206     .stack :
207     {
208          *(.stack)
209          _stackbegin = .;
210          stackbegin = .;
211          . += 0x2000;
212          _stackend = .;
213          stackend = .;
214     } > DRAM
216     .bss :
217     {
218          _edata = .;
219          *(.bss*);
220          *(.ibss);
221          *(COMMON)
222          _end = .;
223     } > DRAM
225     .vectors IRAMORIG :
226     {
227         _vectorsstart = .;
228         KEEP(*(.resetvectors));
229         *(.resetvectors);
230         KEEP(*(.vectors));
231         *(.vectors);
232         _vectorsend = .;
233     } AT > DRAM
234     _vectorscopy = LOADADDR(.vectors);
236 #elif (CONFIG_CPU==IMX31L)
238   . = 0x88201000;
239   .vectors : 
240   {  
241     KEEP(*(.vectors*));
242     *(.vectors*);
243   }  
244   .text : {
245     *(.init.text)
246     *(.text*)
247   }
248   .data : {
249     *(.icode)
250     *(.irodata)
251     *(.idata)
252     *(.data*)
253     _dataend = . ;
254    }
255   .stack :
256   {
257      *(.stack)
258      _stackbegin = .;
259      stackbegin = .;
260      . += 0x2000;
261      _stackend = .;
262      stackend = .;
263   }
264   .bss : {
265      _edata = .;
266      *(.bss*);
267      *(.ibss);
268      _end = .;
269    }
271 #else
273     .vectors :
274     {
275 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
276         *(.init.text)
277 #endif
278         _datacopy = .;
279     } > FLASH
281     .data : AT ( _datacopy )
282     {
283         _datastart = .;
284         KEEP(*(.resetvectors));
285         *(.resetvectors);
286         KEEP(*(.vectors));
287         *(.vectors);
288         . = ALIGN(0x200);
289         *(.icode)
290         *(.irodata)
291         *(.idata)
292         *(.data*)
293         . = ALIGN(0x4);
294         _dataend = .;
295         . = ALIGN(0x10);  /* Maintain proper alignment for .text section */
296     } > IRAM
298     /* TRICK ALERT! Newer versions of the linker don't allow output sections
299        to overlap even if one of them is empty, so advance the location pointer
300        "by hand" */
301     .text LOADADDR(.data) + SIZEOF(.data) :
302     {
303         *(.init.text)
304         *(.text*)
305         . = ALIGN(0x4);
306     } > FLASH
308     .rodata :
309     {
310         *(.rodata*)
311         . = ALIGN(0x4);
312         _iramcopy = .;
313     } > FLASH
315     .stack :
316     {
317        *(.stack)
318        _stackbegin = .;
319        stackbegin = .;
320        . += 0x2000;
321        _stackend = .;
322        stackend = .;
323     } > IRAM
325 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) \
326  || defined(IAUDIO_X5) || defined(IAUDIO_M5)
327     .bss DRAMORIG+0x800000:
328 #else
329     .bss :
330 #endif
331     {
332        _edata = .;
333         *(.ibss)
334         *(.bss*)
335         *(COMMON)
336        _end = .;
337 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) \
338  || defined(IAUDIO_X5) || defined(IAUDIO_M5)
339     } > DRAM
340 #else
341     } > IRAM
342 #endif
345 #endif