update ldscript
[protos/xbee-avr.git] / avr6.x
1 /* Default linker script, for normal executables */
2 OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
3 OUTPUT_ARCH(avr:6)
4 MEMORY
5 {
6   text      (rx)   : ORIGIN = 0, LENGTH = 1024K
7   data      (rw!x) : ORIGIN = 0x800200, LENGTH = 0xfe00
8   eeprom    (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
9   fuse      (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
10   lock      (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
11   signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
12 }
13 SECTIONS
14 {
15   /* Read-only sections, merged into text segment: */
16   .hash          : { *(.hash)           }
17   .dynsym        : { *(.dynsym)         }
18   .dynstr        : { *(.dynstr)         }
19   .gnu.version   : { *(.gnu.version)    }
20   .gnu.version_d   : { *(.gnu.version_d)        }
21   .gnu.version_r   : { *(.gnu.version_r)        }
22   .rel.init      : { *(.rel.init)               }
23   .rela.init     : { *(.rela.init)      }
24   .rel.text      :
25     {
26       *(.rel.text)
27       *(.rel.text.*)
28       *(.rel.gnu.linkonce.t*)
29     }
30   .rela.text     :
31     {
32       *(.rela.text)
33       *(.rela.text.*)
34       *(.rela.gnu.linkonce.t*)
35     }
36   .rel.fini      : { *(.rel.fini)               }
37   .rela.fini     : { *(.rela.fini)      }
38   .rel.rodata    :
39     {
40       *(.rel.rodata)
41       *(.rel.rodata.*)
42       *(.rel.gnu.linkonce.r*)
43     }
44   .rela.rodata   :
45     {
46       *(.rela.rodata)
47       *(.rela.rodata.*)
48       *(.rela.gnu.linkonce.r*)
49     }
50   .rel.data      :
51     {
52       *(.rel.data)
53       *(.rel.data.*)
54       *(.rel.gnu.linkonce.d*)
55     }
56   .rela.data     :
57     {
58       *(.rela.data)
59       *(.rela.data.*)
60       *(.rela.gnu.linkonce.d*)
61     }
62   .rel.ctors     : { *(.rel.ctors)      }
63   .rela.ctors    : { *(.rela.ctors)     }
64   .rel.dtors     : { *(.rel.dtors)      }
65   .rela.dtors    : { *(.rela.dtors)     }
66   .rel.got       : { *(.rel.got)                }
67   .rela.got      : { *(.rela.got)               }
68   .rel.bss       : { *(.rel.bss)                }
69   .rela.bss      : { *(.rela.bss)               }
70   .rel.plt       : { *(.rel.plt)                }
71   .rela.plt      : { *(.rela.plt)               }
72   /* Internal text space or external memory.  */
73   .text :
74   {
75     *(.vectors)
76     KEEP(*(.vectors))
77     . = 256 + ALIGN(256); /* placeholder for misc microb infos */
78     /* For data that needs to reside in the lower 64k of progmem.  */
79     *(.progmem.gcc*)
80     *(.progmem*)
81     . = ALIGN(2048);
82      __trampolines_start = . ;
83     /* The jump trampolines for the 16-bit limited relocs will reside here.  */
84     *(.trampolines)
85     *(.trampolines*)
86      __trampolines_end = . ;
87     /* For future tablejump instruction arrays for 3 byte pc devices.
88        We don't relax jump/call instructions within these sections.  */
89     *(.jumptables)
90     *(.jumptables*)
91     /* For code that needs to reside in the lower 128k progmem.  */
92     *(.lowtext)
93     *(.lowtext*)
94      __ctors_start = . ;
95      *(.ctors)
96      __ctors_end = . ;
97      __dtors_start = . ;
98      *(.dtors)
99      __dtors_end = . ;
100     KEEP(SORT(*)(.ctors))
101     KEEP(SORT(*)(.dtors))
102     /* From this point on, we don't bother about wether the insns are
103        below or above the 16 bits boundary.  */
104     *(.init0)  /* Start here after reset.  */
105     KEEP (*(.init0))
106     *(.init1)
107     KEEP (*(.init1))
108     *(.init2)  /* Clear __zero_reg__, set up stack pointer.  */
109     KEEP (*(.init2))
110     *(.init3)
111     KEEP (*(.init3))
112     *(.init4)  /* Initialize data and BSS.  */
113     KEEP (*(.init4))
114     *(.init5)
115     KEEP (*(.init5))
116     *(.init6)  /* C++ constructors.  */
117     KEEP (*(.init6))
118     *(.init7)
119     KEEP (*(.init7))
120     *(.init8)
121     KEEP (*(.init8))
122     *(.init9)  /* Call main().  */
123     KEEP (*(.init9))
124     *(.text.*) /* trucs de gcc ? */
125     . = ALIGN(2048);
126     /* some libc stuff */
127     strc*(.text)
128     mem*(.text)
129     printf*(.text)
130     vfprintf*(.text)
131     sprintf*(.text)
132     snprintf*(.text)
133     malloc*(.text)
134     free*(.text)
135     fdevopen*(.text)
136     fputc*(.text)
137     . = ALIGN(2048);
138     uart*(.text)
139     parse*(.text)
140     rdline*(.text)
141     vt100*(.text)
142     scheduler*(.text)
143     i2c*(.text)
144     spi*(.text)
145     . = ALIGN(2048);
146     *(.text)
147     . = ALIGN(2);
148     *(.fini9)  /* _exit() starts here.  */
149     KEEP (*(.fini9))
150     *(.fini8)
151     KEEP (*(.fini8))
152     *(.fini7)
153     KEEP (*(.fini7))
154     *(.fini6)  /* C++ destructors.  */
155     KEEP (*(.fini6))
156     *(.fini5)
157     KEEP (*(.fini5))
158     *(.fini4)
159     KEEP (*(.fini4))
160     *(.fini3)
161     KEEP (*(.fini3))
162     *(.fini2)
163     KEEP (*(.fini2))
164     *(.fini1)
165     KEEP (*(.fini1))
166     *(.fini0)  /* Infinite loop after program termination.  */
167     KEEP (*(.fini0))
168      _etext = . ;
169   }  > text
170   .data   : AT (ADDR (.text) + SIZEOF (.text))
171   {
172      PROVIDE (__data_start = .) ;
173     *(.data)
174     *(.data*)
175     *(.rodata)  /* We need to include .rodata here if gcc is used */
176     *(.rodata*) /* with -fdata-sections.  */
177     *(.gnu.linkonce.d*)
178     . = ALIGN(2);
179      _edata = . ;
180      PROVIDE (__data_end = .) ;
181   }  > data
182   .bss  SIZEOF(.data) + ADDR(.data) :
183   {
184      PROVIDE (__bss_start = .) ;
185     *(.bss)
186     *(.bss*)
187     *(COMMON)
188      PROVIDE (__bss_end = .) ;
189   }  > data
190    __data_load_start = LOADADDR(.data);
191    __data_load_end = __data_load_start + SIZEOF(.data);
192   /* Global data not cleared after reset.  */
193   .noinit  SIZEOF(.bss) + ADDR(.bss) :
194   {
195      PROVIDE (__noinit_start = .) ;
196     *(.noinit*)
197      PROVIDE (__noinit_end = .) ;
198      _end = . ;
199      PROVIDE (__heap_start = .) ;
200   }  > data
201   .eeprom  :
202   {
203     *(.eeprom*)
204      __eeprom_end = . ;
205   }  > eeprom
206   .fuse  :
207   {
208     KEEP(*(.fuse))
209     KEEP(*(.lfuse))
210     KEEP(*(.hfuse))
211     KEEP(*(.efuse))
212   }  > fuse
213   .lock  :
214   {
215     KEEP(*(.lock*))
216   }  > lock
217   .signature  :
218   {
219     KEEP(*(.signature*))
220   }  > signature
221   /* Stabs debugging sections.  */
222   .stab 0 : { *(.stab) }
223   .stabstr 0 : { *(.stabstr) }
224   .stab.excl 0 : { *(.stab.excl) }
225   .stab.exclstr 0 : { *(.stab.exclstr) }
226   .stab.index 0 : { *(.stab.index) }
227   .stab.indexstr 0 : { *(.stab.indexstr) }
228   .comment 0 : { *(.comment) }
229   /* DWARF debug sections.
230      Symbols in the DWARF debugging sections are relative to the beginning
231      of the section so we begin them at 0.  */
232   /* DWARF 1 */
233   .debug          0 : { *(.debug) }
234   .line           0 : { *(.line) }
235   /* GNU DWARF 1 extensions */
236   .debug_srcinfo  0 : { *(.debug_srcinfo) }
237   .debug_sfnames  0 : { *(.debug_sfnames) }
238   /* DWARF 1.1 and DWARF 2 */
239   .debug_aranges  0 : { *(.debug_aranges) }
240   .debug_pubnames 0 : { *(.debug_pubnames) }
241   /* DWARF 2 */
242   .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
243   .debug_abbrev   0 : { *(.debug_abbrev) }
244   .debug_line     0 : { *(.debug_line) }
245   .debug_frame    0 : { *(.debug_frame) }
246   .debug_str      0 : { *(.debug_str) }
247   .debug_loc      0 : { *(.debug_loc) }
248   .debug_macinfo  0 : { *(.debug_macinfo) }
249 }