as3525v2: Move codec into iram freeing 1MB for the audio buffer and also a small...
[kugel-rb.git] / apps / plugins / plugin.lds
blob3a88867fa14d51c75dfedf8fcc02511aa4c7d2b6
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 #ifndef NOCACHE_BASE
34 /* Default to no offset if target doesn't define this */
35 #define NOCACHE_BASE 0x00000000
36 #endif
38 #if CONFIG_CPU==DM320 || CONFIG_CPU==IMX31L
39 /* Give this 1 meg to allow it to align to the MMU boundary */
40 #if CONFIG_CPU==DM320
41 #ifndef LCD_NATIVE_WIDTH
42 #define LCD_NATIVE_WIDTH LCD_WIDTH
43 #endif
45 #ifndef LCD_NATIVE_HEIGHT
46 #define LCD_NATIVE_HEIGHT LCD_HEIGHT
47 #endif
49 #define LCD_FUDGE       LCD_NATIVE_WIDTH%32
50 #define LCD_BUFFER_SIZE  ((LCD_NATIVE_WIDTH+LCD_FUDGE)*LCD_NATIVE_HEIGHT*2)
51 #define LCD_TTB_AREA    0x100000*((LCD_BUFFER_SIZE>>19)+1)
52 #else
53 #define LCD_TTB_AREA    0x100000
54 #endif
56 #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA
58 #elif CONFIG_CPU==S3C2440
59 #include "cpu.h"
60 /* must be 16Kb (0x4000) aligned */
61 #define TTB_SIZE         (0x4000) 
62 #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE
64 #elif CONFIG_CPU==TCC7801
65 #include "cpu.h"
66 #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - TTB_SIZE
68 #elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2
69 #include "cpu.h"
70 #define DRAMORIG DRAM_ORIG
71 #if defined(AMS_LOWMEM) || (CONFIG_CPU == AS3525v2)
72 #define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - STUBOFFSET - TTB_SIZE)
73 #else
74 #define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE - TTB_SIZE)
75 #endif
76 #endif
78  /* default to full RAM (minus codecs&plugins) unless specified otherwise */
79 #ifndef DRAMSIZE
80 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
81 #endif
84 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300)
85 #define ARCH_IRIVER
86 #endif
88 #if defined(ARCH_IRIVER) || defined(IAUDIO_M3)
89 #define DRAMORIG 0x31000000
90 #define IRAMORIG 0x1000c000
91 #define IRAMSIZE 0xc000
93 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
94 #define DRAMORIG 0x31000000
95 #define IRAMORIG 0x1000c000
96 #define IRAMSIZE 0x14000
98 #elif CONFIG_CPU == PP5022 || CONFIG_CPU == PP5024
99 /* PP5022/24 have 128KB of IRAM */
100 #define DRAMORIG 0x00000000
101 #define IRAMORIG 0x4000c000
102 #define IRAMSIZE 0x14000
104 #elif defined(CPU_PP)
105 /* all other PP's have 96KB of IRAM */
106 #define DRAMORIG 0x00000000
107 #define IRAMORIG 0x4000c000
108 #define IRAMSIZE 0x0c000
110 #elif CONFIG_CPU == PNX0101
111 #define DRAMORIG 0xc00000 + STUBOFFSET
112 #define IRAMORIG 0x407000
113 #define IRAMSIZE 0x9000
115 #elif CONFIG_CPU == IMX31L || CONFIG_CPU == S3C2440
116 #define DRAMORIG 0x0 + STUBOFFSET
117 #define IRAM DRAM
118 #define IRAMSIZE 0
120 #elif CONFIG_CPU==DM320
121 #define DRAMORIG 0x00900000 + STUBOFFSET
122 #define IRAM DRAM
123 /* The bit of IRAM that is available is used in the core */
124 #define IRAMSIZE 0
126 #elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
127 #define DRAMORIG 0x20000000
128 /*#define IRAMORIG 0x1000c000
129 #define IRAMSIZE 0xc000*/
130 #define IRAM DRAM
131 #define IRAMSIZE 0
133 #elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2
134 #if defined(AMS_LOWMEM) || (CONFIG_CPU == AS3525v2)
135 #define IRAMSIZE 0  /* simulates no IRAM since codec is already entirely in IRAM */
136 #define CODEC_ORIGIN (IRAM_ORIG + IRAM_SIZE - CODEC_SIZE)
137 #define PLUGIN_ORIGIN (DRAM_ORIG + DRAMSIZE)
138 #else
139 #define IRAMORIG (IRAM_ORIG + 0x20000)
140 #define IRAMSIZE (IRAM_ORIG + IRAM_SIZE - IRAMORIG)
141 #endif
143 #elif CONFIG_CPU==S5L8700
144 #define DRAMORIG 0x08000000
145 #define IRAMORIG (0x00000000 + (64*1024))
146 #define IRAMSIZE (64*1024)
148 #elif CONFIG_CPU==S5L8701
149 #define DRAMORIG 0x08000000
150 #define IRAMORIG (0x00000000 + (96*1024))
151 #define IRAMSIZE (80*1024)
153 #elif CONFIG_CPU == JZ4732
154 #define DRAMORIG 0x80004000 + STUBOFFSET
155 #define IRAM DRAM
156 #define IRAMSIZE 0
157 /* The bit of IRAM that is available is used in the core */
158 #else
159 #define DRAMORIG 0x09000000 + STUBOFFSET
160 #endif
162 #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
165 #ifndef CODEC_ORIGIN /* targets can specify another origin */
166 #define CODEC_ORIGIN (DRAMORIG + (DRAMSIZE))
167 #endif
169 #ifndef PLUGIN_ORIGIN /* targets can specify another origin */
170 #define PLUGIN_ORIGIN (CODEC_ORIGIN + CODEC_SIZE)
171 #endif
173 #ifdef CODEC
174 #define THIS_LENGTH CODEC_SIZE
175 #define THIS_ORIGIN CODEC_ORIGIN
176 #elif defined OVERLAY_OFFSET
177 #define THIS_LENGTH (DRAMSIZE - OVERLAY_OFFSET)
178 #define THIS_ORIGIN (DRAMORIG + OVERLAY_OFFSET)
179 #else /* plugin */
180 #define THIS_LENGTH PLUGIN_LENGTH
181 #define THIS_ORIGIN PLUGIN_ORIGIN
182 #endif
184 MEMORY
186    PLUGIN_RAM : ORIGIN = THIS_ORIGIN, LENGTH = THIS_LENGTH
187 #if defined(IRAMSIZE) && IRAMSIZE != 0
188    PLUGIN_IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
189 #endif
192 SECTIONS
194     .header : {
195         _plugin_start_addr = .;
196         plugin_start_addr = .;
197         KEEP(*(.header))
198     } > PLUGIN_RAM
200     .text :
201     {
202         *(.text*)
203 #if defined(IRAMSIZE) && IRAMSIZE == 0
204                 *(.icode)
205 #endif
206 #ifdef CPU_ARM
207         *(.glue_7)
208         *(.glue_7t)
209 #endif
210     } > PLUGIN_RAM
212     .rodata :
213     {
214         *(.rodata*)
215 #if defined(IRAMSIZE) && IRAMSIZE == 0
216                 *(.irodata)
217 #endif
218         . = ALIGN(0x4);
219     } > PLUGIN_RAM
221     .data :
222     {
223         *(.data*)
224 #if defined(IRAMSIZE) && IRAMSIZE == 0
225                 *(.idata)
226 #endif
227     } > PLUGIN_RAM
229 #if NOCACHE_BASE != 0
230     .ncdata . + NOCACHE_BASE :
231     {
232         . = ALIGN(CACHEALIGN_SIZE);
233         *(.ncdata*)
234         . = ALIGN(CACHEALIGN_SIZE);
235 /* EABI currently needs iramcopy defined here, otherwise .iram can sometimes
236    have an incorrect load address, breaking codecs. */
237 #if defined(IRAMSIZE)
238         iramcopy = . - NOCACHE_BASE;
239 #endif
240     } AT> PLUGIN_RAM
241 /* This definition is used when NOCACHE_BASE is 0. The address offset bug only
242    seems to occur when the empty .ncdata is present. */
243 #elif defined(IRAMSIZE)
244     iramcopy = .;
245 #endif
247     /DISCARD/ :
248     {
249         *(.eh_frame)
250 #ifdef CPU_MIPS
251         *(.rel.dyn)
252 #endif
253     }
255 #if defined(IRAMSIZE) && IRAMSIZE != 0
256     .iram IRAMORIG : AT ( iramcopy)
257     {
258         iramstart = .;
259         *(.icode)
260         *(.irodata)
261         *(.idata)
262         iramend = .;
263     } > PLUGIN_IRAM
266     .ibss (NOLOAD) :
267     {
268         iedata = .;
269         *(.ibss)
270         . = ALIGN(0x4);
271         iend = .;
272     } > PLUGIN_IRAM
273 #endif
275     .bss (NOLOAD) :
276     {
277         plugin_bss_start = .;
278         *(.bss*)
279 #if defined(IRAMSIZE) && IRAMSIZE == 0
280                 *(.ibss)
281 #endif
282         *(COMMON)
283         . = ALIGN(0x4);
284     } > PLUGIN_RAM
285     
286 #if NOCACHE_BASE != 0
287     .ncbss . + NOCACHE_BASE (NOLOAD) :
288     {
289         . = ALIGN(CACHEALIGN_SIZE);
290         *(.ncbss*)
291         . = ALIGN(CACHEALIGN_SIZE);
292     } AT> PLUGIN_RAM
293 #endif
295     /* Restore . */
296     .pluginend . - NOCACHE_BASE :
297     {
298         _plugin_end_addr = .;
299         plugin_end_addr = .;
300     }
302     /* Special trick to avoid a linker error when no other sections are
303        left after garbage collection (plugin not for this platform) */
304     .comment 0 :
305     {
306         KEEP(*(.comment))
307     }