Hopefully finish off the red from r26051.
[kugel-rb.git] / firmware / target / mips / ingenic_jz47xx / app.lds
blobbd924e44f4456b59a6e25888f9e2a398eb7aa78b
1 #include "config.h"
2 #undef mips
4 OUTPUT_FORMAT("elf32-littlemips")
5 OUTPUT_ARCH(MIPS)
6 ENTRY(_start)
7 STARTUP(target/mips/ingenic_jz47xx/crt0.o)
9 #ifdef DEBUG
10 #define STUBOFFSET 0x10000
11 #else
12 #define STUBOFFSET 0
13 #endif
16 #define DRAMORIG      0x80004000 + STUBOFFSET
17 #define DRAMSIZE      (MEMORYSIZE * 0x100000 - STUBOFFSET)
18 #define IRAMORIG      0x80000000
19 #define IRAMSIZE      16K
21 /* End of the audio buffer, where the codec buffer starts */
22 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE)
24 /* Where the codec buffer ends, and the plugin buffer starts */
25 #define ENDCODECADDR  (ENDAUDIOADDR + CODEC_SIZE)
27 MEMORY
29    DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
30    IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
33 SECTIONS
35     . = DRAMORIG;
37     .text :
38     {
39         loadaddress = .;
40         _loadaddress = .;
41         *(.init.text);
42         *(.text*);
43     } > DRAM
45     . = ALIGN(4);
47     .rodata :
48     {
49         *(.rodata*);
50     } > DRAM
52     . = ALIGN(4);
54     .data :
55     {
56         *(.data*);
57         *(.sdata*);
58     } > DRAM
60     /* Set the load address of .iram at the same address as .bss
61      * so RAM won't be wasted as .iram in the end will get copied
62      * to IRAM. */
63     .iram IRAMORIG: AT (_edata)
64     {
65         _iramstart = .;
66         *(.vectors.1);
67         . = 0x100;
68         *(.vectors.2);
69         . = 0x180;
70         *(.vectors.3);
71         . = 0x200;
72         *(.vectors.4);
73         *(.vectors);
75         *(.icode);
76         *(.irodata);
77         *(.idata);
78         KEEP(*(.vectors))
79         *(.vectors);
80         _iramend = .;
81     } > IRAM
82     _iramcopy = LOADADDR(.iram);
84     . = ALIGN(4);
86     .stack (NOLOAD):
87     {
88          *(.stack);
89          stackbegin = .;
90          . += 0x2000;
91          stackend = .;
92     } > IRAM
94     .bss (NOLOAD):
95     {
96          _edata = .;
97          *(.sbss*);
98          *(.bss*);
99          *(.ibss*); /* Don't put this in IRAM as there's not enough space */
100          *(COMMON);
101          *(.scommon*);
102          _end = .;
103     } > DRAM
105     .audiobuf :
106     {
107         . = ALIGN(4);
108         audiobuffer = .;
109     } > DRAM
111     audiobufend = ENDAUDIOADDR;
112     codecbuf = ENDAUDIOADDR;
113     pluginbuf = ENDCODECADDR;
115     /DISCARD/ :
116     {
117         *(.eh_frame);
118         *(.rel.dyn);
119     }