]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - tmk_core/ldscript_keymap_avr51.x
Add my keymap
[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   /* With keymap section
18    *
19    * TODO: should be as below
20    * Flash Map of AT90USB(128KB)
21    * +------------+ 0x0000
22    * | .vectors   |
23    * | .progmem   |
24    * | .init0-9   | > text region
25    * | .text      |
26    * | .fini9-0   |
27    * |            |
28    * |------------| _etext
29    * | .data      |
30    * | .bss       | > data region
31    * | .noinit    |
32    * |            |
33    * |------------| 0x1D800
34    * | .keymap    | > keymap region(2KB)
35    * |------------| 0x1E000
36    * | bootloader | 8KB
37    * +------------+ 0x1FFFF
38    *
39    * FIXME: Use this To fit to ATMega32U4 unimap address
40    * Flash Map of AT90USB(128KB)
41    * +------------+ 0x0000
42    * | .vectors   |
43    * | .progmem   |
44    * | .init0-9   | > text region
45    * | .text      |
46    * | .fini9-0   |
47    * |            |
48    * |------------| _etext
49    * | .data      |
50    * | .bss       | > data region
51    * | .noinit    |
52    * |            |
53    * |------------| 0x6800
54    * | .keymap    | > keymap region(2KB)
55    * |------------| 0x7000
56    * ~            ~
57    * ~            ~
58    * |------------| 0x1E000
59    * | bootloader | 8KB
60    * +------------+ 0x1FFFF
61    */
62   text   (rx)   : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
63   keymap (rw!x) : ORIGIN = 0x6800, LENGTH = 2K
64   data   (rw!x) : ORIGIN = 0x800100, LENGTH = __DATA_REGION_LENGTH__
65   eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
66   fuse      (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
67   lock      (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
68   signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
69   user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__
70 }
71 SECTIONS
72 {
73   /* Read-only sections, merged into text segment: */
74   .hash          : { *(.hash)           }
75   .dynsym        : { *(.dynsym)         }
76   .dynstr        : { *(.dynstr)         }
77   .gnu.version   : { *(.gnu.version)    }
78   .gnu.version_d   : { *(.gnu.version_d)        }
79   .gnu.version_r   : { *(.gnu.version_r)        }
80   .rel.init      : { *(.rel.init)               }
81   .rela.init     : { *(.rela.init)      }
82   .rel.text      :
83     {
84       *(.rel.text)
85       *(.rel.text.*)
86       *(.rel.gnu.linkonce.t*)
87     }
88   .rela.text     :
89     {
90       *(.rela.text)
91       *(.rela.text.*)
92       *(.rela.gnu.linkonce.t*)
93     }
94   .rel.fini      : { *(.rel.fini)               }
95   .rela.fini     : { *(.rela.fini)      }
96   .rel.rodata    :
97     {
98       *(.rel.rodata)
99       *(.rel.rodata.*)
100       *(.rel.gnu.linkonce.r*)
101     }
102   .rela.rodata   :
103     {
104       *(.rela.rodata)
105       *(.rela.rodata.*)
106       *(.rela.gnu.linkonce.r*)
107     }
108   .rel.data      :
109     {
110       *(.rel.data)
111       *(.rel.data.*)
112       *(.rel.gnu.linkonce.d*)
113     }
114   .rela.data     :
115     {
116       *(.rela.data)
117       *(.rela.data.*)
118       *(.rela.gnu.linkonce.d*)
119     }
120   .rel.ctors     : { *(.rel.ctors)      }
121   .rela.ctors    : { *(.rela.ctors)     }
122   .rel.dtors     : { *(.rel.dtors)      }
123   .rela.dtors    : { *(.rela.dtors)     }
124   .rel.got       : { *(.rel.got)                }
125   .rela.got      : { *(.rela.got)               }
126   .rel.bss       : { *(.rel.bss)                }
127   .rela.bss      : { *(.rela.bss)               }
128   .rel.plt       : { *(.rel.plt)                }
129   .rela.plt      : { *(.rela.plt)               }
130   /* Internal text space or external memory.  */
131   .text   :
132   {
133     *(.vectors)
134     KEEP(*(.vectors))
135     /* For data that needs to reside in the lower 64k of progmem.  */
136      *(.progmem.gcc*)
137     /* PR 13812: Placing the trampolines here gives a better chance
138        that they will be in range of the code that uses them.  */
139     . = ALIGN(2);
140      __trampolines_start = . ;
141     /* The jump trampolines for the 16-bit limited relocs will reside here.  */
142     *(.trampolines)
143      *(.trampolines*)
144      __trampolines_end = . ;
145     /* avr-libc expects these data to reside in lower 64K. */
146      *libprintf_flt.a:*(.progmem.data)
147      *libc.a:*(.progmem.data)
148      *(.progmem*)
149     . = ALIGN(2);
150     /* For future tablejump instruction arrays for 3 byte pc devices.
151        We don't relax jump/call instructions within these sections.  */
152     *(.jumptables)
153      *(.jumptables*)
154     /* For code that needs to reside in the lower 128k progmem.  */
155     *(.lowtext)
156      *(.lowtext*)
157      __ctors_start = . ;
158      *(.ctors)
159      __ctors_end = . ;
160      __dtors_start = . ;
161      *(.dtors)
162      __dtors_end = . ;
163     KEEP(SORT(*)(.ctors))
164     KEEP(SORT(*)(.dtors))
165     /* From this point on, we don't bother about wether the insns are
166        below or above the 16 bits boundary.  */
167     *(.init0)  /* Start here after reset.  */
168     KEEP (*(.init0))
169     *(.init1)
170     KEEP (*(.init1))
171     *(.init2)  /* Clear __zero_reg__, set up stack pointer.  */
172     KEEP (*(.init2))
173     *(.init3)
174     KEEP (*(.init3))
175     *(.init4)  /* Initialize data and BSS.  */
176     KEEP (*(.init4))
177     *(.init5)
178     KEEP (*(.init5))
179     *(.init6)  /* C++ constructors.  */
180     KEEP (*(.init6))
181     *(.init7)
182     KEEP (*(.init7))
183     *(.init8)
184     KEEP (*(.init8))
185     *(.init9)  /* Call main().  */
186     KEEP (*(.init9))
187     *(.text)
188     . = ALIGN(2);
189      *(.text.*)
190     . = ALIGN(2);
191     *(.fini9)  /* _exit() starts here.  */
192     KEEP (*(.fini9))
193     *(.fini8)
194     KEEP (*(.fini8))
195     *(.fini7)
196     KEEP (*(.fini7))
197     *(.fini6)  /* C++ destructors.  */
198     KEEP (*(.fini6))
199     *(.fini5)
200     KEEP (*(.fini5))
201     *(.fini4)
202     KEEP (*(.fini4))
203     *(.fini3)
204     KEEP (*(.fini3))
205     *(.fini2)
206     KEEP (*(.fini2))
207     *(.fini1)
208     KEEP (*(.fini1))
209     *(.fini0)  /* Infinite loop after program termination.  */
210     KEEP (*(.fini0))
211      _etext = . ;
212   }  > text
213   .data          :
214   {
215      PROVIDE (__data_start = .) ;
216     *(.data)
217      *(.data*)
218     *(.gnu.linkonce.d*)
219     *(.rodata)  /* We need to include .rodata here if gcc is used */
220      *(.rodata*) /* with -fdata-sections.  */
221     *(.gnu.linkonce.r*)
222     . = ALIGN(2);
223      _edata = . ;
224      PROVIDE (__data_end = .) ;
225   }  > data AT> text
226   .bss  ADDR(.data) + SIZEOF (.data)   : AT (ADDR (.bss))
227   {
228      PROVIDE (__bss_start = .) ;
229     *(.bss)
230      *(.bss*)
231     *(COMMON)
232      PROVIDE (__bss_end = .) ;
233   }  > data
234    __data_load_start = LOADADDR(.data);
235    __data_load_end = __data_load_start + SIZEOF(.data);
236   /* Global data not cleared after reset.  */
237   .noinit  ADDR(.bss) + SIZEOF (.bss)  :  AT (ADDR (.noinit))
238   {
239      PROVIDE (__noinit_start = .) ;
240     *(.noinit*)
241      PROVIDE (__noinit_end = .) ;
242      _end = . ;
243      PROVIDE (__heap_start = .) ;
244   }  > data
245   /* keymap region is located at end of flash
246    * .fn_actions        Fn actions definitions
247    * .keymaps           Mapping layers
248    */
249   .keymap :
250   {
251     PROVIDE(__keymap_start = .) ;
252     *(.keymap.fn_actions)   /* 32*actions = 64bytes */
253     . = ALIGN(0x40);
254     *(.keymap.keymaps)      /* rest of .keymap section */
255     *(.keymap*)
256     /* . = ALIGN(0x800); */ /* keymap section takes 2KB- */
257   } > keymap = 0x00         /* zero fill */
258   .eeprom  :
259   {
260     /* See .data above...  */
261     KEEP(*(.eeprom*))
262      __eeprom_end = . ;
263   }  > eeprom
264   .fuse  :
265   {
266     KEEP(*(.fuse))
267     KEEP(*(.lfuse))
268     KEEP(*(.hfuse))
269     KEEP(*(.efuse))
270   }  > fuse
271   .lock  :
272   {
273     KEEP(*(.lock*))
274   }  > lock
275   .signature  :
276   {
277     KEEP(*(.signature*))
278   }  > signature
279   .user_signatures  :
280   {
281     KEEP(*(.user_signatures*))
282   }  > user_signatures
283   /* Stabs debugging sections.  */
284   .stab 0 : { *(.stab) }
285   .stabstr 0 : { *(.stabstr) }
286   .stab.excl 0 : { *(.stab.excl) }
287   .stab.exclstr 0 : { *(.stab.exclstr) }
288   .stab.index 0 : { *(.stab.index) }
289   .stab.indexstr 0 : { *(.stab.indexstr) }
290   .comment 0 : { *(.comment) }
291   .note.gnu.build-id : { *(.note.gnu.build-id) }
292   /* DWARF debug sections.
293      Symbols in the DWARF debugging sections are relative to the beginning
294      of the section so we begin them at 0.  */
295   /* DWARF 1 */
296   .debug          0 : { *(.debug) }
297   .line           0 : { *(.line) }
298   /* GNU DWARF 1 extensions */
299   .debug_srcinfo  0 : { *(.debug_srcinfo) }
300   .debug_sfnames  0 : { *(.debug_sfnames) }
301   /* DWARF 1.1 and DWARF 2 */
302   .debug_aranges  0 : { *(.debug_aranges) }
303   .debug_pubnames 0 : { *(.debug_pubnames) }
304   /* DWARF 2 */
305   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
306   .debug_abbrev   0 : { *(.debug_abbrev) }
307   .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
308   .debug_frame    0 : { *(.debug_frame) }
309   .debug_str      0 : { *(.debug_str) }
310   .debug_loc      0 : { *(.debug_loc) }
311   .debug_macinfo  0 : { *(.debug_macinfo) }
312   /* SGI/MIPS DWARF 2 extensions */
313   .debug_weaknames 0 : { *(.debug_weaknames) }
314   .debug_funcnames 0 : { *(.debug_funcnames) }
315   .debug_typenames 0 : { *(.debug_typenames) }
316   .debug_varnames  0 : { *(.debug_varnames) }
317   /* DWARF 3 */
318   .debug_pubtypes 0 : { *(.debug_pubtypes) }
319   .debug_ranges   0 : { *(.debug_ranges) }
320   /* DWARF Extension.  */
321   .debug_macro    0 : { *(.debug_macro) }
322 }