New makefile solution: A single invocation of 'make' to build the entire tree. Fully...
[kugel-rb.git] / apps / plugins / plugin.lds
blob52ec93833a92784802d39aa0ac9f2cf3b18c679b
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 #else
10 OUTPUT_FORMAT(elf32-sh)
11 #endif
13 #ifdef DEBUG
14 #define STUBOFFSET 0x10000
15 #else
16 #define STUBOFFSET 0
17 #endif
19 #if defined(CPU_PP)
20 #ifdef CPU_PP502x
21 #define NOCACHE_BASE    0x10000000
22 #else
23 #define NOCACHE_BASE    0x28000000
24 #endif /* CPU_* */
25 #define CACHEALIGN_SIZE 16
26 #endif /* CPU_PP */
28 #ifndef NOCACHE_BASE
29 /* Default to no offset if target doesn't define this */
30 #define NOCACHE_BASE 0x00000000
31 #endif
33 #if CONFIG_CPU==DM320 || CONFIG_CPU==S3C2440
34 #include "cpu.h"
35 #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE
36 #elif CONFIG_CPU==IMX31L
37 #include "imx31l.h"
38 /* Reserve 1mb for LCD buffer/TTB as in app.lds */
39 #define DRAMSIZE (MEMORYSIZE * 0x100000 - 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
40 #else
41 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
42 #endif
44 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300)
45 #define ARCH_IRIVER
46 #endif
48 #if defined(ARCH_IRIVER) || defined(IAUDIO_M3)
49 #define DRAMORIG 0x31000000
50 #define IRAMORIG 0x1000c000
51 #define IRAMSIZE 0xc000
52 #elif defined(IAUDIO_X5) || defined(IAUDIO_M5)
53 #define DRAMORIG 0x31000000
54 #define IRAMORIG 0x10010000
55 #define IRAMSIZE 0x10000
56 #elif CONFIG_CPU == PP5022 || CONFIG_CPU == PP5024
57 /* PP5022/24 have 128KB of IRAM */
58 #define DRAMORIG 0x00000000
59 #define IRAMORIG 0x4000c000
60 #define IRAMSIZE 0x14000
61 #elif defined(CPU_PP)
62 /* all other PP's have 96KB of IRAM */
63 #define DRAMORIG 0x00000000
64 #define IRAMORIG 0x4000c000
65 #define IRAMSIZE 0x0c000
66 #elif CONFIG_CPU == PNX0101
67 #define DRAMORIG 0xc00000 + STUBOFFSET
68 #define IRAMORIG 0x407000
69 #define IRAMSIZE 0x9000
70 #elif CONFIG_CPU == S3C2440
71 #define DRAMORIG 0x0 + STUBOFFSET
72 #define IRAM DRAM
73 #define IRAMSIZE 0
74 #elif CONFIG_CPU == IMX31L
75 #define DRAMORIG 0x0 + STUBOFFSET
76 #define IRAM DRAM
77 #define IRAMSIZE 0
78 #elif CONFIG_CPU==DM320
79 #define DRAMORIG 0x00900000 + STUBOFFSET
80 #define IRAMORIG DRAMORIG
81 #define IRAMSIZE 0x4000
82 #define IRAM DRAM
83 #elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
84 #define DRAMORIG 0x20000000
85 /*#define IRAMORIG 0x1000c000
86 #define IRAMSIZE 0xc000*/
87 #define IRAM DRAM
88 #define IRAMSIZE 0
89 #elif CONFIG_CPU==AS3525
90 #define IRAMORIG 0x0
91 #define IRAMSIZE 0x50000
92 #define DRAMORIG 0x30000000
93 #else
94 #define DRAMORIG 0x09000000 + STUBOFFSET
95 #endif
97 #define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
99 #define CODEC_ORIGIN (DRAMORIG + (DRAMSIZE))
100 #define PLUGIN_ORIGIN (CODEC_ORIGIN + CODEC_SIZE)
102 #ifdef CODEC
103 #define THIS_LENGTH CODEC_SIZE
104 #define THIS_ORIGIN CODEC_ORIGIN
105 #else
106 #define THIS_LENGTH PLUGIN_LENGTH
107 #define THIS_ORIGIN PLUGIN_ORIGIN
108 #endif
110 MEMORY
112    PLUGIN_RAM : ORIGIN = THIS_ORIGIN, LENGTH = THIS_LENGTH
113 #if defined(IRAMSIZE) && IRAMSIZE != 0
114    PLUGIN_IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
115 #endif
118 SECTIONS
120     .header : {
121         _plugin_start_addr = .;
122         plugin_start_addr = .;
123         KEEP(*(.header))
124     } > PLUGIN_RAM
126     .text :
127     {
128         *(.text*)
129 #if defined(IRAMSIZE) && IRAMSIZE == 0
130         *(.icode)
131 #endif
132 #ifdef CPU_ARM
133         *(.glue_7)
134         *(.glue_7t)
135 #endif
136     } > PLUGIN_RAM
138     .rodata :
139     {
140         *(.rodata*)
141 #if defined(IRAMSIZE) && IRAMSIZE == 0
142         *(.irodata)
143 #endif
144         . = ALIGN(0x4);
145     } > PLUGIN_RAM
147     .data :
148     {
149         *(.data*)
150 #if defined(IRAMSIZE) && IRAMSIZE == 0
151         *(.idata)
152 #endif
153     } > PLUGIN_RAM
155 #if NOCACHE_BASE != 0
156     .ncdata . + NOCACHE_BASE :
157     {
158         . = ALIGN(CACHEALIGN_SIZE);
159         *(.ncdata*)
160         . = ALIGN(CACHEALIGN_SIZE);
161     } AT> PLUGIN_RAM
162 #endif
164 #if defined(IRAMSIZE)
165     iramcopy = . - NOCACHE_BASE;
166 #endif
168     /DISCARD/ :
169     {
170         *(.eh_frame)
171     }
173 #if defined(IRAMSIZE) && IRAMSIZE != 0
174     .iram IRAMORIG : AT ( iramcopy)
175     {
176         iramstart = .;
177         *(.icode)
178         *(.irodata)
179         *(.idata)
180         iramend = .;
181     } > PLUGIN_IRAM
184     .ibss (NOLOAD) :
185     {
186         iedata = .;
187         *(.ibss)
188         . = ALIGN(0x4);
189         iend = .;
190     } > PLUGIN_IRAM
191 #endif
193     .bss (NOLOAD) :
194     {
195         plugin_bss_start = .;
196         *(.bss*)
197 #if defined(IRAMSIZE) && IRAMSIZE == 0
198         *(.ibss)
199 #endif
200         *(COMMON)
201         . = ALIGN(0x4);
202     } > PLUGIN_RAM
203     
204 #if NOCACHE_BASE != 0
205     .ncbss . + NOCACHE_BASE (NOLOAD) :
206     {
207         . = ALIGN(CACHEALIGN_SIZE);
208         *(.ncbss*)
209         . = ALIGN(CACHEALIGN_SIZE);
210     } AT> PLUGIN_RAM
211 #endif
213     /* Restore . */
214     .pluginend . - NOCACHE_BASE :
215     {
216         _plugin_end_addr = .;
217         plugin_end_addr = .;
218     }
220     /* Special trick to avoid a linker error when no other sections are
221        left after garbage collection (plugin not for this platform) */
222     .comment 0 :
223     {
224         KEEP(*(.comment))
225     }