revert unrelated app.lds change
[kugel-rb.git] / firmware / target / arm / sandisk / app.lds
blobec26fdbe3843eb1a1b553b12dabe445f426b687b
1 #include "config.h"
3 ENTRY(start)
5 OUTPUT_FORMAT(elf32-littlearm)
6 OUTPUT_ARCH(arm)
7 STARTUP(target/arm/crt0-pp.o)
9 #define PLUGINSIZE PLUGIN_BUFFER_SIZE
10 #define CODECSIZE CODEC_SIZE
12 #ifdef DEBUG
13 #define STUBOFFSET 0x10000
14 #else
15 #define STUBOFFSET 0
16 #endif
18 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
20 #define DRAMORIG 0x00000000 + STUBOFFSET
21 #define IRAMORIG 0x40000000
22 #define IRAMSIZE 0xc000
24 #ifdef CPU_PP502x
25 #define NOCACHE_BASE    0x10000000
26 #else
27 #define NOCACHE_BASE    0x28000000
28 #endif
30 #define CACHEALIGN_SIZE 16
32 /* End of the audio buffer, where the codec buffer starts */
33 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
35 /* Where the codec buffer ends, and the plugin buffer starts */
36 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
38 MEMORY
40     DRAM : ORIGIN = DRAMORIG,     LENGTH = DRAMSIZE
41     IRAM : ORIGIN = IRAMORIG,     LENGTH = IRAMSIZE
44 SECTIONS
46     .text :
47     {
48         loadaddress = .;
49         _loadaddress = .;
50         . = ALIGN(0x200);
51         *(.init.text)
52         *(.text*)
53         *(.glue_7)
54         *(.glue_7t)
55         . = ALIGN(0x4);
56     } > DRAM
58     .rodata :
59     {
60         *(.rodata)  /* problems without this, dunno why */
61         *(.rodata*)
62         *(.rodata.str1.1)
63         *(.rodata.str1.4)
64         . = ALIGN(0x4);
66         /* Pseudo-allocate the copies of the data sections */
67         _datacopy = .;
68     } > DRAM
70     /* TRICK ALERT! For RAM execution, we put the .data section at the
71        same load address as the copy. Thus, we don't waste extra RAM
72        when we don't actually need the copy.  */
73     .data : AT ( _datacopy )
74     {
75         _datastart = .;
76         *(.data*)
77         . = ALIGN(0x4);
78         _dataend  = .;
79     } > DRAM
81 #if NOCACHE_BASE != 0
82     /* .ncdata section is placed at uncached physical alias address and is
83      * loaded at the proper cached virtual address - no copying is
84      * performed in the init code */
85     .ncdata . + NOCACHE_BASE :
86     {
87         . = ALIGN(CACHEALIGN_SIZE);
88         *(.ncdata*)
89         . = ALIGN(CACHEALIGN_SIZE);
90     } AT> DRAM
91 #endif
92     
93     /DISCARD/ :
94     {
95         *(.eh_frame)
96     }
98     .vectors 0x0 :
99     {
100         _vectorsstart = .;
101         *(.vectors);
102         _vectorsend = .;
103     } AT> DRAM
105     _vectorscopy = LOADADDR(.vectors);
106     _noloaddram  = LOADADDR(.vectors);
108     .ibss IRAMORIG (NOLOAD) :
109     {
110         _iedata = .;
111         *(.qharray)
112         *(.ibss)
113         . = ALIGN(0x4);
114         _iend = .;
115     } > IRAM
117     .iram _iend :
118     {
119         _iramstart = .;
120         *(.icode)
121         *(.irodata)
122         *(.idata)
123         . = ALIGN(0x4);
124         _iramend = .;
125     } > IRAM AT> DRAM
127     _iramcopy = LOADADDR(.iram);
130     .init ENDAUDIOADDR : 
131     {
132         . = ALIGN(4);
133         _initstart = .;
134         *(.init)
135         _initend = .;
136     } AT> DRAM
138     _initcopy = LOADADDR(.init);
140     .idle_stacks (NOLOAD) :
141     {
142        *(.idle_stacks)
143 #if NUM_CORES > 1
144        cpu_idlestackbegin = .;
145        . += IDLE_STACK_SIZE;
146        cpu_idlestackend = .;
147 #endif
148        cop_idlestackbegin = .;
149        . += IDLE_STACK_SIZE;
150        cop_idlestackend = .;
151     } > IRAM
153     .stack (NOLOAD) :
154     {
155        *(.stack)
156        stackbegin = .;
157        . += 0x2000;
158        stackend = .;
159     } > IRAM
160     
161     /* .bss and .ncbss are treated as a single section to use one init loop to
162      * zero it - note "_edata" and "_end" */
163     .bss _noloaddram (NOLOAD) :
164     {
165        _edata = .;
166         *(.bss*)
167         *(COMMON)
168         . = ALIGN(0x4);
169     } > DRAM
171 #if NOCACHE_BASE != 0
172     .ncbss . + NOCACHE_BASE (NOLOAD):
173     {
174         . = ALIGN(CACHEALIGN_SIZE);
175         *(.ncbss*)
176         . = ALIGN(CACHEALIGN_SIZE);
177     } AT> DRAM
178 #endif
180     /* This will be aligned by preceding alignments */
181     .endaddr . - NOCACHE_BASE (NOLOAD) :
182     {
183         _end = .;
184     } > DRAM
186     .audiobuf (NOLOAD) :
187     {
188         _audiobuffer = .;
189         . = ALIGN(0x4);
190         audiobuffer = .;
191     } > DRAM
192     
193     .audiobufend ENDAUDIOADDR (NOLOAD) :
194     {
195         audiobufend = .;
196         _audiobufend = .;
197     } > DRAM
199     .codec ENDAUDIOADDR (NOLOAD) :
200     {
201         codecbuf = .;
202         _codecbuf = .;
203     }
205     .plugin ENDADDR (NOLOAD) :
206     {
207         _pluginbuf = .;
208         pluginbuf = .;
209     }