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 |
| 8 | irom0_0_seg : org = 0x40210000, len = 0x40000 |
| 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) |
| 24 | |
| 25 | PROVIDE(_memmap_vecbase_reset = 0x40000000); |
| 26 | |
| 27 | /* Various memory-map dependent cache attribute settings: */ |
| 28 | _memmap_cacheattr_wb_base = 0x00000110; |
| 29 | _memmap_cacheattr_wt_base = 0x00000110; |
| 30 | _memmap_cacheattr_bp_base = 0x00000220; |
| 31 | _memmap_cacheattr_unused_mask = 0xFFFFF00F; |
| 32 | _memmap_cacheattr_wb_trapnull = 0x2222211F; |
| 33 | _memmap_cacheattr_wba_trapnull = 0x2222211F; |
| 34 | _memmap_cacheattr_wbna_trapnull = 0x2222211F; |
| 35 | _memmap_cacheattr_wt_trapnull = 0x2222211F; |
| 36 | _memmap_cacheattr_bp_trapnull = 0x2222222F; |
| 37 | _memmap_cacheattr_wb_strict = 0xFFFFF11F; |
| 38 | _memmap_cacheattr_wt_strict = 0xFFFFF11F; |
| 39 | _memmap_cacheattr_bp_strict = 0xFFFFF22F; |
| 40 | _memmap_cacheattr_wb_allvalid = 0x22222112; |
| 41 | _memmap_cacheattr_wt_allvalid = 0x22222112; |
| 42 | _memmap_cacheattr_bp_allvalid = 0x22222222; |
| 43 | PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull); |
| 44 | |
| 45 | SECTIONS |
| 46 | { |
| 47 | |
| 48 | .dport0.rodata : ALIGN(4) |
| 49 | { |
| 50 | _dport0_rodata_start = ABSOLUTE(.); |
| 51 | *(.dport0.rodata) |
| 52 | *(.dport.rodata) |
| 53 | _dport0_rodata_end = ABSOLUTE(.); |
| 54 | } >dport0_0_seg :dport0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 55 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 56 | .dport0.literal : ALIGN(4) |
| 57 | { |
| 58 | _dport0_literal_start = ABSOLUTE(.); |
| 59 | *(.dport0.literal) |
| 60 | *(.dport.literal) |
| 61 | _dport0_literal_end = ABSOLUTE(.); |
| 62 | } >dport0_0_seg :dport0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 63 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 64 | .dport0.data : ALIGN(4) |
| 65 | { |
| 66 | _dport0_data_start = ABSOLUTE(.); |
| 67 | *(.dport0.data) |
| 68 | *(.dport.data) |
| 69 | _dport0_data_end = ABSOLUTE(.); |
| 70 | } >dport0_0_seg :dport0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 71 | |
| 72 | .irom0.text : ALIGN(4) |
| 73 | { |
| 74 | _irom0_text_start = ABSOLUTE(.); |
| 75 | *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) |
Damien George | e636279 | 2014-11-29 14:36:18 +0000 | [diff] [blame^] | 76 | |
| 77 | /* we put some specific text in this section */ |
| 78 | *py/*.o*(.literal* .text*) |
| 79 | *pyexec.o(.literal*, .text*) |
| 80 | *readline.o(.literal*, .text*) |
| 81 | *pybstdio.o(.literal*, .text*) |
| 82 | *modpyb.o(.literal*, .text*) |
| 83 | *gccollect.o(.literal* .text*) |
| 84 | *gchelper.o(.literal* .text*) |
| 85 | |
| 86 | /* we put as much rodata as possible in this section */ |
| 87 | /* note that only rodata accessed as a machine word is allowed here */ |
| 88 | *py/qstr.o(.rodata.const_pool) |
| 89 | *py/*.o(.rodata.mp_type_*) /* catches type: mp_obj_type_t */ |
| 90 | *py/*.o(.rodata.*_locals_dict*) /* catches types: mp_obj_dict_t, mp_map_elem_t */ |
| 91 | *py/*.o(.rodata.mp_module_*) /* catches types: mp_obj_module_t, mp_obj_dict_t, mp_map_elem_t */ |
| 92 | |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 93 | _irom0_text_end = ABSOLUTE(.); |
| 94 | } >irom0_0_seg :irom0_0_phdr |
| 95 | |
| 96 | .text : ALIGN(4) |
| 97 | { |
| 98 | _stext = .; |
| 99 | _text_start = ABSOLUTE(.); |
| 100 | *(.entry.text) |
| 101 | *(.init.literal) |
| 102 | *(.init) |
| 103 | *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) |
| 104 | *(.fini.literal) |
| 105 | *(.fini) |
| 106 | *(.gnu.version) |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 107 | _text_end = ABSOLUTE(.); |
| 108 | _etext = .; |
| 109 | } >iram1_0_seg :iram1_0_phdr |
| 110 | |
| 111 | .lit4 : ALIGN(4) |
| 112 | { |
| 113 | _lit4_start = ABSOLUTE(.); |
| 114 | *(*.lit4) |
| 115 | *(.lit4.*) |
| 116 | *(.gnu.linkonce.lit4.*) |
| 117 | _lit4_end = ABSOLUTE(.); |
| 118 | } >iram1_0_seg :iram1_0_phdr |
| 119 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 120 | .data : ALIGN(4) |
| 121 | { |
| 122 | _data_start = ABSOLUTE(.); |
| 123 | *(.data) |
| 124 | *(.data.*) |
| 125 | *(.gnu.linkonce.d.*) |
| 126 | *(.data1) |
| 127 | *(.sdata) |
| 128 | *(.sdata.*) |
| 129 | *(.gnu.linkonce.s.*) |
| 130 | *(.sdata2) |
| 131 | *(.sdata2.*) |
| 132 | *(.gnu.linkonce.s2.*) |
| 133 | *(.jcr) |
| 134 | _data_end = ABSOLUTE(.); |
| 135 | } >dram0_0_seg :dram0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 136 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 137 | .rodata : ALIGN(4) |
| 138 | { |
| 139 | _rodata_start = ABSOLUTE(.); |
| 140 | *(.rodata) |
| 141 | *(.rodata.*) |
| 142 | *(.gnu.linkonce.r.*) |
| 143 | *(.rodata1) |
| 144 | __XT_EXCEPTION_TABLE__ = ABSOLUTE(.); |
| 145 | *(.xt_except_table) |
| 146 | *(.gcc_except_table) |
| 147 | *(.gnu.linkonce.e.*) |
| 148 | *(.gnu.version_r) |
| 149 | *(.eh_frame) |
| 150 | /* C++ constructor and destructor tables, properly ordered: */ |
| 151 | KEEP (*crtbegin.o(.ctors)) |
| 152 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
| 153 | KEEP (*(SORT(.ctors.*))) |
| 154 | KEEP (*(.ctors)) |
| 155 | KEEP (*crtbegin.o(.dtors)) |
| 156 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
| 157 | KEEP (*(SORT(.dtors.*))) |
| 158 | KEEP (*(.dtors)) |
| 159 | /* C++ exception handlers table: */ |
| 160 | __XT_EXCEPTION_DESCS__ = ABSOLUTE(.); |
| 161 | *(.xt_except_desc) |
| 162 | *(.gnu.linkonce.h.*) |
| 163 | __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); |
| 164 | *(.xt_except_desc_end) |
| 165 | *(.dynamic) |
| 166 | *(.gnu.version_d) |
| 167 | . = ALIGN(4); /* this table MUST be 4-byte aligned */ |
| 168 | _bss_table_start = ABSOLUTE(.); |
| 169 | LONG(_bss_start) |
| 170 | LONG(_bss_end) |
| 171 | _bss_table_end = ABSOLUTE(.); |
| 172 | _rodata_end = ABSOLUTE(.); |
| 173 | } >dram0_0_seg :dram0_0_phdr |
Damien George | fbea810 | 2014-11-28 14:58:25 +0000 | [diff] [blame] | 174 | |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 175 | .bss ALIGN(8) (NOLOAD) : ALIGN(4) |
| 176 | { |
| 177 | . = ALIGN (8); |
| 178 | _bss_start = ABSOLUTE(.); |
| 179 | *(.dynsbss) |
| 180 | *(.sbss) |
| 181 | *(.sbss.*) |
| 182 | *(.gnu.linkonce.sb.*) |
| 183 | *(.scommon) |
| 184 | *(.sbss2) |
| 185 | *(.sbss2.*) |
| 186 | *(.gnu.linkonce.sb2.*) |
| 187 | *(.dynbss) |
| 188 | *(.bss) |
| 189 | *(.bss.*) |
| 190 | *(.gnu.linkonce.b.*) |
| 191 | *(COMMON) |
| 192 | . = ALIGN (8); |
| 193 | _bss_end = ABSOLUTE(.); |
| 194 | _heap_start = ABSOLUTE(.); |
| 195 | } >dram0_0_seg :dram0_0_bss_phdr |
Damien George | 075d597 | 2014-11-27 20:30:33 +0000 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | /* get ROM code address */ |
| 199 | INCLUDE "eagle.rom.addr.v6.ld" |