1 | /*
|
---|
2 | * Link script for LatticeMico32 programs.
|
---|
3 | *
|
---|
4 | * Redistribution and use in source and binary forms, with or without
|
---|
5 | * modification, are permitted provided that the following conditions
|
---|
6 | * are met:
|
---|
7 | * 1. Redistributions of source code must retain the above copyright
|
---|
8 | * notice, this list of conditions and the following disclaimer.
|
---|
9 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer in the
|
---|
11 | * documentation and/or other materials provided with the distribution.
|
---|
12 | *
|
---|
13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
---|
14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
16 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
---|
17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
23 | * SUCH DAMAGE.
|
---|
24 | */
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | OUTPUT_FORMAT("elf32-lm32")
|
---|
29 | ENTRY(reset)
|
---|
30 |
|
---|
31 | /*
|
---|
32 | * This section defines memory attributes (name, origin, length) for the platform
|
---|
33 | */
|
---|
34 | MEMORY
|
---|
35 | {
|
---|
36 | ebr : ORIGIN = 0x00100000, LENGTH = 32768
|
---|
37 | sram : ORIGIN = 0x00200000, LENGTH = 1048576
|
---|
38 | }
|
---|
39 |
|
---|
40 | SECTIONS
|
---|
41 | {
|
---|
42 |
|
---|
43 | /* code */
|
---|
44 | .boot : { *(.boot) } > ebr
|
---|
45 | .text :
|
---|
46 | {
|
---|
47 | . = ALIGN(4);
|
---|
48 | _ftext = .;
|
---|
49 | *(.text .stub .text.* .gnu.linkonce.t.*)
|
---|
50 | *(.gnu.warning)
|
---|
51 | KEEP (*(.init))
|
---|
52 | KEEP (*(.fini))
|
---|
53 |
|
---|
54 | /* Exception handlers */
|
---|
55 | *(.eh_frame_hdr)
|
---|
56 | KEEP (*(.eh_frame))
|
---|
57 | *(.gcc_except_table)
|
---|
58 |
|
---|
59 | /* Constructors and destructors */
|
---|
60 | KEEP (*crtbegin*.o(.ctors))
|
---|
61 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
|
---|
62 | KEEP (*(SORT(.ctors.*)))
|
---|
63 | KEEP (*(.ctors))
|
---|
64 | KEEP (*crtbegin*.o(.dtors))
|
---|
65 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
|
---|
66 | KEEP (*(SORT(.dtors.*)))
|
---|
67 | KEEP (*(.dtors))
|
---|
68 | KEEP (*(.jcr))
|
---|
69 | _etext = .;
|
---|
70 | } > ebr =0
|
---|
71 |
|
---|
72 | /* read-only data */
|
---|
73 | .rodata :
|
---|
74 | {
|
---|
75 | . = ALIGN(4);
|
---|
76 | _frodata = .;
|
---|
77 | _frodata_rom = LOADADDR(.rodata);
|
---|
78 | *(.rodata .rodata.* .gnu.linkonce.r.*)
|
---|
79 | *(.rodata1)
|
---|
80 | _erodata = .;
|
---|
81 | } > ebr
|
---|
82 |
|
---|
83 | /* read/write data */
|
---|
84 | .data :
|
---|
85 | {
|
---|
86 | . = ALIGN(4);
|
---|
87 | _fdata = .;
|
---|
88 | *(.data .data.* .gnu.linkonce.d.*)
|
---|
89 | *(.data1)
|
---|
90 | SORT(CONSTRUCTORS)
|
---|
91 | _gp = ALIGN(16) + 0x7ff0;
|
---|
92 | *(.sdata .sdata.* .gnu.linkonce.s.*)
|
---|
93 | _edata = .;
|
---|
94 | } > ebr
|
---|
95 |
|
---|
96 | /* bss */
|
---|
97 | .bss :
|
---|
98 | {
|
---|
99 | . = ALIGN(4);
|
---|
100 | _fbss = .;
|
---|
101 | *(.dynsbss)
|
---|
102 | *(.sbss .sbss.* .gnu.linkonce.sb.*)
|
---|
103 | *(.scommon)
|
---|
104 | *(.dynbss)
|
---|
105 | *(.bss .bss.* .gnu.linkonce.b.*)
|
---|
106 | *(COMMON)
|
---|
107 | . = ALIGN(4);
|
---|
108 | _ebss = .;
|
---|
109 | _end = .;
|
---|
110 | PROVIDE (end = .);
|
---|
111 | } > sram
|
---|
112 |
|
---|
113 | /* first location in stack is highest address in ram */
|
---|
114 | PROVIDE(_fstack = ORIGIN(sram) + LENGTH(sram) - 4);
|
---|
115 |
|
---|
116 | /* stabs debugging sections. */
|
---|
117 | .stab 0 : { *(.stab) }
|
---|
118 | .stabstr 0 : { *(.stabstr) }
|
---|
119 | .stab.excl 0 : { *(.stab.excl) }
|
---|
120 | .stab.exclstr 0 : { *(.stab.exclstr) }
|
---|
121 | .stab.index 0 : { *(.stab.index) }
|
---|
122 | .stab.indexstr 0 : { *(.stab.indexstr) }
|
---|
123 | .comment 0 : { *(.comment) }
|
---|
124 |
|
---|
125 | /* DWARF debug sections.
|
---|
126 | Symbols in the DWARF debugging sections are relative to the beginning
|
---|
127 | of the section so we begin them at 0. */
|
---|
128 | /* DWARF 1 */
|
---|
129 | .debug 0 : { *(.debug) }
|
---|
130 | .line 0 : { *(.line) }
|
---|
131 | /* GNU DWARF 1 extensions */
|
---|
132 | .debug_srcinfo 0 : { *(.debug_srcinfo) }
|
---|
133 | .debug_sfnames 0 : { *(.debug_sfnames) }
|
---|
134 | /* DWARF 1.1 and DWARF 2 */
|
---|
135 | .debug_aranges 0 : { *(.debug_aranges) }
|
---|
136 | .debug_pubnames 0 : { *(.debug_pubnames) }
|
---|
137 | /* DWARF 2 */
|
---|
138 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
---|
139 | .debug_abbrev 0 : { *(.debug_abbrev) }
|
---|
140 | .debug_line 0 : { *(.debug_line) }
|
---|
141 | .debug_frame 0 : { *(.debug_frame) }
|
---|
142 | .debug_str 0 : { *(.debug_str) }
|
---|
143 | .debug_loc 0 : { *(.debug_loc) }
|
---|
144 | .debug_macinfo 0 : { *(.debug_macinfo) }
|
---|
145 | /* SGI/MIPS DWARF 2 extensions */
|
---|
146 | .debug_weaknames 0 : { *(.debug_weaknames) }
|
---|
147 | .debug_funcnames 0 : { *(.debug_funcnames) }
|
---|
148 | .debug_typenames 0 : { *(.debug_typenames) }
|
---|
149 | .debug_varnames 0 : { *(.debug_varnames) }
|
---|
150 | }
|
---|
151 |
|
---|