Daniel Stenberg | 762a6c6 | 2004-09-03 13:16:19 +0000 | [diff] [blame] | 1 | #include "config.h" |
| 2 | |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 3 | ENTRY(start) |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 4 | |
Christian Gmeiner | c6ff1f5 | 2005-07-18 12:40:29 +0000 | [diff] [blame] | 5 | #ifdef CPU_COLDFIRE |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 6 | OUTPUT_FORMAT(elf32-m68k) |
Jens Arnold | 2bbacf8 | 2008-04-29 06:19:32 +0000 | [diff] [blame] | 7 | STARTUP(target/coldfire/crt0.o) |
Daniel Ankers | 41997d3 | 2006-08-31 19:45:05 +0000 | [diff] [blame] | 8 | #elif defined(CPU_PP) |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 9 | OUTPUT_FORMAT(elf32-littlearm) |
Rafaël Carré | 7ef13ee | 2012-01-03 04:44:27 +0000 | [diff] [blame] | 10 | STARTUP(target/arm/pp/crt0-pp.o) |
Daniel Ankers | 41997d3 | 2006-08-31 19:45:05 +0000 | [diff] [blame] | 11 | #elif defined(CPU_ARM) |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 12 | OUTPUT_FORMAT(elf32-littlearm) |
Jens Arnold | 2bbacf8 | 2008-04-29 06:19:32 +0000 | [diff] [blame] | 13 | STARTUP(target/arm/crt0.o) |
Daniel Ankers | 41997d3 | 2006-08-31 19:45:05 +0000 | [diff] [blame] | 14 | #elif CONFIG_CPU == SH7034 |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 15 | OUTPUT_FORMAT(elf32-sh) |
Jens Arnold | 2bbacf8 | 2008-04-29 06:19:32 +0000 | [diff] [blame] | 16 | STARTUP(target/sh/crt0.o) |
Daniel Ankers | 41997d3 | 2006-08-31 19:45:05 +0000 | [diff] [blame] | 17 | #else |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 18 | OUTPUT_FORMAT(elf32-sh) |
Jens Arnold | 2bbacf8 | 2008-04-29 06:19:32 +0000 | [diff] [blame] | 19 | STARTUP(crt0.o) |
Daniel Ankers | 41997d3 | 2006-08-31 19:45:05 +0000 | [diff] [blame] | 20 | #endif |
| 21 | |
Jens Arnold | 0978026 | 2005-01-12 01:25:19 +0000 | [diff] [blame] | 22 | |
Dave Chapman | e452383 | 2005-02-15 14:00:37 +0000 | [diff] [blame] | 23 | #if MEMORYSIZE >= 32 |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 24 | #define PLUGINSIZE PLUGIN_BUFFER_SIZE |
Dave Chapman | e452383 | 2005-02-15 14:00:37 +0000 | [diff] [blame] | 25 | #else |
Jens Arnold | 0978026 | 2005-01-12 01:25:19 +0000 | [diff] [blame] | 26 | #define PLUGINSIZE 0x8000 |
Dave Chapman | e452383 | 2005-02-15 14:00:37 +0000 | [diff] [blame] | 27 | #endif |
Jens Arnold | 0978026 | 2005-01-12 01:25:19 +0000 | [diff] [blame] | 28 | |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 29 | |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 30 | #ifdef IRIVER_H100_SERIES |
| 31 | #define CODECSIZE CODEC_SIZE |
Linus Nielsen Feltzing | 1c40d3c | 2005-04-20 06:48:17 +0000 | [diff] [blame] | 32 | #define DRAMORIG 0x31000000 |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 33 | #define IRAMORIG 0x10000000 |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 34 | #define IRAMSIZE 0xc000 |
| 35 | #define FLASHORIG 0x00100028 |
| 36 | #define FLASHSIZE 0x000eff80 |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 37 | #else |
| 38 | #define DRAMORIG 0x09000000 |
Jens Arnold | 0978026 | 2005-01-12 01:25:19 +0000 | [diff] [blame] | 39 | #define IRAMORIG 0x0f000000 |
| 40 | #define IRAMSIZE 0x1000 |
| 41 | #define FLASHORIG 0x02000000 + ROM_START |
| 42 | #define FLASHSIZE 256K - ROM_START |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 43 | #endif |
Jens Arnold | 0978026 | 2005-01-12 01:25:19 +0000 | [diff] [blame] | 44 | |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 45 | #ifdef CODECSIZE |
| 46 | #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - CODECSIZE |
| 47 | /* Where the codec buffer ends, and the plugin buffer starts */ |
| 48 | #define ENDADDR (ENDAUDIOADDR + CODECSIZE) |
| 49 | #else |
| 50 | #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE |
| 51 | /* Where the audio buffer ends, and the plugin buffer starts */ |
| 52 | #define ENDADDR ENDAUDIOADDR |
| 53 | #endif |
| 54 | |
| 55 | /* End of the audio buffer, where the codec/plugin buffer starts */ |
| 56 | #define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) |
Marcin Bukat | 21d026d | 2014-01-18 23:11:25 +0100 | [diff] [blame] | 57 | #define CODECORIG ENDAUDIOADDR |
| 58 | |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 59 | MEMORY |
| 60 | { |
Jens Arnold | 0978026 | 2005-01-12 01:25:19 +0000 | [diff] [blame] | 61 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE |
| 62 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE |
| 63 | FLASH : ORIGIN = FLASHORIG, LENGTH = FLASHSIZE |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 64 | } |
Marcin Bukat | 21d026d | 2014-01-18 23:11:25 +0100 | [diff] [blame] | 65 | |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 66 | SECTIONS |
| 67 | { |
Jörg Hohensohn | 13be9f1 | 2005-08-23 07:26:40 +0000 | [diff] [blame] | 68 | .flashheader : |
| 69 | { |
| 70 | /* place flash link address first, so the plugin can check */ |
| 71 | LONG(FLASHORIG); |
| 72 | /* followed by the start address, the first vector takes care of this. */ |
| 73 | /* If we ever place the table elsewhere, put a constant here. */ |
| 74 | } > FLASH |
| 75 | |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 76 | .vectors : |
| 77 | { |
| 78 | _datacopy = .; |
| 79 | } > FLASH |
| 80 | |
| 81 | .data : AT ( _datacopy ) |
| 82 | { |
Linus Nielsen Feltzing | bd42d31 | 2005-03-31 08:47:02 +0000 | [diff] [blame] | 83 | loadaddress = .; |
| 84 | _loadaddress = .; |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 85 | _datastart = .; |
Boris Gjenero | ca9111e | 2011-12-18 06:43:08 +0000 | [diff] [blame] | 86 | KEEP(*(.resetvectors)); |
| 87 | KEEP(*(.vectors)); |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 88 | . = ALIGN(0x200); |
Marcin Bukat | b3abcb8 | 2014-01-20 10:42:02 +0100 | [diff] [blame] | 89 | #ifdef HAVE_INIT_ATTR |
| 90 | *(.initdata*) |
| 91 | #endif |
Boris Gjenero | 0efabb3 | 2011-12-18 07:09:00 +0000 | [diff] [blame] | 92 | *(.data*) |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 93 | . = ALIGN(0x4); |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 94 | _dataend = .; |
Daniel Stenberg | 678090a | 2004-09-06 07:05:12 +0000 | [diff] [blame] | 95 | . = ALIGN(0x10); /* Maintain proper alignment for .text section */ |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 96 | } > DRAM |
| 97 | |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 98 | /DISCARD/ : |
| 99 | { |
| 100 | *(.eh_frame) |
| 101 | } |
| 102 | |
Daniel Stenberg | 678090a | 2004-09-06 07:05:12 +0000 | [diff] [blame] | 103 | /* TRICK ALERT! Newer versions of the linker don't allow output sections |
| 104 | to overlap even if one of them is empty, so advance the location pointer |
| 105 | "by hand" */ |
| 106 | .text LOADADDR(.data) + SIZEOF(.data) : |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 107 | { |
| 108 | *(.init.text) |
Marcin Bukat | 21d026d | 2014-01-18 23:11:25 +0100 | [diff] [blame] | 109 | KEEP(*(.startup*)); |
Marcin Bukat | b3abcb8 | 2014-01-20 10:42:02 +0100 | [diff] [blame] | 110 | #ifdef HAVE_INIT_ATTR |
| 111 | /* all this symbols are set to the same address so .init copy loop |
| 112 | will be skiped in crt0.S */ |
| 113 | _initstart = .; |
| 114 | _initend = .; |
| 115 | _initcopy = .; |
| 116 | *(.init*) |
| 117 | #endif |
Boris Gjenero | 0efabb3 | 2011-12-18 07:09:00 +0000 | [diff] [blame] | 118 | *(.text*) |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 119 | . = ALIGN(0x4); |
| 120 | } > FLASH |
| 121 | |
| 122 | .rodata : |
| 123 | { |
Boris Gjenero | 0efabb3 | 2011-12-18 07:09:00 +0000 | [diff] [blame] | 124 | *(.rodata*) |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 125 | *(.rodata.str1.1) |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 126 | *(.rodata.str1.4) |
| 127 | . = ALIGN(0x4); |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 128 | _iramcopy = .; |
| 129 | } > FLASH |
| 130 | |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 131 | .iram IRAMORIG : AT ( _iramcopy ) |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 132 | { |
| 133 | _iramstart = .; |
| 134 | *(.icode) |
Jens Arnold | abd9f83 | 2005-10-19 19:35:24 +0000 | [diff] [blame] | 135 | *(.irodata) |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 136 | *(.idata) |
| 137 | _iramend = .; |
| 138 | } > IRAM |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 139 | |
Jens Arnold | abd9f83 | 2005-10-19 19:35:24 +0000 | [diff] [blame] | 140 | .ibss (NOLOAD) : |
| 141 | { |
| 142 | _iedata = .; |
| 143 | *(.ibss) |
| 144 | . = ALIGN(0x4); |
| 145 | _iend = .; |
| 146 | } > IRAM |
| 147 | |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 148 | .stack : |
| 149 | { |
| 150 | *(.stack) |
| 151 | _stackbegin = .; |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 152 | stackbegin = .; |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 153 | . += 0x2000; |
| 154 | _stackend = .; |
Linus Nielsen Feltzing | 63cf21d | 2005-01-28 13:19:01 +0000 | [diff] [blame] | 155 | stackend = .; |
Miika Pekkarinen | ee4caec | 2007-01-08 19:19:23 +0000 | [diff] [blame] | 156 | #if IRAMSIZE > 0x1000 |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 157 | } > IRAM |
Miika Pekkarinen | ee4caec | 2007-01-08 19:19:23 +0000 | [diff] [blame] | 158 | #else |
| 159 | } > DRAM |
| 160 | #endif |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 161 | |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 162 | #ifdef CPU_COLDFIRE |
| 163 | .bss ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram): |
| 164 | #else |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 165 | .bss : |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 166 | #endif |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 167 | { |
| 168 | _edata = .; |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 169 | *(.bss*) |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 170 | *(COMMON) |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 171 | . = ALIGN(0x4); |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 172 | _end = .; |
| 173 | } > DRAM |
| 174 | |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 175 | .audiobuf ALIGN(4): |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 176 | { |
Linus Nielsen Feltzing | d34865a | 2005-04-05 11:33:58 +0000 | [diff] [blame] | 177 | _audiobuffer = .; |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 178 | audiobuffer = .; |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 179 | } > DRAM |
| 180 | |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 181 | #ifdef CODECSIZE |
| 182 | .audiobufend ENDAUDIOADDR: |
| 183 | #else |
Linus Nielsen Feltzing | d34865a | 2005-04-05 11:33:58 +0000 | [diff] [blame] | 184 | .audiobufend ENDADDR: |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 185 | #endif |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 186 | { |
Linus Nielsen Feltzing | d34865a | 2005-04-05 11:33:58 +0000 | [diff] [blame] | 187 | _audiobufend = .; |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 188 | audiobufend = .; |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 189 | } > DRAM |
| 190 | |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 191 | #ifdef CODECSIZE |
| 192 | .codec ENDAUDIOADDR: |
| 193 | { |
| 194 | codecbuf = .; |
| 195 | _codecbuf = .; |
| 196 | } |
| 197 | #endif |
| 198 | |
Jens Arnold | 0978026 | 2005-01-12 01:25:19 +0000 | [diff] [blame] | 199 | .plugin ENDADDR: |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 200 | { |
| 201 | _pluginbuf = .; |
Miika Pekkarinen | b1af4e6 | 2007-01-08 18:21:12 +0000 | [diff] [blame] | 202 | pluginbuf = .; |
Daniel Stenberg | 32cd555 | 2004-09-03 13:02:16 +0000 | [diff] [blame] | 203 | } |
| 204 | } |