Do some #ifdef'ing to make the Player happy.
[kugel-rb.git] / firmware / rom.lds
bloba56beea91555d607e9db568518ac6e730bfd34ed
1 #include "config.h"
3 ENTRY(start)
5 #ifdef CPU_COLDFIRE
6 OUTPUT_FORMAT(elf32-m68k)
7 STARTUP(target/coldfire/crt0.o)
8 #elif defined(CPU_PP)
9 OUTPUT_FORMAT(elf32-littlearm)
10 STARTUP(target/arm/crt0-pp.o)
11 #elif defined(CPU_ARM)
12 OUTPUT_FORMAT(elf32-littlearm)
13 STARTUP(target/arm/crt0.o)
14 #elif CONFIG_CPU == SH7034
15 OUTPUT_FORMAT(elf32-sh)
16 STARTUP(target/sh/crt0.o)
17 #else
18 OUTPUT_FORMAT(elf32-sh)
19 STARTUP(crt0.o)
20 #endif
23 #if MEMORYSIZE >= 32
24 #define PLUGINSIZE PLUGIN_BUFFER_SIZE
25 #else
26 #define PLUGINSIZE 0x8000
27 #endif
30 #ifdef IRIVER_H100_SERIES
31 #define CODECSIZE CODEC_SIZE
32 #define DRAMORIG 0x31000000
33 #define IRAMORIG 0x10000000
34 #define IRAMSIZE 0xc000
35 #define FLASHORIG 0x00100028
36 #define FLASHSIZE 0x000eff80
37 #else
38 #define DRAMORIG 0x09000000
39 #define IRAMORIG 0x0f000000
40 #define IRAMSIZE 0x1000
41 #define FLASHORIG 0x02000000 + ROM_START
42 #define FLASHSIZE 256K - ROM_START
43 #endif
45 #ifdef CODECSIZE
46 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - CODECSIZE
47 /* Where the codec buffer ends, and the plugin buffer starts */
48 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
49 #else
50 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE
51 /* Where the audio buffer ends, and the plugin buffer starts */
52 #define ENDADDR ENDAUDIOADDR
53 #endif
55 /* End of the audio buffer, where the codec/plugin buffer starts */
56 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
58 MEMORY
60    DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
61    IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
62    FLASH : ORIGIN = FLASHORIG, LENGTH = FLASHSIZE
64 SECTIONS
66     .flashheader : 
67     {
68         /* place flash link address first, so the plugin can check */   
69         LONG(FLASHORIG);
70         /* followed by the start address, the first vector takes care of this. */
71         /* If we ever place the table elsewhere, put a constant here. */
72     } > FLASH
74     .vectors :
75     {
76         _datacopy = .;
77     } > FLASH
79     .data : AT ( _datacopy )
80     {
81         loadaddress = .;
82         _loadaddress = .;
83         _datastart = .;
84         *(.resetvectors);
85         *(.vectors);
86         . = ALIGN(0x200);
87         *(.data)
88         . = ALIGN(0x4);
89         _dataend = .;        
90         . = ALIGN(0x10);  /* Maintain proper alignment for .text section */
91     } > DRAM
92     
93     /DISCARD/ : 
94     {
95         *(.eh_frame)
96     }
98     /* TRICK ALERT! Newer versions of the linker don't allow output sections
99        to overlap even if one of them is empty, so advance the location pointer
100        "by hand" */
101     .text LOADADDR(.data) + SIZEOF(.data) :
102     {
103         *(.init.text)
104         *(.text)
105         . = ALIGN(0x4);
106     } > FLASH
108     .rodata :
109     {
110         *(.rodata)
111         *(.rodata.str1.1)
112         *(.rodata.str1.4)
113         . = ALIGN(0x4);
114         _iramcopy = .;
115     } > FLASH
117     .iram IRAMORIG : AT ( _iramcopy )
118     {
119         _iramstart = .;
120         *(.icode)
121         *(.irodata)
122         *(.idata)
123         _iramend = .;
124     } > IRAM
126     .ibss (NOLOAD) :
127     {
128         _iedata = .;
129         *(.ibss)
130         . = ALIGN(0x4);
131         _iend = .;
132     } > IRAM
134     .stack :
135     {
136        *(.stack)
137        _stackbegin = .;
138        stackbegin = .;
139        . += 0x2000;
140        _stackend = .;
141        stackend = .;
142 #if IRAMSIZE > 0x1000
143     } > IRAM
144 #else
145     } > DRAM
146 #endif
148 #ifdef CPU_COLDFIRE
149     .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
150 #else
151     .bss :
152 #endif
153     {
154        _edata = .;
155         *(.bss*)
156         *(COMMON)
157         . = ALIGN(0x4);
158        _end = .;
159     } > DRAM
161     .audiobuf ALIGN(4):
162     {
163         _audiobuffer = .;
164         audiobuffer = .;
165     } > DRAM
167 #ifdef CODECSIZE
168     .audiobufend ENDAUDIOADDR:
169 #else
170     .audiobufend ENDADDR:
171 #endif
172     {
173         _audiobufend = .;
174         audiobufend = .;
175     } > DRAM
177 #ifdef CODECSIZE
178     .codec ENDAUDIOADDR:
179     {
180         codecbuf = .;
181         _codecbuf = .;
182     }
183 #endif
184     
185     .plugin ENDADDR:
186     {
187         _pluginbuf = .;
188         pluginbuf = .;
189     }