]>
Commit | Line | Data |
---|---|---|
d87bef3a | 1 | # Copyright (C) 2014-2023 Free Software Foundation, Inc. |
6c19b93b | 2 | # |
985743c7 NC |
3 | # Copying and distribution of this file, with or without modification, |
4 | # are permitted in any medium without royalty provided the copyright | |
5 | # notice and this notice are preserved. | |
6 | ||
f4203b2b | 7 | # RODATA_PM_OFFSET |
0804d18a GJL |
8 | # If empty and not HAVE_FLMAP, .rodata sections will be part of .data. |
9 | # This is for devices where it is not possible to use LD* instructions | |
10 | # to read from flash. | |
f4203b2b JL |
11 | # |
12 | # If non-empty, .rodata is not part of .data and the .rodata | |
13 | # objects are assigned addresses at an offest of RODATA_PM_OFFSET. | |
14 | # This is for devices that feature reading from flash by means of | |
15 | # LD* instructions, provided the addresses are offset by | |
16 | # __RODATA_PM_OFFSET__ (which defaults to RODATA_PM_OFFSET). | |
17 | ||
0804d18a GJL |
18 | # HAVE_FLMAP |
19 | # The .rodata section is located in program memory. Devices from | |
20 | # the AVR64* and AVR128* families (from avrxmega2 and avrxmega4) | |
21 | # see a 32k segment of their program memory in their RAM address | |
22 | # space. Which 32k segment is visible is determined by the | |
23 | # bit-field NVMCTRL_CTRLB.FLMAP. | |
24 | # Output section .rodata is placed in MEMORY region rodata. | |
25 | # The LMA of the .rodata section can be set by means of: | |
0804d18a | 26 | # * __RODATA_FLASH_START__ specifies the byte address of the |
a5a863b4 GJL |
27 | # rodata LMA. |
28 | # * __flmap specifies which 32k block is visible in RAM provided | |
29 | # __RODATA_FLASH_START__ is undefined | |
0804d18a GJL |
30 | # * When __flmap and __RODATA_FLASH_START__ are undefined, then an |
31 | # emulation-specific default is used (the last 32k block). | |
32 | ||
33 | # MAYBE_FLMAP | |
34 | # For devices from avrxmega2 and avrxmega4: The user can chose whether | |
35 | # or not .rodata is located in flash (if HAVE_FLMAP) or located in | |
36 | # in RAM (if not HAVE_FLMAP by means of -mrodata-in-ram). This is | |
37 | # achieved by new emulations avrxmega2_flmap and avrxmega4_flmap that | |
38 | # are selected by compiler option -mno-rodata-in-ram. | |
39 | # | |
a5a863b4 GJL |
40 | # In order to facilitate initialization of NVMCTRL_CTRLB.FLMAP and |
41 | # NVMCTRL_CTRLB.FLMAPLOCK in the startup code irrespective of | |
42 | # HAVE_FLMAP, the following symbols are used / defined in order to | |
43 | # communicate with the startup code. | |
0804d18a GJL |
44 | # Notice that the hardware default for FLMAP is the last 32k block, |
45 | # so that explicit initialization of FLMAP is only required when the | |
a5a863b4 | 46 | # user wants to deviate from the defaults. |
0804d18a GJL |
47 | # |
48 | # __flmap = HAVE_FLMAP | |
49 | # ? given by __flmap resp. __RODATA_FLASH_START__ >> 15 | |
50 | # : 0; | |
51 | # | |
a5a863b4 GJL |
52 | # __flmap_value = __flmap << __flmap_bpos; |
53 | # | |
54 | # __flmap_value_with_lock = __flmap__value | __flmap_lock_mask; | |
0804d18a GJL |
55 | # |
56 | # __flmap_init_label = HAVE_FLMAP | |
57 | # ? __flmap_init_start | |
58 | # : __flmap_noinit_start; | |
59 | # Supposed to be used as a jump target for RJMP so that the code | |
60 | # can initialize FLMAP / skip initialization of FLMAP depending | |
61 | # on the chosen emulation, and without the need to support two code | |
a5a863b4 GJL |
62 | # versions of crt<mcu>.o for the two possible emulations. |
63 | # | |
64 | # __flmap_lock is a bool provided by the user when FLMAP should be | |
65 | # protected from any further changes. | |
66 | # | |
67 | # __flmap_lock_mask is an 8-bit mask like NVMCTRL_FLMAPLOCK_bm | |
68 | # provided by the user which is set in __flmap_value_with_lock | |
69 | # when __flmap_lock is on. | |
0804d18a GJL |
70 | # |
71 | # __do_init_flmap = HAVE_FLMAP ? 1 : 0; | |
72 | # Whether or not FLMAP is supposed to be initialized according | |
73 | # to, and for the purpose of, .rodata in flash. | |
74 | # | |
75 | # Apart from that, the compiler (device-specs actually) defines the | |
76 | # following macros: | |
77 | # | |
78 | # __AVR_HAVE_FLMAP__ | |
79 | # Defined if a device has the NVMCTRL_CTRLB.FLMAP bitfield | |
80 | # *AND* if it's unknown at compile-time / assembler-time whether | |
81 | # emulation avrxmega* is used or avrxmega*_flmap. | |
82 | ||
7c8bf1e8 | 83 | cat <<EOF |
d87bef3a | 84 | /* Copyright (C) 2014-2023 Free Software Foundation, Inc. |
985743c7 NC |
85 | |
86 | Copying and distribution of this script, with or without modification, | |
87 | are permitted in any medium without royalty provided the copyright | |
88 | notice and this notice are preserved. */ | |
89 | ||
7c8bf1e8 MM |
90 | OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") |
91 | OUTPUT_ARCH(${ARCH}) | |
2bf2bf23 | 92 | EOF |
7c8bf1e8 | 93 | |
2bf2bf23 | 94 | test -n "${RELOCATING}" && cat <<EOF |
cb072816 | 95 | __TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH; |
fa6895ad | 96 | __DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : $DATA_ORIGIN; |
cb072816 | 97 | __DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH; |
fa6895ad | 98 | |
6490dc67 GJL |
99 | ${EEPROM_LENGTH+__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : $EEPROM_LENGTH;} |
100 | __FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : $FUSE_LENGTH; | |
101 | __LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : $LOCK_LENGTH; | |
102 | __SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : $SIGNATURE_LENGTH; | |
103 | ${USER_SIGNATURE_LENGTH+__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : $USER_SIGNATURE_LENGTH;} | |
104 | ${RODATA_PM_OFFSET+__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : $RODATA_PM_OFFSET;} | |
0804d18a GJL |
105 | ${HAVE_FLMAP+__RODATA_VMA__ = ${RODATA_VMA};} |
106 | ${HAVE_FLMAP+__RODATA_LDS_OFFSET__ = DEFINED(__RODATA_LDS_OFFSET__) ? __RODATA_LDS_OFFSET__ : ${RODATA_LDS_OFFSET};} | |
107 | ${HAVE_FLMAP+__RODATA_REGION_LENGTH__ = DEFINED(__RODATA_REGION_LENGTH__) ? __RODATA_REGION_LENGTH__ : ${RODATA_LENGTH};} | |
108 | ${HAVE_FLMAP+__RODATA_ORIGIN__ = __RODATA_VMA__ + __RODATA_LDS_OFFSET__;} | |
7c8bf1e8 MM |
109 | MEMORY |
110 | { | |
cb072816 | 111 | text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ |
fa6895ad | 112 | data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ |
6490dc67 GJL |
113 | ${EEPROM_LENGTH+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__} |
114 | $FUSE_NAME (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ | |
cb072816 SKS |
115 | lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ |
116 | signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ | |
6490dc67 | 117 | ${USER_SIGNATURE_LENGTH+ user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__} |
0804d18a | 118 | ${HAVE_FLMAP+ rodata (r!x) : ORIGIN = __RODATA_ORIGIN__, LENGTH = __RODATA_REGION_LENGTH__} |
7c8bf1e8 | 119 | } |
2bf2bf23 | 120 | EOF |
7c8bf1e8 | 121 | |
2bf2bf23 | 122 | cat <<EOF |
7c8bf1e8 MM |
123 | SECTIONS |
124 | { | |
125 | /* Read-only sections, merged into text segment: */ | |
126 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
ec2d9b29 AM |
127 | .hash ${RELOCATING-0} : { *(.hash) } |
128 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
129 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
130 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
131 | .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } | |
132 | .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } | |
133 | ||
134 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
135 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
136 | .rel.text ${RELOCATING-0} : | |
7c8bf1e8 MM |
137 | { |
138 | *(.rel.text) | |
139 | ${RELOCATING+*(.rel.text.*)} | |
140 | ${RELOCATING+*(.rel.gnu.linkonce.t*)} | |
141 | } | |
ec2d9b29 | 142 | .rela.text ${RELOCATING-0} : |
7c8bf1e8 MM |
143 | { |
144 | *(.rela.text) | |
145 | ${RELOCATING+*(.rela.text.*)} | |
146 | ${RELOCATING+*(.rela.gnu.linkonce.t*)} | |
147 | } | |
ec2d9b29 AM |
148 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } |
149 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
150 | .rel.rodata ${RELOCATING-0} : | |
7c8bf1e8 MM |
151 | { |
152 | *(.rel.rodata) | |
153 | ${RELOCATING+*(.rel.rodata.*)} | |
154 | ${RELOCATING+*(.rel.gnu.linkonce.r*)} | |
155 | } | |
ec2d9b29 | 156 | .rela.rodata ${RELOCATING-0} : |
7c8bf1e8 MM |
157 | { |
158 | *(.rela.rodata) | |
159 | ${RELOCATING+*(.rela.rodata.*)} | |
160 | ${RELOCATING+*(.rela.gnu.linkonce.r*)} | |
161 | } | |
ec2d9b29 | 162 | .rel.data ${RELOCATING-0} : |
7c8bf1e8 MM |
163 | { |
164 | *(.rel.data) | |
165 | ${RELOCATING+*(.rel.data.*)} | |
166 | ${RELOCATING+*(.rel.gnu.linkonce.d*)} | |
167 | } | |
ec2d9b29 | 168 | .rela.data ${RELOCATING-0} : |
7c8bf1e8 MM |
169 | { |
170 | *(.rela.data) | |
171 | ${RELOCATING+*(.rela.data.*)} | |
172 | ${RELOCATING+*(.rela.gnu.linkonce.d*)} | |
173 | } | |
ec2d9b29 AM |
174 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } |
175 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
176 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
177 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
178 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
179 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
180 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
181 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
182 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
183 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
7c8bf1e8 | 184 | |
28c9d252 | 185 | /* Internal text space or external memory. */ |
ec2d9b29 | 186 | .text ${RELOCATING-0} : |
7c8bf1e8 | 187 | { |
2bf2bf23 | 188 | ${RELOCATING+*(.vectors) |
df406460 | 189 | KEEP(*(.vectors)) |
0c9b4fee | 190 | |
28c9d252 | 191 | /* For data that needs to reside in the lower 64k of progmem. */ |
2bf2bf23 | 192 | *(.progmem.gcc*) |
28c9d252 | 193 | |
861319c9 NC |
194 | /* PR 13812: Placing the trampolines here gives a better chance |
195 | that they will be in range of the code that uses them. */ | |
2bf2bf23 AM |
196 | . = ALIGN(2); |
197 | __trampolines_start = . ; | |
28c9d252 NC |
198 | /* The jump trampolines for the 16-bit limited relocs will reside here. */ |
199 | *(.trampolines) | |
2bf2bf23 AM |
200 | *(.trampolines*) |
201 | __trampolines_end = . ; | |
28c9d252 | 202 | |
1bdc036f | 203 | /* avr-libc expects these data to reside in lower 64K. */ |
2bf2bf23 AM |
204 | *libprintf_flt.a:*(.progmem.data) |
205 | *libc.a:*(.progmem.data) | |
1bdc036f | 206 | |
2bf2bf23 | 207 | *(.progmem.*) |
6c19b93b | 208 | |
2bf2bf23 | 209 | . = ALIGN(2); |
778ee4a6 | 210 | |
28c9d252 NC |
211 | /* For code that needs to reside in the lower 128k progmem. */ |
212 | *(.lowtext) | |
2bf2bf23 | 213 | *(.lowtext*)} |
28c9d252 | 214 | |
0c9b4fee MM |
215 | ${CONSTRUCTING+ __ctors_start = . ; } |
216 | ${CONSTRUCTING+ *(.ctors) } | |
217 | ${CONSTRUCTING+ __ctors_end = . ; } | |
218 | ${CONSTRUCTING+ __dtors_start = . ; } | |
219 | ${CONSTRUCTING+ *(.dtors) } | |
220 | ${CONSTRUCTING+ __dtors_end = . ; } | |
2bf2bf23 | 221 | ${RELOCATING+KEEP(SORT(*)(.ctors)) |
df406460 | 222 | KEEP(SORT(*)(.dtors)) |
0c9b4fee | 223 | |
2bf2bf23 | 224 | /* From this point on, we do not bother about whether the insns are |
28c9d252 | 225 | below or above the 16 bits boundary. */ |
0c9b4fee | 226 | *(.init0) /* Start here after reset. */ |
df406460 | 227 | KEEP (*(.init0)) |
0c9b4fee | 228 | *(.init1) |
df406460 | 229 | KEEP (*(.init1)) |
0c9b4fee | 230 | *(.init2) /* Clear __zero_reg__, set up stack pointer. */ |
df406460 | 231 | KEEP (*(.init2)) |
0c9b4fee | 232 | *(.init3) |
df406460 | 233 | KEEP (*(.init3)) |
0c9b4fee | 234 | *(.init4) /* Initialize data and BSS. */ |
df406460 | 235 | KEEP (*(.init4)) |
0c9b4fee | 236 | *(.init5) |
df406460 | 237 | KEEP (*(.init5)) |
0c9b4fee | 238 | *(.init6) /* C++ constructors. */ |
df406460 | 239 | KEEP (*(.init6)) |
0c9b4fee | 240 | *(.init7) |
df406460 | 241 | KEEP (*(.init7)) |
0c9b4fee | 242 | *(.init8) |
df406460 | 243 | KEEP (*(.init8)) |
0c9b4fee | 244 | *(.init9) /* Call main(). */ |
2bf2bf23 | 245 | KEEP (*(.init9))} |
7c8bf1e8 | 246 | *(.text) |
2bf2bf23 AM |
247 | ${RELOCATING+. = ALIGN(2); |
248 | *(.text.*) | |
249 | . = ALIGN(2); | |
0c9b4fee | 250 | *(.fini9) /* _exit() starts here. */ |
df406460 | 251 | KEEP (*(.fini9)) |
0c9b4fee | 252 | *(.fini8) |
df406460 | 253 | KEEP (*(.fini8)) |
0c9b4fee | 254 | *(.fini7) |
df406460 | 255 | KEEP (*(.fini7)) |
0c9b4fee | 256 | *(.fini6) /* C++ destructors. */ |
df406460 | 257 | KEEP (*(.fini6)) |
0c9b4fee | 258 | *(.fini5) |
df406460 | 259 | KEEP (*(.fini5)) |
0c9b4fee | 260 | *(.fini4) |
df406460 | 261 | KEEP (*(.fini4)) |
0c9b4fee | 262 | *(.fini3) |
df406460 | 263 | KEEP (*(.fini3)) |
0c9b4fee | 264 | *(.fini2) |
df406460 | 265 | KEEP (*(.fini2)) |
0c9b4fee | 266 | *(.fini1) |
df406460 | 267 | KEEP (*(.fini1)) |
0c9b4fee | 268 | *(.fini0) /* Infinite loop after program termination. */ |
df406460 | 269 | KEEP (*(.fini0)) |
4c0b797e GJL |
270 | |
271 | /* For code that needs not to reside in the lower progmem. */ | |
272 | *(.hightext) | |
2bf2bf23 | 273 | *(.hightext*) |
4c0b797e | 274 | |
2bf2bf23 | 275 | *(.progmemx.*) |
f726cc1c | 276 | |
2bf2bf23 | 277 | . = ALIGN(2); |
4c0b797e | 278 | |
2bf2bf23 | 279 | /* For tablejump instruction arrays. We do not relax |
4c0b797e GJL |
280 | JMP / CALL instructions within these sections. */ |
281 | *(.jumptables) | |
2bf2bf23 | 282 | *(.jumptables*) |
4c0b797e | 283 | |
2bf2bf23 | 284 | _etext = . ;} |
7c8bf1e8 | 285 | } ${RELOCATING+ > text} |
f4203b2b JL |
286 | EOF |
287 | ||
288 | # Devices like ATtiny816 allow to read from flash memory by means of LD* | |
289 | # instructions provided we add an offset of __RODATA_PM_OFFSET__ to the | |
290 | # flash addresses. | |
7c8bf1e8 | 291 | |
f4203b2b JL |
292 | if test -n "$RODATA_PM_OFFSET"; then |
293 | cat <<EOF | |
294 | .rodata ${RELOCATING+ ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ } ${RELOCATING-0} : | |
295 | { | |
296 | *(.rodata) | |
2bf2bf23 AM |
297 | ${RELOCATING+ *(.rodata*) |
298 | *(.gnu.linkonce.r*)} | |
f4203b2b JL |
299 | } ${RELOCATING+AT> text} |
300 | EOF | |
301 | fi | |
302 | ||
303 | cat <<EOF | |
5ed365b4 | 304 | .data ${RELOCATING-0} : |
7c8bf1e8 MM |
305 | { |
306 | ${RELOCATING+ PROVIDE (__data_start = .) ; } | |
b4841801 | 307 | *(.data) |
2bf2bf23 AM |
308 | ${RELOCATING+ *(.data*) |
309 | *(.gnu.linkonce.d*)} | |
f4203b2b JL |
310 | EOF |
311 | ||
312 | # Classical devices that don't show flash memory in the SRAM address space | |
313 | # need .rodata to be part of .data because the compiler will use LD* | |
314 | # instructions and LD* cannot access flash. | |
315 | ||
0804d18a | 316 | if test -z "$RODATA_PM_OFFSET" && test -z "${HAVE_FLMAP}" && test -n "${RELOCATING}"; then |
f4203b2b | 317 | cat <<EOF |
df406460 | 318 | *(.rodata) /* We need to include .rodata here if gcc is used */ |
2bf2bf23 | 319 | *(.rodata*) /* with -fdata-sections. */ |
f4203b2b JL |
320 | *(.gnu.linkonce.r*) |
321 | EOF | |
322 | fi | |
323 | ||
324 | cat <<EOF | |
7c8bf1e8 MM |
325 | ${RELOCATING+. = ALIGN(2);} |
326 | ${RELOCATING+ _edata = . ; } | |
0c9b4fee | 327 | ${RELOCATING+ PROVIDE (__data_end = .) ; } |
5ed365b4 | 328 | } ${RELOCATING+ > data ${RELOCATING+AT> text}} |
7c8bf1e8 | 329 | |
b4841801 | 330 | .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))} |
7c8bf1e8 MM |
331 | { |
332 | ${RELOCATING+ PROVIDE (__bss_start = .) ; } | |
333 | *(.bss) | |
865acd35 | 334 | ${RELOCATING+ *(.bss*)} |
2bf2bf23 | 335 | ${RELOCATING+ *(COMMON)} |
7c8bf1e8 | 336 | ${RELOCATING+ PROVIDE (__bss_end = .) ; } |
0c9b4fee MM |
337 | } ${RELOCATING+ > data} |
338 | ||
339 | ${RELOCATING+ __data_load_start = LOADADDR(.data); } | |
340 | ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); } | |
341 | ||
342 | /* Global data not cleared after reset. */ | |
7585b2b8 | 343 | .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0}: ${RELOCATING+ AT (ADDR (.noinit))} |
0c9b4fee MM |
344 | { |
345 | ${RELOCATING+ PROVIDE (__noinit_start = .) ; } | |
2c6f3e56 | 346 | *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*}) |
0c9b4fee | 347 | ${RELOCATING+ PROVIDE (__noinit_end = .) ; } |
7c8bf1e8 | 348 | ${RELOCATING+ _end = . ; } |
0c9b4fee | 349 | ${RELOCATING+ PROVIDE (__heap_start = .) ; } |
7c8bf1e8 | 350 | } ${RELOCATING+ > data} |
6490dc67 GJL |
351 | EOF |
352 | ||
0804d18a GJL |
353 | # Devices like AVR128DA32 and AVR64DA32 see a 32 KiB block of their program |
354 | # memory at 0x8000 (RODATA_LDS_OFFSET). Which portion will be determined by | |
355 | # bitfield NVMCTRL_CTRLB.FLMAP. | |
356 | ||
0804d18a GJL |
357 | if test -z "${HAVE_FLMAP}" && test -n "${RELOCATING}"; then |
358 | cat <<EOF | |
359 | ||
360 | PROVIDE (__flmap_init_label = DEFINED(__flmap_noinit_start) ? __flmap_noinit_start : 0) ; | |
361 | PROVIDE (__flmap = DEFINED(__flmap) ? __flmap : 0) ; | |
0804d18a GJL |
362 | |
363 | EOF | |
364 | fi | |
365 | ||
366 | if test -n "${HAVE_FLMAP}"; then | |
367 | cat <<EOF | |
368 | ||
369 | ${RELOCATING+ | |
370 | PROVIDE (__flmap_init_label = DEFINED(__flmap_init_start) ? __flmap_init_start : 0) ; | |
371 | /* User can specify position of .rodata in flash (LMA) by supplying | |
a5a863b4 GJL |
372 | __RODATA_FLASH_START__ or __flmap, where the former takes precedence. */ |
373 | __RODATA_FLASH_START__ = DEFINED(__RODATA_FLASH_START__) | |
374 | ? __RODATA_FLASH_START__ | |
375 | : DEFINED(__flmap) ? __flmap * 32K : ${RODATA_FLASH_START}; | |
0804d18a | 376 | ASSERT (__RODATA_FLASH_START__ % 32K == 0, \"__RODATA_FLASH_START__ must be a multiple of 32 KiB\") |
a5a863b4 | 377 | __flmap = ${FLMAP_MASK} & (__RODATA_FLASH_START__ >> 15); |
0804d18a GJL |
378 | __RODATA_FLASH_START__ = __flmap << 15; |
379 | __rodata_load_start = MAX (__data_load_end, __RODATA_FLASH_START__); | |
0804d18a GJL |
380 | __rodata_start = __RODATA_ORIGIN__ + __rodata_load_start - __RODATA_FLASH_START__;} |
381 | ||
382 | .rodata ${RELOCATING+ __rodata_start} ${RELOCATING-0} : ${RELOCATING+ AT (__rodata_load_start)} | |
383 | { | |
384 | *(.rodata) | |
385 | ${RELOCATING+ *(.rodata*)} | |
386 | ${RELOCATING+ *(.gnu.linkonce.r*)} | |
387 | ${RELOCATING+ __rodata_end = ABSOLUTE(.) ;} | |
388 | } ${RELOCATING+ > rodata} | |
389 | ||
390 | ${RELOCATING+ __rodata_load_end = __rodata_load_start + __rodata_end - __rodata_start;} | |
391 | ||
392 | EOF | |
393 | fi | |
394 | ||
a5a863b4 GJL |
395 | if test -n "${MAYBE_FLMAP}" && test -n "${RELOCATING}"; then |
396 | cat <<EOF | |
397 | ||
398 | __do_init_flmap = ${HAVE_FLMAP-0}; | |
399 | __flmap_value = __flmap << (DEFINED(__flmap_bpos) ? __flmap_bpos : 4); | |
400 | __flmap_value_with_lock = | |
401 | __flmap_value | (DEFINED(__flmap_lock) && DEFINED(__flmap_lock_mask) | |
402 | ? (__flmap_lock && __do_init_flmap ? __flmap_lock_mask : 0) | |
403 | : 0); | |
404 | ||
405 | EOF | |
406 | fi | |
407 | ||
6490dc67 GJL |
408 | if test -n "${EEPROM_LENGTH}"; then |
409 | cat <<EOF | |
7c8bf1e8 | 410 | |
ec2d9b29 | 411 | .eeprom ${RELOCATING-0}: |
7c8bf1e8 | 412 | { |
b176ded1 NC |
413 | /* See .data above... */ |
414 | KEEP(*(.eeprom*)) | |
7c8bf1e8 MM |
415 | ${RELOCATING+ __eeprom_end = . ; } |
416 | } ${RELOCATING+ > eeprom} | |
6490dc67 GJL |
417 | EOF |
418 | fi | |
419 | ||
420 | if test "$FUSE_NAME" = "fuse" ; then | |
421 | cat <<EOF | |
7c8bf1e8 | 422 | |
ef844a53 EW |
423 | .fuse ${RELOCATING-0}: |
424 | { | |
425 | KEEP(*(.fuse)) | |
2bf2bf23 | 426 | ${RELOCATING+KEEP(*(.lfuse)) |
ef844a53 | 427 | KEEP(*(.hfuse)) |
2bf2bf23 | 428 | KEEP(*(.efuse))} |
ef844a53 | 429 | } ${RELOCATING+ > fuse} |
6490dc67 GJL |
430 | EOF |
431 | fi | |
432 | ||
433 | cat <<EOF | |
ef844a53 EW |
434 | |
435 | .lock ${RELOCATING-0}: | |
436 | { | |
437 | KEEP(*(.lock*)) | |
438 | } ${RELOCATING+ > lock} | |
439 | ||
440 | .signature ${RELOCATING-0}: | |
441 | { | |
442 | KEEP(*(.signature*)) | |
443 | } ${RELOCATING+ > signature} | |
6490dc67 GJL |
444 | EOF |
445 | ||
446 | if test "$FUSE_NAME" = "config" ; then | |
447 | cat <<EOF | |
448 | ||
449 | .config ${RELOCATING-0}: | |
450 | { | |
451 | KEEP(*(.config*)) | |
452 | } ${RELOCATING+ > config} | |
453 | EOF | |
454 | fi | |
455 | ||
6752dd75 | 456 | source_sh $srcdir/scripttempl/misc-sections.sc |
ef844a53 | 457 | |
2d5783fa | 458 | cat <<EOF |
c2e86386 | 459 | .note.gnu.build-id ${RELOCATING-0} : { *(.note.gnu.build-id) } |
ceb0a680 | 460 | EOF |
2a995fc1 | 461 | |
6752dd75 | 462 | source_sh $srcdir/scripttempl/DWARF.sc |
2a995fc1 | 463 | |
ceb0a680 | 464 | cat <<EOF |
7c8bf1e8 MM |
465 | } |
466 | EOF |