No need to have this variable for targets that don't use it
[kugel-rb.git] / firmware / boot.lds
blobd2ea10a30dbc94d36e14e4a4e1acb061ba2b7ecc
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 #elif defined(CPU_TCC77X)
15 INPUT(target/arm/tcc77x/crt0.o)
16 #else
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 DRAMSIZE (MEMORYSIZE * 0x100000)
26 #ifdef IRIVER_H100_SERIES
27 #define DRAMORIG 0x31000000
28 #define IRAMORIG 0x10000000
29 #define IRAMSIZE 0x18000
30 #define FLASHORIG 0x001f0000
31 #define FLASHSIZE 2M
32 #elif defined(IRIVER_H300_SERIES)
33 #define DRAMORIG 0x31000000
34 #define IRAMORIG 0x10000000
35 #define IRAMSIZE 0x18000
36 #define FLASHORIG 0x003f0000
37 #define FLASHSIZE 4M
38 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
39 #define DRAMORIG 0x31000000
40 #define IRAMORIG 0x10000000
41 #define IRAMSIZE 0x20000
42 #define FLASHORIG 0x00010000
43 #define FLASHSIZE 4M
44 #elif CONFIG_CPU == PP5020
45 #define DRAMORIG 0x10000000
46 #define IRAMORIG 0x40000000
47 #define IRAMSIZE 0x18000
48 #define FLASHORIG 0x001f0000
49 #define FLASHSIZE 2M
50 #elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024)
51 #define DRAMORIG 0x10000000
52 #ifndef IRAMORIG
53 #define IRAMORIG 0x40000000
54 #endif
55 #define IRAMSIZE 0x20000
56 #define FLASHORIG 0x001f0000
57 #define FLASHSIZE 2M
58 #elif CONFIG_CPU == S3C2440
59 #define DRAMORIG 0x30000000
60 #define IRAMORIG 0x40000000
61 #define IRAMSIZE 4K
62 #define FLASHORIG 0x0000000
63 #define FLASHSIZE 1M
64 #elif CONFIG_CPU == DM320
65 #define DRAMORIG 0x00900000
66 #define IRAMORIG 0x00000000
67 #define IRAMSIZE 16K
68 #define FLASHORIG 0x00100000
69 #define FLASHSIZE 8M
70 #elif CONFIG_CPU == PP5002
71 #define DRAMORIG 0x28000000
72 #define IRAMORIG 0x40000000
73 #define IRAMSIZE 0x18000
74 #define FLASHORIG 0x001f0000
75 #define FLASHSIZE 2M
76 #elif CONFIG_CPU == IMX31L
77 #define DRAMORIG 0x80000000
78 #define IRAMORIG 0x1FFFC000
79 #define IRAMSIZE 16K
80 #define FLASHORIG 0x0000000
81 #define FLASHSIZE 1M
82 #elif defined(CPU_TCC77X)
83 #define DRAMORIG 0x20000000
84 #define IRAMORIG 0x00000000
85 #define IRAMSIZE 64K
86 #define FLASHORIG 0x0000000
87 #define FLASHSIZE 1M
88 #else
89 #define DRAMORIG 0x09000000
90 #define IRAMORIG 0x0f000000
91 #define IRAMSIZE 0x1000
92 #define FLASHORIG 0x02000000 + ROM_START
93 #define FLASHSIZE 256K - ROM_START
94 #endif
96 #if defined(CPU_TCC77X)
97 MEMORY
99 #ifdef TCCBOOT
100    DRAM : ORIGIN = DRAMORIG + DRAMSIZE - 0x100000, LENGTH = 0x100000
101 #else
102    DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
103 #endif
104    IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
106 #elif !defined(CPU_PP) && (CONFIG_CPU!=S3C2440) && (CONFIG_CPU!=IMX31L)
107 MEMORY
109    DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
110    IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
111    FLASH : ORIGIN = FLASHORIG, LENGTH = FLASHSIZE
113 #endif
115 SECTIONS
116 #ifdef CPU_PP
118   . = IRAMORIG;
120   .text : { 
121     *(.init.text)
122     *(.text*)
123   }
125   .data : {
126     *(.icode)
127     *(.irodata)
128     *(.idata)
129     *(.data*)
130     _dataend = . ;
131    }
133   .stack :
134   {
135      *(.stack)
136      _stackbegin = .;
137      stackbegin = .;
138      . += 0x2000;
139      _stackend = .;
140      stackend = .;
141   }
143   /* The bss section is too large for IRAM - we just move it 16MB into the
144      DRAM */
146   . = (DRAMORIG+16*1024*1024);
147   .bss : {
148      _edata = .;
149      *(.bss*);
150      *(.ibss);
151      _end = .;
152    }
154 #elif (CONFIG_CPU==S3C2440)
156     . = DRAMORIG + 0x1000000;
158     .text : {
159         *(.init.text)
160         *(.text*)
161     }
163     .data : {
164         *(.icode)
165         *(.irodata)
166         *(.idata)
167         *(.data*)
168         . = ALIGN(0x4);
169         _dataend = . ;
170      }
172     .stack :
173     {
174          *(.stack)
175          _stackbegin = .;
176          stackbegin = .;
177          . += 0x2000;
178          _stackend = .;
179          stackend = .;
180     }
181     .bss : {
182          _edata = .;
183          *(.bss*);
184          *(.ibss);
185          *(COMMON)
186          _end = .;
187      }
189 #elif defined(CPU_TCC77X)
191     .text : {
192         *(.init.text)
193         *(.text)
194         *(.text*)
195         *(.glue_7)
196         *(.glue_7t)
197    } > DRAM
199     .data : {
200         *(.icode)
201         *(.irodata)
202         *(.idata)
203         *(.data*)
204         *(.rodata.*)
205         . = ALIGN(0x4);
206         _dataend = . ;
207     } > DRAM
209     .stack :
210     {
211          *(.stack)
212          _stackbegin = .;
213          stackbegin = .;
214          . += 0x2000;
215          _stackend = .;
216          stackend = .;
217     } > DRAM
218     .bss : {
219          _edata = .;
220          *(.bss*);
221          *(.ibss);
222          *(COMMON)
223          _end = .;
224      } > DRAM
226 #elif (CONFIG_CPU==DM320)
228     . = DRAMORIG + 0x1000000;
230     .text : {
231         loadaddress = .;
232         _loadaddress = .;
233         *(.init.text)
234         *(.text*)
235         *(.glue_7)
236         *(.glue_7t)
237         . = ALIGN(0x4);
238     } > DRAM
240     .rodata :
241     {
242         *(.rodata)  /* problems without this, dunno why */
243         *(.rodata*)
244         *(.rodata.str1.1)
245         *(.rodata.str1.4)
246         . = ALIGN(0x4);
248         /* Pseudo-allocate the copies of the data sections */
249         _datacopy = .;
250     } > DRAM
252     .data : {
253         *(.icode)
254         *(.irodata)
255         *(.idata)
256         *(.data*)
257         . = ALIGN(0x4);
258         _dataend = . ;
259     } > DRAM
261     .stack :
262     {
263          *(.stack)
264          _stackbegin = .;
265          stackbegin = .;
266          . += 0x2000;
267          _stackend = .;
268          stackend = .;
269     } > DRAM
271     .bss :
272     {
273          _edata = .;
274          *(.bss*);
275          *(.ibss);
276          *(COMMON)
277          _end = .;
278     } > DRAM
280     .vectors IRAMORIG :
281     {
282         _vectorsstart = .;
283         KEEP(*(.resetvectors));
284         *(.resetvectors);
285         KEEP(*(.vectors));
286         *(.vectors);
287         _vectorsend = .;
288     } AT > DRAM
289     _vectorscopy = LOADADDR(.vectors);
291 #elif (CONFIG_CPU==IMX31L)
293   . = 0x88201000;
294   .vectors : 
295   {  
296     KEEP(*(.vectors*));
297     *(.vectors*);
298   }  
299   .text : {
300     *(.init.text)
301     *(.text*)
302   }
303   .data : {
304     *(.icode)
305     *(.irodata)
306     *(.idata)
307     *(.data*)
308     _dataend = . ;
309    }
310   .stack :
311   {
312      *(.stack)
313      _stackbegin = .;
314      stackbegin = .;
315      . += 0x2000;
316      _stackend = .;
317      stackend = .;
318   }
319   .bss : {
320      _edata = .;
321      *(.bss*);
322      *(.ibss);
323      _end = .;
324    }
326 #else
328     .vectors :
329     {
330 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
331         *(.init.text)
332 #endif
333         _datacopy = .;
334     } > FLASH
336     .data : AT ( _datacopy )
337     {
338         _datastart = .;
339         KEEP(*(.resetvectors));
340         *(.resetvectors);
341         KEEP(*(.vectors));
342         *(.vectors);
343         . = ALIGN(0x200);
344         *(.icode)
345         *(.irodata)
346         *(.idata)
347         *(.data*)
348         . = ALIGN(0x4);
349         _dataend = .;
350         . = ALIGN(0x10);  /* Maintain proper alignment for .text section */
351     } > IRAM
353     /* TRICK ALERT! Newer versions of the linker don't allow output sections
354        to overlap even if one of them is empty, so advance the location pointer
355        "by hand" */
356     .text LOADADDR(.data) + SIZEOF(.data) :
357     {
358         *(.init.text)
359         *(.text*)
360         . = ALIGN(0x4);
361     } > FLASH
363     .rodata :
364     {
365         *(.rodata*)
366         . = ALIGN(0x4);
367         _iramcopy = .;
368     } > FLASH
370     .stack :
371     {
372        *(.stack)
373        _stackbegin = .;
374        stackbegin = .;
375        . += 0x2000;
376        _stackend = .;
377        stackend = .;
378     } > IRAM
380 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) \
381  || defined(IAUDIO_X5) || defined(IAUDIO_M5)
382     .bss DRAMORIG+0x800000:
383 #else
384     .bss :
385 #endif
386     {
387        _edata = .;
388         *(.ibss)
389         *(.bss*)
390         *(COMMON)
391        _end = .;
392 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) \
393  || defined(IAUDIO_X5) || defined(IAUDIO_M5)
394     } > DRAM
395 #else
396     } > IRAM
397 #endif
400 #endif