2 * linker script for configurable keymap
4 * This adds keymap section which places keymap at fixed address and
5 * is based on binutils-avr ldscripts(/usr/lib/ldscripts/avr5.x).
7 OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
11 /* With keymap section
13 * Flash Map of ATMega32U4(32KB)
14 * +------------+ 0x0000
17 * | .init0-9 | > text region
21 * |------------| _etext
23 * | .bss | > data region
26 * |------------| 0x6800
27 * | .keymap | > keymap region(2KB)
28 * |------------| 0x7000
30 * +------------+ 0x7FFF
32 text (rx) : ORIGIN = 0, LENGTH = 128K
33 keymap (rw!x) : ORIGIN = 0x6800, LENGTH = 2K
34 data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
35 eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
36 fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
37 lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
38 signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
42 /* Read-only sections, merged into text segment: */
44 .dynsym : { *(.dynsym) }
45 .dynstr : { *(.dynstr) }
46 .gnu.version : { *(.gnu.version) }
47 .gnu.version_d : { *(.gnu.version_d) }
48 .gnu.version_r : { *(.gnu.version_r) }
49 .rel.init : { *(.rel.init) }
50 .rela.init : { *(.rela.init) }
55 *(.rel.gnu.linkonce.t*)
61 *(.rela.gnu.linkonce.t*)
63 .rel.fini : { *(.rel.fini) }
64 .rela.fini : { *(.rela.fini) }
69 *(.rel.gnu.linkonce.r*)
75 *(.rela.gnu.linkonce.r*)
81 *(.rel.gnu.linkonce.d*)
87 *(.rela.gnu.linkonce.d*)
89 .rel.ctors : { *(.rel.ctors) }
90 .rela.ctors : { *(.rela.ctors) }
91 .rel.dtors : { *(.rel.dtors) }
92 .rela.dtors : { *(.rela.dtors) }
93 .rel.got : { *(.rel.got) }
94 .rela.got : { *(.rela.got) }
95 .rel.bss : { *(.rel.bss) }
96 .rela.bss : { *(.rela.bss) }
97 .rel.plt : { *(.rel.plt) }
98 .rela.plt : { *(.rela.plt) }
99 /* Internal text space or external memory. */
104 /* For data that needs to reside in the lower 64k of progmem. */
108 __trampolines_start = . ;
109 /* The jump trampolines for the 16-bit limited relocs will reside here. */
112 __trampolines_end = . ;
113 /* For future tablejump instruction arrays for 3 byte pc devices.
114 We don't relax jump/call instructions within these sections. */
117 /* For code that needs to reside in the lower 128k progmem. */
126 KEEP(SORT(*)(.ctors))
127 KEEP(SORT(*)(.dtors))
128 /* From this point on, we don't bother about wether the insns are
129 below or above the 16 bits boundary. */
130 *(.init0) /* Start here after reset. */
134 *(.init2) /* Clear __zero_reg__, set up stack pointer. */
138 *(.init4) /* Initialize data and BSS. */
142 *(.init6) /* C++ constructors. */
148 *(.init9) /* Call main(). */
154 *(.fini9) /* _exit() starts here. */
160 *(.fini6) /* C++ destructors. */
172 *(.fini0) /* Infinite loop after program termination. */
176 .data : AT (ADDR (.text) + SIZEOF (.text))
178 PROVIDE (__data_start = .) ;
181 *(.rodata) /* We need to include .rodata here if gcc is used */
182 *(.rodata*) /* with -fdata-sections. */
186 PROVIDE (__data_end = .) ;
188 .bss : AT (ADDR (.bss))
190 PROVIDE (__bss_start = .) ;
194 PROVIDE (__bss_end = .) ;
196 __data_load_start = LOADADDR(.data);
197 __data_load_end = __data_load_start + SIZEOF(.data);
198 /* Global data not cleared after reset. */
201 PROVIDE (__noinit_start = .) ;
203 PROVIDE (__noinit_end = .) ;
205 PROVIDE (__heap_start = .) ;
207 /* keymap region is located at end of flash
208 * .fn_actions Fn actions definitions
209 * .keymaps Mapping layers
213 PROVIDE(__keymap_start = .) ;
214 *(.keymap.fn_actions) /* 32*actions = 64bytes */
216 *(.keymap.keymaps) /* rest of .keymap section */
218 /* . = ALIGN(0x800); */ /* keymap section takes 2KB- */
219 } > keymap = 0x00 /* zero fill */
240 /* Stabs debugging sections. */
241 .stab 0 : { *(.stab) }
242 .stabstr 0 : { *(.stabstr) }
243 .stab.excl 0 : { *(.stab.excl) }
244 .stab.exclstr 0 : { *(.stab.exclstr) }
245 .stab.index 0 : { *(.stab.index) }
246 .stab.indexstr 0 : { *(.stab.indexstr) }
247 .comment 0 : { *(.comment) }
248 /* DWARF debug sections.
249 Symbols in the DWARF debugging sections are relative to the beginning
250 of the section so we begin them at 0. */
252 .debug 0 : { *(.debug) }
253 .line 0 : { *(.line) }
254 /* GNU DWARF 1 extensions */
255 .debug_srcinfo 0 : { *(.debug_srcinfo) }
256 .debug_sfnames 0 : { *(.debug_sfnames) }
257 /* DWARF 1.1 and DWARF 2 */
258 .debug_aranges 0 : { *(.debug_aranges) }
259 .debug_pubnames 0 : { *(.debug_pubnames) }
261 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
262 .debug_abbrev 0 : { *(.debug_abbrev) }
263 .debug_line 0 : { *(.debug_line) }
264 .debug_frame 0 : { *(.debug_frame) }
265 .debug_str 0 : { *(.debug_str) }
266 .debug_loc 0 : { *(.debug_loc) }
267 .debug_macinfo 0 : { *(.debug_macinfo) }