Add headers to dummy *-target.h files
[kugel-rb.git] / apps / plugins / plugin.lds
blobf150b9d168bfe65ee8fa3802506876de46474fed
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 #endif
76  /* default to full RAM (minus codecs&plugins) unless specified otherwise */
77 #ifndef DRAMSIZE
78 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
79 #endif
81 /* MCF5249 have 96KB of IRAM */
82 #if CONFIG_CPU == MCF5249
83 #define DRAMORIG 0x31000000
84 #define IRAMORIG 0x1000c000
85 #define IRAMSIZE 0xc000
87 /* MCF5250 have 128KB of IRAM */
88 #elif CONFIG_CPU == MCF5250
89 #define DRAMORIG 0x31000000
90 #define IRAMORIG 0x1000c000
91 #define IRAMSIZE 0x14000
93 #elif CONFIG_CPU == PP5022 || CONFIG_CPU == PP5024
94 /* PP5022/24 have 128KB of IRAM */
95 #define DRAMORIG 0x00000000
96 #define IRAMORIG 0x4000c000
97 #define IRAMSIZE 0x14000
99 #elif defined(CPU_PP)
100 /* all other PP's have 96KB of IRAM */
101 #define DRAMORIG 0x00000000
102 #define IRAMORIG 0x4000c000
103 #define IRAMSIZE 0x0c000
105 #elif CONFIG_CPU == PNX0101
106 #define DRAMORIG 0xc00000 + STUBOFFSET
107 #define IRAMORIG 0x407000
108 #define IRAMSIZE 0x9000
110 #elif CONFIG_CPU == IMX31L || CONFIG_CPU == S3C2440
111 #define DRAMORIG 0x0 + STUBOFFSET
112 #define IRAM DRAM
113 #define IRAMSIZE 0
115 #elif CONFIG_CPU==DM320
116 #define DRAMORIG 0x00900000 + STUBOFFSET
117 #define IRAM DRAM
118 /* The bit of IRAM that is available is used in the core */
119 #define IRAMSIZE 0
121 #elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
122 #define DRAMORIG 0x20000000
123 #if CONFIG_CPU==TCC7801
124 #define IRAMORIG 0x1000c000
125 #define IRAMSIZE 0xc000
126 #else
127 #define IRAM DRAM
128 #define IRAMSIZE 0
129 #endif
131 #elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2
132 #if defined(AMS_LOWMEM) || (CONFIG_CPU == AS3525v2)
133 #define IRAMSIZE 0  /* simulates no IRAM since codec is already entirely in IRAM */
134 #define CODEC_ORIGIN (IRAM_ORIG + IRAM_SIZE - CODEC_SIZE)
135 #define PLUGIN_ORIGIN (DRAM_ORIG + DRAMSIZE)
136 #else
137 #define IRAMORIG (IRAM_ORIG + 0x20000)
138 #define IRAMSIZE (IRAM_ORIG + IRAM_SIZE - IRAMORIG)
139 #endif
141 #elif CONFIG_CPU==S5L8700
142 #define DRAMORIG 0x08000000
143 #define IRAMORIG (0x00000000 + (64*1024))
144 #define IRAMSIZE (64*1024)
146 #elif CONFIG_CPU==S5L8701
147 #define DRAMORIG 0x08000000
148 #define IRAMORIG (0x00000000 + (96*1024))
149 #define IRAMSIZE (80*1024)
151 #elif CONFIG_CPU == JZ4732
152 #define DRAMORIG 0x80004000 + STUBOFFSET
153 #define IRAM DRAM
154 #define IRAMSIZE 0
155 /* The bit of IRAM that is available is used in the core */
156 #else
157 #define DRAMORIG 0x09000000 + STUBOFFSET
158 #endif
160 #ifndef NOCACHE_BASE
161 /* Default to no offset if target doesn't define this */
162 #define NOCACHE_BASE 0x00000000
163 #endif
165 #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
168 #ifndef CODEC_ORIGIN /* targets can specify another origin */
169 #define CODEC_ORIGIN (DRAMORIG + (DRAMSIZE))
170 #endif
172 #ifndef PLUGIN_ORIGIN /* targets can specify another origin */
173 #define PLUGIN_ORIGIN (CODEC_ORIGIN + CODEC_SIZE)
174 #endif
176 #ifdef CODEC
177 #define THIS_LENGTH CODEC_SIZE
178 #define THIS_ORIGIN CODEC_ORIGIN
179 #elif defined OVERLAY_OFFSET
180 #define THIS_LENGTH (DRAMSIZE - OVERLAY_OFFSET)
181 #define THIS_ORIGIN (DRAMORIG + OVERLAY_OFFSET)
182 #else /* plugin */
183 #define THIS_LENGTH PLUGIN_LENGTH
184 #define THIS_ORIGIN PLUGIN_ORIGIN
185 #endif
187 MEMORY
189    PLUGIN_RAM : ORIGIN = THIS_ORIGIN, LENGTH = THIS_LENGTH
190 #if defined(IRAMSIZE) && IRAMSIZE != 0
191    PLUGIN_IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
192 #endif
195 SECTIONS
197     .header : {
198         _plugin_start_addr = .;
199         plugin_start_addr = .;
200         KEEP(*(.header))
201     } > PLUGIN_RAM
203     .text :
204     {
205         *(.text*)
206 #if defined(IRAMSIZE) && IRAMSIZE == 0
207                 *(.icode)
208 #endif
209 #ifdef CPU_ARM
210         *(.glue_7)
211         *(.glue_7t)
212 #endif
213     } > PLUGIN_RAM
215     .rodata :
216     {
217         *(.rodata*)
218 #if defined(IRAMSIZE) && IRAMSIZE == 0
219                 *(.irodata)
220 #endif
221         . = ALIGN(0x4);
222     } > PLUGIN_RAM
224     .data :
225     {
226         *(.data*)
227 #if defined(IRAMSIZE) && IRAMSIZE == 0
228                 *(.idata)
229 #endif
230     } > PLUGIN_RAM
232 #if NOCACHE_BASE != 0
233     .ncdata . + NOCACHE_BASE :
234     {
235         . = ALIGN(CACHEALIGN_SIZE);
236         *(.ncdata*)
237         . = ALIGN(CACHEALIGN_SIZE);
238 /* EABI currently needs iramcopy defined here, otherwise .iram can sometimes
239    have an incorrect load address, breaking codecs. */
240 #if defined(IRAMSIZE)
241         iramcopy = . - NOCACHE_BASE;
242 #endif
243     } AT> PLUGIN_RAM
244 /* This definition is used when NOCACHE_BASE is 0. The address offset bug only
245    seems to occur when the empty .ncdata is present. */
246 #elif defined(IRAMSIZE)
247     iramcopy = .;
248 #endif
250     /DISCARD/ :
251     {
252         *(.eh_frame)
253 #ifdef CPU_MIPS
254         *(.rel.dyn)
255 #endif
256     }
258 #if defined(IRAMSIZE) && IRAMSIZE != 0
259     .iram IRAMORIG : AT ( iramcopy)
260     {
261         iramstart = .;
262         *(.icode)
263         *(.irodata)
264         *(.idata)
265         iramend = .;
266     } > PLUGIN_IRAM
269     .ibss (NOLOAD) :
270     {
271         iedata = .;
272         *(.ibss)
273         . = ALIGN(0x4);
274         iend = .;
275     } > PLUGIN_IRAM
276 #endif
278     .bss (NOLOAD) :
279     {
280         plugin_bss_start = .;
281         *(.bss*)
282 #if defined(IRAMSIZE) && IRAMSIZE == 0
283                 *(.ibss)
284 #endif
285         *(COMMON)
286         . = ALIGN(0x4);
287     } > PLUGIN_RAM
288     
289 #if NOCACHE_BASE != 0
290     .ncbss . + NOCACHE_BASE (NOLOAD) :
291     {
292         . = ALIGN(CACHEALIGN_SIZE);
293         *(.ncbss*)
294         . = ALIGN(CACHEALIGN_SIZE);
295     } AT> PLUGIN_RAM
296 #endif
298     /* Restore . */
299     .pluginend . - NOCACHE_BASE :
300     {
301         _plugin_end_addr = .;
302         plugin_end_addr = .;
303     }
305     /* Special trick to avoid a linker error when no other sections are
306        left after garbage collection (plugin not for this platform) */
307     .comment 0 :
308     {
309         KEEP(*(.comment))
310     }