Fix remaining reds.
[kugel-rb.git] / apps / plugins / plugin.lds
blobefd60159d1b8d4424fddff6c9aa4cbcde65e2fc2
1 #include "config.h"
3 /* These output formats should be in the config-files */
5 #ifdef CPU_COLDFIRE
6 OUTPUT_FORMAT(elf32-m68k)
7 #elif defined(CPU_ARM)
8 OUTPUT_FORMAT(elf32-littlearm)
9 #elif defined(CPU_SH)
10 OUTPUT_FORMAT(elf32-sh)
11 #elif defined(CPU_MIPS)
12 OUTPUT_FORMAT(elf32-littlemips)
13 #else
14 /* We can have an #error here we don't use this file when build sims! */
15 #error Unknown CPU architecture
16 #endif
18 #ifdef DEBUG
19 #define STUBOFFSET 0x10000
20 #else
21 #define STUBOFFSET 0
22 #endif
24 #if defined(CPU_PP)
25 #ifdef CPU_PP502x
26 #define NOCACHE_BASE    0x10000000
27 #else
28 #define NOCACHE_BASE    0x28000000
29 #endif /* CPU_* */
30 #define CACHEALIGN_SIZE 16
31 #endif /* CPU_PP */
33 #if CONFIG_CPU==IMX31L
34 /* No fudges! */
35 #include "imx31l.h"
36 #define DRAMSIZE ((MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE \
37                   - CODEC_SIZE - QHARRAY_SIZE - FRAME_SIZE - TTB_SIZE)
39 #elif CONFIG_CPU==DM320
41 /* Give this 1 meg to allow it to align to the MMU boundary */
42 #ifndef LCD_NATIVE_WIDTH
43 #define LCD_NATIVE_WIDTH LCD_WIDTH
44 #endif
46 #ifndef LCD_NATIVE_HEIGHT
47 #define LCD_NATIVE_HEIGHT LCD_HEIGHT
48 #endif
50 #define LCD_FUDGE       LCD_NATIVE_WIDTH%32
51 #define LCD_BUFFER_SIZE  ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2)
52 #define LCD_TTB_AREA    0x100000*((LCD_BUFFER_SIZE>>19)+1)
54 #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA
56 #elif CONFIG_CPU==S3C2440
57 #include "cpu.h"
58 /* must be 16Kb (0x4000) aligned */
59 #define TTB_SIZE         (0x4000) 
60 #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE
62 #elif CONFIG_CPU==TCC7801
63 #include "cpu.h"
64 #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE
66 #elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2
67 #include "cpu.h"
68 #define DRAMORIG DRAM_ORIG
69 #if defined(AMS_LOWMEM) || (CONFIG_CPU == AS3525v2)
70 #define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - STUBOFFSET - TTB_SIZE)
71 #else
72 #define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE - TTB_SIZE)
73 #endif
74 #elif CONFIG_CPU==S5L8702
75 #define ASM
76 #include "cpu.h"
77 #define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE)
78 #endif
80  /* default to full RAM (minus codecs&plugins) unless specified otherwise */
81 #ifndef DRAMSIZE
82 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
83 #endif
85 /* MCF5249 have 96KB of IRAM */
86 #if CONFIG_CPU == MCF5249
87 #define DRAMORIG 0x31000000
88 #define IRAMORIG 0x1000c000
89 #define IRAMSIZE 0xc000
91 /* MCF5250 have 128KB of IRAM */
92 #elif CONFIG_CPU == MCF5250
93 #define DRAMORIG 0x31000000
94 #define IRAMORIG 0x1000c000
95 #define IRAMSIZE 0x14000
97 #elif CONFIG_CPU == PP5022 || CONFIG_CPU == PP5024
98 /* PP5022/24 have 128KB of IRAM */
99 #define DRAMORIG 0x00000000
100 #define IRAMORIG 0x4000c000
101 #define IRAMSIZE 0x14000
103 #elif defined(CPU_PP)
104 /* all other PP's have 96KB of IRAM */
105 #define DRAMORIG 0x00000000
106 #define IRAMORIG 0x4000c000
107 #define IRAMSIZE 0x0c000
109 #elif CONFIG_CPU == PNX0101
110 #define DRAMORIG 0xc00000 + STUBOFFSET
111 #define IRAMORIG 0x407000
112 #define IRAMSIZE 0x9000
114 #elif CONFIG_CPU == IMX31L || CONFIG_CPU == S3C2440
115 #define DRAMORIG 0x0 + STUBOFFSET
116 #define IRAM DRAM
117 #define IRAMSIZE 0
119 #elif CONFIG_CPU==DM320
120 #define DRAMORIG 0x00900000 + STUBOFFSET
121 #define IRAM DRAM
122 /* The bit of IRAM that is available is used in the core */
123 #define IRAMSIZE 0
125 #elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
126 #define DRAMORIG 0x20000000
127 #if CONFIG_CPU==TCC7801
128 #define IRAMORIG 0x1000c000
129 #define IRAMSIZE 0xc000
130 #else
131 #define IRAM DRAM
132 #define IRAMSIZE 0
133 #endif
135 #elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2
136 #if defined(AMS_LOWMEM) || (CONFIG_CPU == AS3525v2)
137 #define IRAMSIZE 0  /* simulates no IRAM since codec is already entirely in IRAM */
138 #define CODEC_ORIGIN (IRAM_ORIG + IRAM_SIZE - CODEC_SIZE)
139 #define PLUGIN_ORIGIN (DRAM_ORIG + DRAMSIZE)
140 #else
141 #define IRAMORIG (IRAM_ORIG + 0x20000)
142 #define IRAMSIZE (IRAM_ORIG + IRAM_SIZE - IRAMORIG)
143 #endif
145 #elif CONFIG_CPU==S5L8700
146 /* S5L8700 have 256KB of IRAM */
147 #define DRAMORIG 0x08000000
148 #define IRAMORIG (0x00000000 + (48*1024))
149 #define IRAMSIZE (208*1024)
151 #elif CONFIG_CPU==S5L8701
152 /* S5L8701 have 176KB of IRAM */
153 #define DRAMORIG 0x08000000
154 #define IRAMORIG (0x00000000 + (48*1024))
155 #define IRAMSIZE (128*1024)
157 #elif CONFIG_CPU==S5L8702
158 /* S5L8702 have 256KB of IRAM */
159 #define DRAMORIG 0x08000000
160 #define IRAMORIG (0x00000000 + (56*1024))
161 #define IRAMSIZE (200*1024)
163 #elif CONFIG_CPU == JZ4732
164 #define DRAMORIG 0x80004000 + STUBOFFSET
165 #define IRAM DRAM
166 #define IRAMSIZE 0
167 /* The bit of IRAM that is available is used in the core */
168 #else
169 #define DRAMORIG 0x09000000 + STUBOFFSET
170 #endif
172 #ifndef NOCACHE_BASE
173 /* Default to no offset if target doesn't define this */
174 #define NOCACHE_BASE 0x00000000
175 #endif
177 #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
180 #ifndef CODEC_ORIGIN /* targets can specify another origin */
181 #define CODEC_ORIGIN (DRAMORIG + (DRAMSIZE))
182 #endif
184 #ifndef PLUGIN_ORIGIN /* targets can specify another origin */
185 #define PLUGIN_ORIGIN (CODEC_ORIGIN + CODEC_SIZE)
186 #endif
188 #ifdef CODEC
189 #define THIS_LENGTH CODEC_SIZE
190 #define THIS_ORIGIN CODEC_ORIGIN
191 #elif defined OVERLAY_OFFSET
192 #define THIS_LENGTH (DRAMSIZE - OVERLAY_OFFSET)
193 #define THIS_ORIGIN (DRAMORIG + OVERLAY_OFFSET)
194 #elif defined IMGVDECODER_OFFSET
195 #define THIS_LENGTH (PLUGIN_LENGTH - IMGVDECODER_OFFSET)
196 #define THIS_ORIGIN (PLUGIN_ORIGIN + IMGVDECODER_OFFSET)
197 #else /* plugin */
198 #define THIS_LENGTH PLUGIN_LENGTH
199 #define THIS_ORIGIN PLUGIN_ORIGIN
200 #endif
202 MEMORY
204    PLUGIN_RAM : ORIGIN = THIS_ORIGIN, LENGTH = THIS_LENGTH
205 #if defined(IRAMSIZE) && IRAMSIZE != 0
206    PLUGIN_IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
207 #endif
210 SECTIONS
212     .header : {
213         _plugin_start_addr = .;
214         plugin_start_addr = .;
215         KEEP(*(.header))
216     } > PLUGIN_RAM
218     .text :
219     {
220         *(.text*)
221 #if defined(IRAMSIZE) && IRAMSIZE == 0
222                 *(.icode)
223 #endif
224 #ifdef CPU_ARM
225         *(.glue_7)
226         *(.glue_7t)
227 #endif
228     } > PLUGIN_RAM
230     .rodata :
231     {
232         *(.rodata*)
233 #if defined(IRAMSIZE) && IRAMSIZE == 0
234                 *(.irodata)
235 #endif
236         . = ALIGN(0x4);
237     } > PLUGIN_RAM
239     .data :
240     {
241         *(.data*)
242 #if defined(IRAMSIZE) && IRAMSIZE == 0
243                 *(.idata)
244 #endif
245     } > PLUGIN_RAM
247 #if NOCACHE_BASE != 0
248     .ncdata . + NOCACHE_BASE :
249     {
250         . = ALIGN(CACHEALIGN_SIZE);
251         *(.ncdata*)
252         . = ALIGN(CACHEALIGN_SIZE);
253 /* EABI currently needs iramcopy defined here, otherwise .iram can sometimes
254    have an incorrect load address, breaking codecs. */
255 #if defined(IRAMSIZE)
256         iramcopy = . - NOCACHE_BASE;
257 #endif
258     } AT> PLUGIN_RAM
259 /* This definition is used when NOCACHE_BASE is 0. The address offset bug only
260    seems to occur when the empty .ncdata is present. */
261 #elif defined(IRAMSIZE)
262     iramcopy = .;
263 #endif
265     /DISCARD/ :
266     {
267         *(.eh_frame)
268 #ifdef CPU_MIPS
269         *(.rel.dyn)
270 #endif
271     }
273 #if defined(IRAMSIZE) && IRAMSIZE != 0
274     .iram IRAMORIG : AT ( iramcopy)
275     {
276         iramstart = .;
277         *(.icode)
278         *(.irodata)
279         *(.idata)
280         iramend = .;
281     } > PLUGIN_IRAM
284     .ibss (NOLOAD) :
285     {
286         iedata = .;
287         *(.ibss)
288         . = ALIGN(0x4);
289         iend = .;
290     } > PLUGIN_IRAM
291 #endif
293     .bss (NOLOAD) :
294     {
295         plugin_bss_start = .;
296         _plugin_bss_start = .;
297         *(.bss*)
298 #if defined(IRAMSIZE) && IRAMSIZE == 0
299                 *(.ibss)
300 #endif
301         *(COMMON)
302         . = ALIGN(0x4);
303     } > PLUGIN_RAM
304     
305 #if NOCACHE_BASE != 0
306     .ncbss . + NOCACHE_BASE (NOLOAD) :
307     {
308         . = ALIGN(CACHEALIGN_SIZE);
309         *(.ncbss*)
310         . = ALIGN(CACHEALIGN_SIZE);
311     } AT> PLUGIN_RAM
312 #endif
314     /* Restore . */
315     .pluginend . - NOCACHE_BASE :
316     {
317         _plugin_end_addr = .;
318         plugin_end_addr = .;
319     }
321     /* Special trick to avoid a linker error when no other sections are
322        left after garbage collection (plugin not for this platform) */
323     .comment 0 :
324     {
325         KEEP(*(.comment))
326     }