]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * linker script for configurable keymap | |
3 | * | |
4 | * This adds keymap section which places keymap at fixed address and | |
5 | * is based on binutils-avr ldscripts(/usr/lib/ldscripts/avr5.x). | |
6 | */ | |
7 | OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") | |
8 | OUTPUT_ARCH(avr:5) | |
9 | MEMORY | |
10 | { | |
11 | /* With keymap section | |
12 | * | |
13 | * Flash Map of ATMega32U4(32KB) | |
14 | * +------------+ 0x0000 | |
15 | * | .vectors | | |
16 | * | .progmem | | |
17 | * | .init0-9 | > text region | |
18 | * | .text | | |
19 | * | .fini9-0 | | |
20 | * | | | |
21 | * |------------| _etext | |
22 | * | .data | | |
23 | * | .bss | > data region | |
24 | * | .noinit | | |
25 | * | | | |
26 | * |------------| 0x6800 | |
27 | * | .keymap | > keymap region(2KB) | |
28 | * |------------| 0x7000 | |
29 | * | bootloader | 4KB | |
30 | * +------------+ 0x7FFF | |
31 | */ | |
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 | |
39 | } | |
40 | SECTIONS | |
41 | { | |
42 | /* Read-only sections, merged into text segment: */ | |
43 | .hash : { *(.hash) } | |
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) } | |
51 | .rel.text : | |
52 | { | |
53 | *(.rel.text) | |
54 | *(.rel.text.*) | |
55 | *(.rel.gnu.linkonce.t*) | |
56 | } | |
57 | .rela.text : | |
58 | { | |
59 | *(.rela.text) | |
60 | *(.rela.text.*) | |
61 | *(.rela.gnu.linkonce.t*) | |
62 | } | |
63 | .rel.fini : { *(.rel.fini) } | |
64 | .rela.fini : { *(.rela.fini) } | |
65 | .rel.rodata : | |
66 | { | |
67 | *(.rel.rodata) | |
68 | *(.rel.rodata.*) | |
69 | *(.rel.gnu.linkonce.r*) | |
70 | } | |
71 | .rela.rodata : | |
72 | { | |
73 | *(.rela.rodata) | |
74 | *(.rela.rodata.*) | |
75 | *(.rela.gnu.linkonce.r*) | |
76 | } | |
77 | .rel.data : | |
78 | { | |
79 | *(.rel.data) | |
80 | *(.rel.data.*) | |
81 | *(.rel.gnu.linkonce.d*) | |
82 | } | |
83 | .rela.data : | |
84 | { | |
85 | *(.rela.data) | |
86 | *(.rela.data.*) | |
87 | *(.rela.gnu.linkonce.d*) | |
88 | } | |
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. */ | |
100 | .text : | |
101 | { | |
102 | *(.vectors) | |
103 | KEEP(*(.vectors)) | |
104 | /* For data that needs to reside in the lower 64k of progmem. */ | |
105 | *(.progmem.gcc*) | |
106 | *(.progmem*) | |
107 | . = ALIGN(2); | |
108 | __trampolines_start = . ; | |
109 | /* The jump trampolines for the 16-bit limited relocs will reside here. */ | |
110 | *(.trampolines) | |
111 | *(.trampolines*) | |
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. */ | |
115 | *(.jumptables) | |
116 | *(.jumptables*) | |
117 | /* For code that needs to reside in the lower 128k progmem. */ | |
118 | *(.lowtext) | |
119 | *(.lowtext*) | |
120 | __ctors_start = . ; | |
121 | *(.ctors) | |
122 | __ctors_end = . ; | |
123 | __dtors_start = . ; | |
124 | *(.dtors) | |
125 | __dtors_end = . ; | |
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. */ | |
131 | KEEP (*(.init0)) | |
132 | *(.init1) | |
133 | KEEP (*(.init1)) | |
134 | *(.init2) /* Clear __zero_reg__, set up stack pointer. */ | |
135 | KEEP (*(.init2)) | |
136 | *(.init3) | |
137 | KEEP (*(.init3)) | |
138 | *(.init4) /* Initialize data and BSS. */ | |
139 | KEEP (*(.init4)) | |
140 | *(.init5) | |
141 | KEEP (*(.init5)) | |
142 | *(.init6) /* C++ constructors. */ | |
143 | KEEP (*(.init6)) | |
144 | *(.init7) | |
145 | KEEP (*(.init7)) | |
146 | *(.init8) | |
147 | KEEP (*(.init8)) | |
148 | *(.init9) /* Call main(). */ | |
149 | KEEP (*(.init9)) | |
150 | *(.text) | |
151 | . = ALIGN(2); | |
152 | *(.text.*) | |
153 | . = ALIGN(2); | |
154 | *(.fini9) /* _exit() starts here. */ | |
155 | KEEP (*(.fini9)) | |
156 | *(.fini8) | |
157 | KEEP (*(.fini8)) | |
158 | *(.fini7) | |
159 | KEEP (*(.fini7)) | |
160 | *(.fini6) /* C++ destructors. */ | |
161 | KEEP (*(.fini6)) | |
162 | *(.fini5) | |
163 | KEEP (*(.fini5)) | |
164 | *(.fini4) | |
165 | KEEP (*(.fini4)) | |
166 | *(.fini3) | |
167 | KEEP (*(.fini3)) | |
168 | *(.fini2) | |
169 | KEEP (*(.fini2)) | |
170 | *(.fini1) | |
171 | KEEP (*(.fini1)) | |
172 | *(.fini0) /* Infinite loop after program termination. */ | |
173 | KEEP (*(.fini0)) | |
174 | _etext = . ; | |
175 | } > text | |
176 | .data : AT (ADDR (.text) + SIZEOF (.text)) | |
177 | { | |
178 | PROVIDE (__data_start = .) ; | |
179 | *(.data) | |
180 | *(.data*) | |
181 | *(.rodata) /* We need to include .rodata here if gcc is used */ | |
182 | *(.rodata*) /* with -fdata-sections. */ | |
183 | *(.gnu.linkonce.d*) | |
184 | . = ALIGN(2); | |
185 | _edata = . ; | |
186 | PROVIDE (__data_end = .) ; | |
187 | } > data | |
188 | .bss : AT (ADDR (.bss)) | |
189 | { | |
190 | PROVIDE (__bss_start = .) ; | |
191 | *(.bss) | |
192 | *(.bss*) | |
193 | *(COMMON) | |
194 | PROVIDE (__bss_end = .) ; | |
195 | } > data | |
196 | __data_load_start = LOADADDR(.data); | |
197 | __data_load_end = __data_load_start + SIZEOF(.data); | |
198 | /* Global data not cleared after reset. */ | |
199 | .noinit : | |
200 | { | |
201 | PROVIDE (__noinit_start = .) ; | |
202 | *(.noinit*) | |
203 | PROVIDE (__noinit_end = .) ; | |
204 | _end = . ; | |
205 | PROVIDE (__heap_start = .) ; | |
206 | } > data | |
207 | /* keymap region is located at end of flash | |
208 | * .fn_actions Fn actions definitions | |
209 | * .keymaps Mapping layers | |
210 | */ | |
211 | .keymap : | |
212 | { | |
213 | PROVIDE(__keymap_start = .) ; | |
214 | *(.keymap.fn_actions) /* 32*actions = 64bytes */ | |
215 | . = ALIGN(0x40); | |
216 | *(.keymap.keymaps) /* rest of .keymap section */ | |
217 | *(.keymap*) | |
218 | /* . = ALIGN(0x800); */ /* keymap section takes 2KB- */ | |
219 | } > keymap = 0x00 /* zero fill */ | |
220 | .eeprom : | |
221 | { | |
222 | *(.eeprom*) | |
223 | __eeprom_end = . ; | |
224 | } > eeprom | |
225 | .fuse : | |
226 | { | |
227 | KEEP(*(.fuse)) | |
228 | KEEP(*(.lfuse)) | |
229 | KEEP(*(.hfuse)) | |
230 | KEEP(*(.efuse)) | |
231 | } > fuse | |
232 | .lock : | |
233 | { | |
234 | KEEP(*(.lock*)) | |
235 | } > lock | |
236 | .signature : | |
237 | { | |
238 | KEEP(*(.signature*)) | |
239 | } > signature | |
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. */ | |
251 | /* DWARF 1 */ | |
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) } | |
260 | /* DWARF 2 */ | |
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) } | |
268 | } |