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