1 # Copyright (C) 2014-2019 Free Software Foundation, Inc.
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.
7 # Using an empty script for ld -r is better than mashing together
8 # sections. This hack likely leaves ld -Ur broken.
9 test -n "${RELOCATING}" || exit 0
11 /* Copyright (C) 2014-2019 Free Software Foundation, Inc.
13 Copying and distribution of this script, with or without modification,
14 are permitted in any medium without royalty provided the copyright
15 notice and this notice are preserved. */
17 OUTPUT_FORMAT("elf32-ip2k", "elf32-ip2k", "elf32-ip2k")
19 ${RELOCATING+ENTRY(_start)}
22 /* IP2022 default linker script. */
26 D_GPR : org = 0x01000080, len = 128
27 D_RAM : org = 0x01000100, len = 4K - 256
28 P_RAM : org = 0x02000000, len = 16K
29 P_ROM : org = 0x02010000, len = 64K - 32
30 P_RESET : org = 0x0201FFE0, len = 32
31 P_CONFIG : org = 0x02020000, len = 128
36 /* Allocated memory end markers
37 (initialized to start of appropriate memory address). */
38 __data_end = 0x01000100;
39 __pram_end = 0x02000000;
40 __flash_end = 0x02010000;
42 /* Global general purpose registers in direct addressing range. */
48 /* Pre-allocated, pre-initialized data memory. */
49 __data_run_begin = __data_end;
50 __data_load_begin = (__flash_end + 1) & 0xFFFFFFFE;
51 .data __data_run_begin : AT (__data_load_begin)
56 __data_run_end = __data_run_begin + SIZEOF(.data);
57 __data_load_end = __data_load_begin + SIZEOF(.data);
58 __data_end = __data_run_end;
59 __flash_end = __data_load_end;
61 /* Pre-allocated, uninitialized data memory. */
62 __bss_begin = __data_end;
67 __bss_end = __bss_begin + SIZEOF(.bss);
68 __data_end = __bss_end;
70 /* Pre-allocated PRAM data memory. */
71 __pram_data_begin = (__pram_end + 1) & 0xFFFFFFFE;
72 .pram_data __pram_data_begin :
76 __pram_data_end = __pram_data_begin + SIZEOF(.pram_data);
77 __pram_end = __pram_data_end;
80 __pram_run_begin = (__pram_end + 1) & 0xFFFFFFFE;
81 __pram_load_begin = (__flash_end + 1) & 0xFFFFFFFE;
82 .pram __pram_run_begin : AT (__pram_load_begin)
86 __pram_run_end = __pram_run_begin + SIZEOF(.pram);
87 __pram_load_end = __pram_load_begin + SIZEOF(.pram);
89 __pram_load_shift = ((__pram_run_begin - __pram_load_begin) & 0x1FFFF) | 0x02000000;
90 __pram_end = __pram_run_end;
91 __flash_end = __pram_load_end;
93 /* PRAM overlay code. */
94 __pram_overlay_run_start = (__pram_end + 1) & 0xFFFFFFFE;
95 __pram_overlay_load_start = (__flash_end + 1) & 0xFFFFFFFE;
96 OVERLAY __pram_overlay_run_start : AT (__pram_overlay_load_start)
98 .pram1 { */overlay1/* (.pram); * (.pram1) }
99 .pram2 { */overlay2/* (.pram); * (.pram2) }
101 __pram_overlay_run_end = .;
102 __pram_overlay_load_end = __pram_overlay_load_start + SIZEOF(.pram1) + SIZEOF(.pram2);
103 __pram_end = __pram_overlay_run_end;
104 __flash_end = __pram_overlay_load_end;
107 __text_begin = (__flash_end + 1) & 0xFFFFFFFE;
113 __text_end = __text_begin + SIZEOF(.text);
114 __flash_end = __text_end;
117 __strings_begin = (__flash_end + 1) & 0xFFFFFFFE;
118 .strings __strings_begin :
123 __strings_end = __strings_begin + SIZEOF (.strings);
124 __flash_end = __strings_end;
126 .ctors : { * (.ctors) } > P_ROM
127 .dtors : { * (.dtors) } > P_ROM
130 .reset : { * (.reset) } >P_RESET = 0xffff
132 /* Configuration block. */
133 .config : { * (.config) } >P_CONFIG = 0xffff
136 PROVIDE (__stack = 0x01000FFF);
138 /* Stabs debugging sections. */
139 .stab 0 : { *(.stab) }
140 .stabstr 0 : { *(.stabstr) }
141 .stab.excl 0 : { *(.stab.excl) }
142 .stab.exclstr 0 : { *(.stab.exclstr) }
143 .stab.index 0 : { *(.stab.index) }
144 .stab.indexstr 0 : { *(.stab.indexstr) }
145 .comment 0 : { *(.comment) }
149 . $srcdir/scripttempl/DWARF.sc