1 # Copyright (C) 2014 Free Software Foundation, Inc. 2 # 3 # Copying and distribution of this file, with or without modification, 4 # are permitted in any medium without royalty provided the copyright 5 # notice and this notice are preserved. 6 7 cat << EOF 8 /* Copyright (C) 2014 Free Software Foundation, Inc. 9 10 Copying and distribution of this script, with or without modification, 11 are permitted in any medium without royalty provided the copyright 12 notice and this notice are preserved. */ 13 14 OUTPUT_FORMAT("elf32-ip2k", "elf32-ip2k", "elf32-ip2k") 15 OUTPUT_ARCH(ip2k) 16 ${RELOCATING+ENTRY(_start)} 17 SEARCH_DIR(.); 18 19 /* IP2022 default linker script. */ 20 21 MEMORY 22 { 23 D_GPR : org = 0x01000080, len = 128 24 D_RAM : org = 0x01000100, len = 4K - 256 25 P_RAM : org = 0x02000000, len = 16K 26 P_ROM : org = 0x02010000, len = 64K - 32 27 P_RESET : org = 0x0201FFE0, len = 32 28 P_CONFIG : org = 0x02020000, len = 128 29 } 30 31 SECTIONS 32 { 33 /* Allocated memory end markers 34 (initialized to start of appropiate memory address). */ 35 __data_end = 0x01000100; 36 __pram_end = 0x02000000; 37 __flash_end = 0x02010000; 38 39 /* Global general purpose registers in direct addressing range. */ 40 .gpr 0x01000080 : 41 { 42 *(.gpr) 43 } >D_GPR 44 45 /* Pre-allocated, pre-initialized data memory. */ 46 __data_run_begin = __data_end; 47 __data_load_begin = (__flash_end + 1) & 0xFFFFFFFE; 48 .data __data_run_begin : AT (__data_load_begin) 49 { 50 * (.data); 51 * (.rodata) 52 } >D_RAM 53 __data_run_end = __data_run_begin + SIZEOF(.data); 54 __data_load_end = __data_load_begin + SIZEOF(.data); 55 __data_end = __data_run_end; 56 __flash_end = __data_load_end; 57 58 /* Pre-allocated, uninitialized data memory. */ 59 __bss_begin = __data_end; 60 .bss __bss_begin : 61 { 62 * (.bss) 63 } >D_RAM 64 __bss_end = __bss_begin + SIZEOF(.bss); 65 __data_end = __bss_end; 66 67 /* Pre-allocated PRAM data memory. */ 68 __pram_data_begin = (__pram_end + 1) & 0xFFFFFFFE; 69 .pram_data __pram_data_begin : 70 { 71 * (.pram_data) 72 } >P_RAM 73 __pram_data_end = __pram_data_begin + SIZEOF(.pram_data); 74 __pram_end = __pram_data_end; 75 76 /* PRAM code. */ 77 __pram_run_begin = (__pram_end + 1) & 0xFFFFFFFE; 78 __pram_load_begin = (__flash_end + 1) & 0xFFFFFFFE; 79 .pram __pram_run_begin : AT (__pram_load_begin) 80 { 81 * (.pram) 82 } >P_RAM 83 __pram_run_end = __pram_run_begin + SIZEOF(.pram); 84 __pram_load_end = __pram_load_begin + SIZEOF(.pram); 85 86 __pram_load_shift = ((__pram_run_begin - __pram_load_begin) & 0x1FFFF) | 0x02000000; 87 __pram_end = __pram_run_end; 88 __flash_end = __pram_load_end; 89 90 /* PRAM overlay code. */ 91 __pram_overlay_run_start = (__pram_end + 1) & 0xFFFFFFFE; 92 __pram_overlay_load_start = (__flash_end + 1) & 0xFFFFFFFE; 93 OVERLAY __pram_overlay_run_start : AT (__pram_overlay_load_start) 94 { 95 .pram1 { */overlay1/* (.pram); * (.pram1) } 96 .pram2 { */overlay2/* (.pram); * (.pram2) } 97 } >P_RAM 98 __pram_overlay_run_end = .; 99 __pram_overlay_load_end = __pram_overlay_load_start + SIZEOF(.pram1) + SIZEOF(.pram2); 100 __pram_end = __pram_overlay_run_end; 101 __flash_end = __pram_overlay_load_end; 102 103 /* Flash code. */ 104 __text_begin = (__flash_end + 1) & 0xFFFFFFFE; 105 .text __text_begin : 106 { 107 * (.text); 108 * (.text.libgcc) 109 } >P_ROM = 0xffff 110 __text_end = __text_begin + SIZEOF(.text); 111 __flash_end = __text_end; 112 113 /* Strings. */ 114 __strings_begin = (__flash_end + 1) & 0xFFFFFFFE; 115 .strings __strings_begin : 116 { 117 * (strings); 118 * (.progmem.data) 119 } >P_ROM = 0xffff 120 __strings_end = __strings_begin + SIZEOF (.strings); 121 __flash_end = __strings_end; 122 123 .ctors : { * (.ctors) } > P_ROM 124 .dtors : { * (.dtors) } > P_ROM 125 126 /* Reset code. */ 127 .reset : { * (.reset) } >P_RESET = 0xffff 128 129 /* Configuration block. */ 130 .config : { * (.config) } >P_CONFIG = 0xffff 131 132 /* Stack. */ 133 PROVIDE (__stack = 0x01000FFF); 134 135 /* Stabs debugging sections. */ 136 .stab 0 : { *(.stab) } 137 .stabstr 0 : { *(.stabstr) } 138 .stab.excl 0 : { *(.stab.excl) } 139 .stab.exclstr 0 : { *(.stab.exclstr) } 140 .stab.index 0 : { *(.stab.index) } 141 .stab.indexstr 0 : { *(.stab.indexstr) } 142 .comment 0 : { *(.comment) } 143 144 EOF 145 146 . $srcdir/scripttempl/DWARF.sc 147 148 cat <<EOF 149 } 150 EOF 151