Ingenic Jz4740: enable IRAM (only core, without ibss)
[kugel-rb.git] / firmware / target / mips / ingenic_jz47xx / app.lds
blobe8c9ebf65bc11c4933c3b2e295c24ff0313645ec
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
15 #define DRAMSIZE      (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE
17 #define DRAMORIG      0x80004000
18 #define IRAMORIG      0x80000000
19 #define IRAMSIZE      16K
21 /* End of the audio buffer, where the codec buffer starts */
22 #define ENDAUDIOADDR  (DRAMORIG + DRAMSIZE)
24 /* Where the codec buffer ends, and the plugin buffer starts */
25 #define ENDADDR       (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         *(.rel.dyn);
59     } > DRAM
61     . = ALIGN(4);
63     /* Set the load address of .iram at the same address as .bss
64      * so RAM won't be wasted as .iram in the end will get copied
65      * to IRAM. */
66     .iram IRAMORIG: AT (_edata)
67     {
68         _iramstart = .;
69         *(.vectors.1);
70         . = 0x100;
71         *(.vectors.2);
72         . = 0x180;
73         *(.vectors.3);
74         . = 0x200;
75         *(.vectors.4);
76         *(.vectors);
78         *(.icode);
79         *(.irodata);
80         *(.idata);
81         KEEP(*(.vectors))
82         *(.vectors);
83         _iramend = .;
84     } > IRAM
85     _iramcopy = LOADADDR(.iram);
87     . = ALIGN(4);
89     .stack (NOLOAD):
90     {
91          *(.stack);
92          stackbegin = .;
93          . += 0x2000;
94          stackend = .;
95     } > IRAM
97     .bss (NOLOAD):
98     {
99          _edata = .;
100          *(.sbss*);
101          *(.bss*);
102          *(.ibss*); /* Don't put this in IRAM as there's not enough space */
103          *(COMMON);
104          *(.scommon*);
105          _end = .;
106     } > DRAM
108     . = ALIGN(4);
110     .audiobuf ALIGN(4) :
111     {
112         audiobuffer = .;
113     } > DRAM
115     .audiobufend ENDAUDIOADDR:
116     {
117         audiobufend = .;
118     }
120     .codec ENDAUDIOADDR:
121     {
122         codecbuf = .;
123     }
125     .plugin ENDADDR:
126     {
127         pluginbuf = .;
128     }
130     /DISCARD/ :
131     {
132         *(.eh_frame);
133     }