Fix as3525 lowmem targets. They put the init code into the plugin buffer, but some...
[kugel-rb.git] / firmware / target / arm / as3525 / app.lds
blob56a4b20fa6b340319ff43546c749004a6d26c2e8
1 #include "config.h"
2 #include "cpu.h"
4 ENTRY(start)
6 OUTPUT_FORMAT(elf32-littlearm)
7 OUTPUT_ARCH(arm)
8 STARTUP(target/arm/crt0.o)
10 #define PLUGINSIZE PLUGIN_BUFFER_SIZE
11 #define CODECSIZE CODEC_SIZE
13 #ifdef DEBUG
14 #define STUBOFFSET 0x10000
15 #else
16 #define STUBOFFSET 0
17 #endif
20 #define IRAMORIG IRAM_ORIG
21 #define DRAMORIG (DRAM_ORIG + STUBOFFSET)
23 /* End of the audio buffer, where the codec buffer starts */
24 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
27 #ifdef AMS_LOWMEM
28 #define DRAMSIZE (DRAM_SIZE - STUBOFFSET - PLUGINSIZE - TTB_SIZE)
29 #define CODECORIG (IRAMORIG + (IRAM_SIZE - CODEC_SIZE))
30 #define IRAMSIZE (IRAM_SIZE - CODEC_SIZE)
31 #else
32 #define DRAMSIZE (DRAM_SIZE - STUBOFFSET - PLUGINSIZE - CODECSIZE - TTB_SIZE)
33 #define CODECORIG (ENDAUDIOADDR)
34 #define IRAMSIZE (0x20000)
35 #endif
38 /* Where the codec buffer ends, and the plugin buffer starts */
39 #ifdef AMS_LOWMEM
40 #define ENDADDR (ENDAUDIOADDR)
41 #else
42 #define ENDADDR (ENDAUDIOADDR + CODECSIZE)
43 #endif
45 MEMORY
47 #ifdef AMS_LOWMEM
48     CODEC_IRAM : ORIGIN = CODECORIG, LENGTH = CODEC_SIZE
49 #endif
50     IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
51     DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
54 SECTIONS
56     loadaddress = DRAM_ORIG;
58     .vectors :
59     {
60         _vectors_start = .;
61         *(.init.text)
62     } > DRAM
64     .text :
65     {
66         _loadaddress = .;
67         _textstart = .;
68         *(.text)
69         *(.text*)
70         *(.glue_7)
71         *(.glue_7t)
72         . = ALIGN(0x4);
73     } > DRAM
75     .rodata :
76     {
77         *(.rodata*)
78         . = ALIGN(0x4);
79     } > DRAM
81     .data :
82     {
83         *(.data*)
84         . = ALIGN(0x4);
85     } > DRAM
87     /DISCARD/ :
88     {
89         *(.eh_frame)
90     }
92     .iram :
93     {
94         _iramstart = .;
95         *(.icode)
96         *(.irodata)
97         *(.idata)
98         . = ALIGN(0x4);
99         _iramend = .;
100     } > IRAM AT> DRAM
102     _iramcopy = LOADADDR(.iram);
104     .ibss (NOLOAD) :
105     {
106         _iedata = .;
107         *(.qharray)
108         *(.ibss)
109         . = ALIGN(0x4);
110         _iend = .;
111     } > IRAM
113     .init CODECORIG : 
114     {
115         . = ALIGN(4);
116         _initstart = .;
117         *(.init)
118         _initend = .;
119     } AT> DRAM
121     _initcopy = LOADADDR(.init);
123     .stack _iramcopy (NOLOAD) :
124     {
125        *(.stack)
126        stackbegin = .;
127        . += 0x2000;
128        stackend = .;
129     } > DRAM
131     .bss (NOLOAD) :
132     {
133        _edata = .;
134         *(.bss*)
135         *(COMMON)
136         . = ALIGN(0x4);
137        _end = .;
138     } > DRAM
140     .audiobuf (NOLOAD) :
141     {
142         . = ALIGN(4);
143         _audiobuffer = .;
144         audiobuffer = .;
145     } > DRAM
147     .audiobufend ENDAUDIOADDR (NOLOAD) :
148     {
149         audiobufend = .;
150         _audiobufend = .;
151     } > DRAM
153     .codec CODECORIG (NOLOAD) :
154     {
155         codecbuf = .;
156         _codecbuf = .;
157 #ifdef AMS_LOWMEM
158     } > CODEC_IRAM
159 #else
160     } > DRAM
161 #endif
163     .plugin ENDADDR (NOLOAD) :
164     {
165         _pluginbuf = .;
166         pluginbuf = .;
167     }