Fix the pitch detector plugin for iaudioM3
[kugel-rb.git] / apps / plugins / plugin.lds
blobf93d5d4425c4f5b25b40b7b99d8135b21f21bdab
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
69 #include "cpu.h"
70 #define DRAMORIG DRAM_ORIG
71 #ifdef AMS_LOWMEM
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 0x10010000
96 #define IRAMSIZE 0x10000
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
134 #ifdef AMS_LOWMEM
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 == JZ4732
144 #define DRAMORIG 0x80004000 + STUBOFFSET
145 #define IRAM DRAM
146 /* The bit of IRAM that is available is used in the core */
147 #else
148 #define DRAMORIG 0x09000000 + STUBOFFSET
149 #endif
151 #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
154 #ifndef CODEC_ORIGIN /* targets can specify another origin */
155 #define CODEC_ORIGIN (DRAMORIG + (DRAMSIZE))
156 #endif
158 #ifndef PLUGIN_ORIGIN /* targets can specify another origin */
159 #define PLUGIN_ORIGIN (CODEC_ORIGIN + CODEC_SIZE)
160 #endif
162 #ifdef CODEC
163 #define THIS_LENGTH CODEC_SIZE
164 #define THIS_ORIGIN CODEC_ORIGIN
165 #elif defined OVERLAY_OFFSET
166 #define THIS_LENGTH (DRAMSIZE - OVERLAY_OFFSET)
167 #define THIS_ORIGIN (DRAMORIG + OVERLAY_OFFSET)
168 #else /* plugin */
169 #define THIS_LENGTH PLUGIN_LENGTH
170 #define THIS_ORIGIN PLUGIN_ORIGIN
171 #endif
173 MEMORY
175    PLUGIN_RAM : ORIGIN = THIS_ORIGIN, LENGTH = THIS_LENGTH
176 #if defined(IRAMSIZE) && IRAMSIZE != 0
177    PLUGIN_IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
178 #endif
181 SECTIONS
183     .header : {
184         _plugin_start_addr = .;
185         plugin_start_addr = .;
186         KEEP(*(.header))
187     } > PLUGIN_RAM
189     .text :
190     {
191         *(.text*)
192 #if defined(IRAMSIZE) && IRAMSIZE == 0
193                 *(.icode)
194 #endif
195 #ifdef CPU_ARM
196         *(.glue_7)
197         *(.glue_7t)
198 #endif
199     } > PLUGIN_RAM
201     .rodata :
202     {
203         *(.rodata*)
204 #if defined(IRAMSIZE) && IRAMSIZE == 0
205                 *(.irodata)
206 #endif
207         . = ALIGN(0x4);
208     } > PLUGIN_RAM
210     .data :
211     {
212         *(.data*)
213 #if defined(IRAMSIZE) && IRAMSIZE == 0
214                 *(.idata)
215 #endif
216     } > PLUGIN_RAM
218 #if NOCACHE_BASE != 0
219     .ncdata . + NOCACHE_BASE :
220     {
221         . = ALIGN(CACHEALIGN_SIZE);
222         *(.ncdata*)
223         . = ALIGN(CACHEALIGN_SIZE);
224     } AT> PLUGIN_RAM
225 #endif
227 #if defined(IRAMSIZE)
228     iramcopy = . - NOCACHE_BASE;
229 #endif
231     /DISCARD/ :
232     {
233         *(.eh_frame)
234 #ifdef CPU_MIPS
235         *(.rel.dyn)
236 #endif
237     }
239 #if defined(IRAMSIZE) && IRAMSIZE != 0
240     .iram IRAMORIG : AT ( iramcopy)
241     {
242         iramstart = .;
243         *(.icode)
244         *(.irodata)
245         *(.idata)
246         iramend = .;
247     } > PLUGIN_IRAM
250     .ibss (NOLOAD) :
251     {
252         iedata = .;
253         *(.ibss)
254         . = ALIGN(0x4);
255         iend = .;
256     } > PLUGIN_IRAM
257 #endif
259     .bss (NOLOAD) :
260     {
261         plugin_bss_start = .;
262         *(.bss*)
263 #if defined(IRAMSIZE) && IRAMSIZE == 0
264                 *(.ibss)
265 #endif
266         *(COMMON)
267         . = ALIGN(0x4);
268     } > PLUGIN_RAM
269     
270 #if NOCACHE_BASE != 0
271     .ncbss . + NOCACHE_BASE (NOLOAD) :
272     {
273         . = ALIGN(CACHEALIGN_SIZE);
274         *(.ncbss*)
275         . = ALIGN(CACHEALIGN_SIZE);
276     } AT> PLUGIN_RAM
277 #endif
279     /* Restore . */
280     .pluginend . - NOCACHE_BASE :
281     {
282         _plugin_end_addr = .;
283         plugin_end_addr = .;
284     }
286     /* Special trick to avoid a linker error when no other sections are
287        left after garbage collection (plugin not for this platform) */
288     .comment 0 :
289     {
290         KEEP(*(.comment))
291     }