Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 1 | /* GNU linker script for ESP8266 */ |
| 2 | |
| 3 | MEMORY |
| 4 | { |
| 5 | dport0_0_seg : org = 0x3ff00000, len = 0x10 |
| 6 | dram0_0_seg : org = 0x3ffe8000, len = 0x14000 |
| 7 | iram1_0_seg : org = 0x40100000, len = 0x8000 |
Paul Sokolovsky | 8d2bcaf | 2016-04-03 15:40:53 +0300 | [diff] [blame] | 8 | irom0_0_seg : org = 0x40209000, len = 0x80000 |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 9 | } |
| 10 | |
| 11 | /* define the top of RAM */ |
| 12 | _heap_end = ORIGIN(dram0_0_seg) + LENGTH(dram0_0_seg); |
| 13 | |
| 14 | PHDRS |
| 15 | { |
| 16 | dport0_0_phdr PT_LOAD; |
| 17 | dram0_0_phdr PT_LOAD; |
| 18 | dram0_0_bss_phdr PT_LOAD; |
| 19 | iram1_0_phdr PT_LOAD; |
| 20 | irom0_0_phdr PT_LOAD; |
| 21 | } |
| 22 | |
| 23 | ENTRY(call_user_start) |
Josef Gajdusek | 7d8edef | 2015-05-26 18:54:55 +0200 | [diff] [blame] | 24 | EXTERN(_DebugExceptionVector) |
| 25 | EXTERN(_DoubleExceptionVector) |
| 26 | EXTERN(_KernelExceptionVector) |
| 27 | EXTERN(_NMIExceptionVector) |
| 28 | EXTERN(_UserExceptionVector) |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 29 | |
| 30 | PROVIDE(_memmap_vecbase_reset = 0x40000000); |
| 31 | |
| 32 | /* Various memory-map dependent cache attribute settings: */ |
| 33 | _memmap_cacheattr_wb_base = 0x00000110; |
| 34 | _memmap_cacheattr_wt_base = 0x00000110; |
| 35 | _memmap_cacheattr_bp_base = 0x00000220; |
| 36 | _memmap_cacheattr_unused_mask = 0xFFFFF00F; |
| 37 | _memmap_cacheattr_wb_trapnull = 0x2222211F; |
| 38 | _memmap_cacheattr_wba_trapnull = 0x2222211F; |
| 39 | _memmap_cacheattr_wbna_trapnull = 0x2222211F; |
| 40 | _memmap_cacheattr_wt_trapnull = 0x2222211F; |
| 41 | _memmap_cacheattr_bp_trapnull = 0x2222222F; |
| 42 | _memmap_cacheattr_wb_strict = 0xFFFFF11F; |
| 43 | _memmap_cacheattr_wt_strict = 0xFFFFF11F; |
| 44 | _memmap_cacheattr_bp_strict = 0xFFFFF22F; |
| 45 | _memmap_cacheattr_wb_allvalid = 0x22222112; |
| 46 | _memmap_cacheattr_wt_allvalid = 0x22222112; |
| 47 | _memmap_cacheattr_bp_allvalid = 0x22222222; |
| 48 | PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); |
| 49 | |
| 50 | SECTIONS |
| 51 | { |
| 52 | |
| 53 | .dport0.rodata : ALIGN(4) |
| 54 | { |
| 55 | _dport0_rodata_start = ABSOLUTE(.); |
| 56 | *(.dport0.rodata) |
| 57 | *(.dport.rodata) |
| 58 | _dport0_rodata_end = ABSOLUTE(.); |
| 59 | } >dport0_0_seg :dport0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 60 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 61 | .dport0.literal : ALIGN(4) |
| 62 | { |
| 63 | _dport0_literal_start = ABSOLUTE(.); |
| 64 | *(.dport0.literal) |
| 65 | *(.dport.literal) |
| 66 | _dport0_literal_end = ABSOLUTE(.); |
| 67 | } >dport0_0_seg :dport0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 68 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 69 | .dport0.data : ALIGN(4) |
| 70 | { |
| 71 | _dport0_data_start = ABSOLUTE(.); |
| 72 | *(.dport0.data) |
| 73 | *(.dport.data) |
| 74 | _dport0_data_end = ABSOLUTE(.); |
| 75 | } >dport0_0_seg :dport0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 76 | |
| 77 | .irom0.text : ALIGN(4) |
| 78 | { |
| 79 | _irom0_text_start = ABSOLUTE(.); |
| 80 | *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) |
Damien George | e636279 | 2014-11-29 14:36:18 +0000 | [diff] [blame] | 81 | |
| 82 | /* we put some specific text in this section */ |
Damien George | 3fbbbec | 2015-12-28 17:38:40 +0000 | [diff] [blame] | 83 | |
| 84 | *py/argcheck.o*(.literal* .text*) |
| 85 | *py/asm*.o*(.literal* .text*) |
| 86 | *py/bc.o*(.literal* .text*) |
| 87 | *py/binary.o*(.literal* .text*) |
| 88 | *py/builtin*.o*(.literal* .text*) |
| 89 | *py/compile.o*(.literal* .text*) |
| 90 | *py/emit*.o*(.literal* .text*) |
| 91 | *py/formatfloat.o*(.literal* .text*) |
| 92 | *py/frozenmod.o*(.literal* .text*) |
| 93 | *py/gc.o*(.literal* .text*) |
| 94 | *py/lexer*.o*(.literal* .text*) |
| 95 | *py/malloc*.o*(.literal* .text*) |
| 96 | *py/map*.o*(.literal* .text*) |
| 97 | *py/mod*.o*(.literal* .text*) |
| 98 | *py/mpprint.o*(.literal* .text*) |
| 99 | *py/mpstate.o*(.literal* .text*) |
| 100 | *py/mpz.o*(.literal* .text*) |
| 101 | *py/native*.o*(.literal* .text*) |
| 102 | *py/nlr*.o*(.literal* .text*) |
| 103 | *py/obj*.o*(.literal* .text*) |
| 104 | *py/opmethods.o*(.literal* .text*) |
| 105 | *py/parse*.o*(.literal* .text*) |
| 106 | *py/qstr.o*(.literal* .text*) |
| 107 | *py/repl.o*(.literal* .text*) |
| 108 | *py/runtime.o*(.literal* .text*) |
| 109 | *py/scope.o*(.literal* .text*) |
| 110 | *py/sequence.o*(.literal* .text*) |
| 111 | *py/showbc.o*(.literal* .text*) |
| 112 | *py/smallint.o*(.literal* .text*) |
| 113 | *py/stackctrl.o*(.literal* .text*) |
| 114 | *py/stream.o*(.literal* .text*) |
| 115 | *py/unicode.o*(.literal* .text*) |
| 116 | *py/vm.o*(.literal* .text*) |
| 117 | *py/vstr.o*(.literal* .text*) |
| 118 | *py/warning.o*(.literal* .text*) |
| 119 | |
| 120 | *extmod/*.o*(.literal* .text*) |
| 121 | |
Paul Sokolovsky | cd6194a | 2016-03-27 17:15:25 +0300 | [diff] [blame] | 122 | *lib/fatfs/*.o*(.literal*, .text*) |
Damien George | 6d0629b | 2015-12-18 21:07:58 +0000 | [diff] [blame] | 123 | *lib/libm/*.o*(.literal*, .text*) |
Damien George | 3fbbbec | 2015-12-28 17:38:40 +0000 | [diff] [blame] | 124 | *lib/mp-readline/*.o(.literal*, .text*) |
| 125 | *lib/netutils/*.o*(.literal*, .text*) |
| 126 | *lib/timeutils/*.o*(.literal*, .text*) |
| 127 | *lib/utils/*.o*(.literal*, .text*) |
| 128 | |
| 129 | *stmhal/pybstdio.o(.literal*, .text*) |
| 130 | |
Damien George | e636279 | 2014-11-29 14:36:18 +0000 | [diff] [blame] | 131 | *gccollect.o(.literal* .text*) |
| 132 | *gchelper.o(.literal* .text*) |
Paul Sokolovsky | 9c7e335 | 2016-03-26 00:39:02 +0200 | [diff] [blame] | 133 | *lexerstr32.o(.literal* .text*) |
Paul Sokolovsky | f71c069 | 2016-03-26 00:39:51 +0200 | [diff] [blame] | 134 | *utils.o(.literal* .text*) |
Damien George | 304a96d | 2015-05-13 14:49:14 +0100 | [diff] [blame] | 135 | *modpyb.o(.literal*, .text*) |
| 136 | *modpybpin.o(.literal*, .text*) |
Damien George | 632d8ef | 2016-03-02 13:37:27 +0000 | [diff] [blame] | 137 | *modpybpwm.o(.literal*, .text*) |
Damien George | 304a96d | 2015-05-13 14:49:14 +0100 | [diff] [blame] | 138 | *modpybrtc.o(.literal*, .text*) |
Damien George | 3fbbbec | 2015-12-28 17:38:40 +0000 | [diff] [blame] | 139 | *modpybadc.o(.literal*, .text*) |
Paul Sokolovsky | 935e021 | 2016-03-26 10:59:25 +0200 | [diff] [blame] | 140 | *modpybi2c.o(.literal*, .text*) |
Damien George | 82b95f6 | 2016-03-01 22:53:23 +0000 | [diff] [blame] | 141 | *modpybspi.o(.literal*, .text*) |
Josef Gajdusek | b479319 | 2015-05-11 15:05:59 +0200 | [diff] [blame] | 142 | *modesp.o(.literal* .text*) |
Damien George | f09f809 | 2015-10-20 22:59:31 +0100 | [diff] [blame] | 143 | *modnetwork.o(.literal* .text*) |
| 144 | *moduos.o(.literal* .text*) |
Damien George | 304a96d | 2015-05-13 14:49:14 +0100 | [diff] [blame] | 145 | *modutime.o(.literal* .text*) |
Damien George | 05dda0e | 2015-12-28 10:23:30 +0000 | [diff] [blame] | 146 | *modlwip.o(.literal* .text*) |
Damien George | 3fbbbec | 2015-12-28 17:38:40 +0000 | [diff] [blame] | 147 | *modsocket.o(.literal* .text*) |
Damien George | e636279 | 2014-11-29 14:36:18 +0000 | [diff] [blame] | 148 | |
| 149 | /* we put as much rodata as possible in this section */ |
| 150 | /* note that only rodata accessed as a machine word is allowed here */ |
| 151 | *py/qstr.o(.rodata.const_pool) |
Damien George | 3fbbbec | 2015-12-28 17:38:40 +0000 | [diff] [blame] | 152 | *.o(.rodata.mp_type_*) /* catches type: mp_obj_type_t */ |
| 153 | *.o(.rodata.*_locals_dict*) /* catches types: mp_obj_dict_t, mp_map_elem_t */ |
| 154 | *.o(.rodata.mp_module_*) /* catches types: mp_obj_module_t, mp_obj_dict_t, mp_map_elem_t */ |
Paul Sokolovsky | 9d7b871 | 2016-03-17 23:06:47 +0800 | [diff] [blame] | 155 | */frozen.o(.rodata.mp_frozen_sizes) /* frozen modules */ |
| 156 | */frozen.o(.rodata.mp_frozen_content) /* frozen modules */ |
Damien George | e636279 | 2014-11-29 14:36:18 +0000 | [diff] [blame] | 157 | |
Paul Sokolovsky | ef0c5db | 2016-04-03 00:51:51 +0300 | [diff] [blame] | 158 | /* for -mforce-l32 */ |
| 159 | build/*.o(.rodata*) |
| 160 | |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 161 | _irom0_text_end = ABSOLUTE(.); |
| 162 | } >irom0_0_seg :irom0_0_phdr |
| 163 | |
| 164 | .text : ALIGN(4) |
| 165 | { |
| 166 | _stext = .; |
| 167 | _text_start = ABSOLUTE(.); |
Josef Gajdusek | 7d8edef | 2015-05-26 18:54:55 +0200 | [diff] [blame] | 168 | *(.UserEnter.text) |
| 169 | . = ALIGN(16); |
| 170 | *(.DebugExceptionVector.text) |
| 171 | . = ALIGN(16); |
| 172 | *(.NMIExceptionVector.text) |
| 173 | . = ALIGN(16); |
| 174 | *(.KernelExceptionVector.text) |
| 175 | LONG(0) |
| 176 | LONG(0) |
| 177 | LONG(0) |
| 178 | LONG(0) |
| 179 | . = ALIGN(16); |
| 180 | *(.UserExceptionVector.text) |
| 181 | LONG(0) |
| 182 | LONG(0) |
| 183 | LONG(0) |
| 184 | LONG(0) |
| 185 | . = ALIGN(16); |
| 186 | *(.DoubleExceptionVector.text) |
| 187 | LONG(0) |
| 188 | LONG(0) |
| 189 | LONG(0) |
| 190 | LONG(0) |
| 191 | . = ALIGN (16); |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 192 | *(.entry.text) |
| 193 | *(.init.literal) |
| 194 | *(.init) |
| 195 | *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) |
| 196 | *(.fini.literal) |
| 197 | *(.fini) |
| 198 | *(.gnu.version) |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 199 | _text_end = ABSOLUTE(.); |
| 200 | _etext = .; |
| 201 | } >iram1_0_seg :iram1_0_phdr |
| 202 | |
| 203 | .lit4 : ALIGN(4) |
| 204 | { |
| 205 | _lit4_start = ABSOLUTE(.); |
| 206 | *(*.lit4) |
| 207 | *(.lit4.*) |
| 208 | *(.gnu.linkonce.lit4.*) |
| 209 | _lit4_end = ABSOLUTE(.); |
| 210 | } >iram1_0_seg :iram1_0_phdr |
| 211 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 212 | .data : ALIGN(4) |
| 213 | { |
| 214 | _data_start = ABSOLUTE(.); |
| 215 | *(.data) |
| 216 | *(.data.*) |
| 217 | *(.gnu.linkonce.d.*) |
| 218 | *(.data1) |
| 219 | *(.sdata) |
| 220 | *(.sdata.*) |
| 221 | *(.gnu.linkonce.s.*) |
| 222 | *(.sdata2) |
| 223 | *(.sdata2.*) |
| 224 | *(.gnu.linkonce.s2.*) |
| 225 | *(.jcr) |
| 226 | _data_end = ABSOLUTE(.); |
| 227 | } >dram0_0_seg :dram0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 228 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 229 | .rodata : ALIGN(4) |
| 230 | { |
| 231 | _rodata_start = ABSOLUTE(.); |
Paul Sokolovsky | 259f134 | 2015-12-27 18:23:11 +0200 | [diff] [blame] | 232 | *(.sdk.version) |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 233 | *(.rodata) |
| 234 | *(.rodata.*) |
| 235 | *(.gnu.linkonce.r.*) |
| 236 | *(.rodata1) |
| 237 | __XT_EXCEPTION_TABLE__ = ABSOLUTE(.); |
| 238 | *(.xt_except_table) |
| 239 | *(.gcc_except_table) |
| 240 | *(.gnu.linkonce.e.*) |
| 241 | *(.gnu.version_r) |
| 242 | *(.eh_frame) |
| 243 | /* C++ constructor and destructor tables, properly ordered: */ |
| 244 | KEEP (*crtbegin.o(.ctors)) |
| 245 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
| 246 | KEEP (*(SORT(.ctors.*))) |
| 247 | KEEP (*(.ctors)) |
| 248 | KEEP (*crtbegin.o(.dtors)) |
| 249 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
| 250 | KEEP (*(SORT(.dtors.*))) |
| 251 | KEEP (*(.dtors)) |
| 252 | /* C++ exception handlers table: */ |
| 253 | __XT_EXCEPTION_DESCS__ = ABSOLUTE(.); |
| 254 | *(.xt_except_desc) |
| 255 | *(.gnu.linkonce.h.*) |
| 256 | __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); |
| 257 | *(.xt_except_desc_end) |
| 258 | *(.dynamic) |
| 259 | *(.gnu.version_d) |
| 260 | . = ALIGN(4); /* this table MUST be 4-byte aligned */ |
| 261 | _bss_table_start = ABSOLUTE(.); |
| 262 | LONG(_bss_start) |
| 263 | LONG(_bss_end) |
| 264 | _bss_table_end = ABSOLUTE(.); |
| 265 | _rodata_end = ABSOLUTE(.); |
| 266 | } >dram0_0_seg :dram0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 267 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 268 | .bss ALIGN(8) (NOLOAD) : ALIGN(4) |
| 269 | { |
| 270 | . = ALIGN (8); |
| 271 | _bss_start = ABSOLUTE(.); |
| 272 | *(.dynsbss) |
| 273 | *(.sbss) |
| 274 | *(.sbss.*) |
| 275 | *(.gnu.linkonce.sb.*) |
| 276 | *(.scommon) |
| 277 | *(.sbss2) |
| 278 | *(.sbss2.*) |
| 279 | *(.gnu.linkonce.sb2.*) |
| 280 | *(.dynbss) |
| 281 | *(.bss) |
| 282 | *(.bss.*) |
| 283 | *(.gnu.linkonce.b.*) |
| 284 | *(COMMON) |
| 285 | . = ALIGN (8); |
| 286 | _bss_end = ABSOLUTE(.); |
| 287 | _heap_start = ABSOLUTE(.); |
| 288 | } >dram0_0_seg :dram0_0_bss_phdr |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | /* get ROM code address */ |
| 292 | INCLUDE "eagle.rom.addr.v6.ld" |