]>
Commit | Line | Data |
---|---|---|
fd67aa11 | 1 | # Copyright (C) 2014-2024 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 |
fd67aa11 | 84 | /* Copyright (C) 2014-2024 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 |
d51cd0f6 | 95 | __TEXT_REGION_ORIGIN__ = DEFINED(__TEXT_REGION_ORIGIN__) ? __TEXT_REGION_ORIGIN__ : 0; |
cb072816 | 96 | __TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH; |
fa6895ad | 97 | __DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : $DATA_ORIGIN; |
cb072816 | 98 | __DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH; |
fa6895ad | 99 | |
6490dc67 GJL |
100 | ${EEPROM_LENGTH+__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : $EEPROM_LENGTH;} |
101 | __FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : $FUSE_LENGTH; | |
102 | __LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : $LOCK_LENGTH; | |
103 | __SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : $SIGNATURE_LENGTH; | |
104 | ${USER_SIGNATURE_LENGTH+__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : $USER_SIGNATURE_LENGTH;} | |
105 | ${RODATA_PM_OFFSET+__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : $RODATA_PM_OFFSET;} | |
0804d18a GJL |
106 | ${HAVE_FLMAP+__RODATA_VMA__ = ${RODATA_VMA};} |
107 | ${HAVE_FLMAP+__RODATA_LDS_OFFSET__ = DEFINED(__RODATA_LDS_OFFSET__) ? __RODATA_LDS_OFFSET__ : ${RODATA_LDS_OFFSET};} | |
108 | ${HAVE_FLMAP+__RODATA_REGION_LENGTH__ = DEFINED(__RODATA_REGION_LENGTH__) ? __RODATA_REGION_LENGTH__ : ${RODATA_LENGTH};} | |
109 | ${HAVE_FLMAP+__RODATA_ORIGIN__ = __RODATA_VMA__ + __RODATA_LDS_OFFSET__;} | |
7c8bf1e8 MM |
110 | MEMORY |
111 | { | |
d51cd0f6 | 112 | text (rx) : ORIGIN = __TEXT_REGION_ORIGIN__, LENGTH = __TEXT_REGION_LENGTH__ |
fa6895ad | 113 | data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ |
6490dc67 GJL |
114 | ${EEPROM_LENGTH+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__} |
115 | $FUSE_NAME (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ | |
cb072816 SKS |
116 | lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ |
117 | signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__ | |
6490dc67 | 118 | ${USER_SIGNATURE_LENGTH+ user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__} |
0804d18a | 119 | ${HAVE_FLMAP+ rodata (r!x) : ORIGIN = __RODATA_ORIGIN__, LENGTH = __RODATA_REGION_LENGTH__} |
7c8bf1e8 | 120 | } |
2bf2bf23 | 121 | EOF |
7c8bf1e8 | 122 | |
2bf2bf23 | 123 | cat <<EOF |
7c8bf1e8 MM |
124 | SECTIONS |
125 | { | |
126 | /* Read-only sections, merged into text segment: */ | |
127 | ${TEXT_DYNAMIC+${DYNAMIC}} | |
ec2d9b29 AM |
128 | .hash ${RELOCATING-0} : { *(.hash) } |
129 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
130 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
131 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } | |
132 | .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } | |
133 | .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } | |
134 | ||
135 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
136 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
137 | .rel.text ${RELOCATING-0} : | |
7c8bf1e8 MM |
138 | { |
139 | *(.rel.text) | |
140 | ${RELOCATING+*(.rel.text.*)} | |
141 | ${RELOCATING+*(.rel.gnu.linkonce.t*)} | |
142 | } | |
ec2d9b29 | 143 | .rela.text ${RELOCATING-0} : |
7c8bf1e8 MM |
144 | { |
145 | *(.rela.text) | |
146 | ${RELOCATING+*(.rela.text.*)} | |
147 | ${RELOCATING+*(.rela.gnu.linkonce.t*)} | |
148 | } | |
ec2d9b29 AM |
149 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } |
150 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
151 | .rel.rodata ${RELOCATING-0} : | |
7c8bf1e8 MM |
152 | { |
153 | *(.rel.rodata) | |
154 | ${RELOCATING+*(.rel.rodata.*)} | |
155 | ${RELOCATING+*(.rel.gnu.linkonce.r*)} | |
156 | } | |
ec2d9b29 | 157 | .rela.rodata ${RELOCATING-0} : |
7c8bf1e8 MM |
158 | { |
159 | *(.rela.rodata) | |
160 | ${RELOCATING+*(.rela.rodata.*)} | |
161 | ${RELOCATING+*(.rela.gnu.linkonce.r*)} | |
162 | } | |
ec2d9b29 | 163 | .rel.data ${RELOCATING-0} : |
7c8bf1e8 MM |
164 | { |
165 | *(.rel.data) | |
166 | ${RELOCATING+*(.rel.data.*)} | |
167 | ${RELOCATING+*(.rel.gnu.linkonce.d*)} | |
168 | } | |
ec2d9b29 | 169 | .rela.data ${RELOCATING-0} : |
7c8bf1e8 MM |
170 | { |
171 | *(.rela.data) | |
172 | ${RELOCATING+*(.rela.data.*)} | |
173 | ${RELOCATING+*(.rela.gnu.linkonce.d*)} | |
174 | } | |
ec2d9b29 AM |
175 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } |
176 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
177 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
178 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
179 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
180 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
181 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
182 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
183 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
184 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
7c8bf1e8 | 185 | |
28c9d252 | 186 | /* Internal text space or external memory. */ |
ec2d9b29 | 187 | .text ${RELOCATING-0} : |
7c8bf1e8 | 188 | { |
2bf2bf23 | 189 | ${RELOCATING+*(.vectors) |
df406460 | 190 | KEEP(*(.vectors)) |
0c9b4fee | 191 | |
28c9d252 | 192 | /* For data that needs to reside in the lower 64k of progmem. */ |
2bf2bf23 | 193 | *(.progmem.gcc*) |
28c9d252 | 194 | |
861319c9 NC |
195 | /* PR 13812: Placing the trampolines here gives a better chance |
196 | that they will be in range of the code that uses them. */ | |
2bf2bf23 AM |
197 | . = ALIGN(2); |
198 | __trampolines_start = . ; | |
28c9d252 NC |
199 | /* The jump trampolines for the 16-bit limited relocs will reside here. */ |
200 | *(.trampolines) | |
2bf2bf23 AM |
201 | *(.trampolines*) |
202 | __trampolines_end = . ; | |
28c9d252 | 203 | |
1bdc036f | 204 | /* avr-libc expects these data to reside in lower 64K. */ |
2bf2bf23 AM |
205 | *libprintf_flt.a:*(.progmem.data) |
206 | *libc.a:*(.progmem.data) | |
1bdc036f | 207 | |
2bf2bf23 | 208 | *(.progmem.*) |
6c19b93b | 209 | |
2bf2bf23 | 210 | . = ALIGN(2); |
778ee4a6 | 211 | |
28c9d252 NC |
212 | /* For code that needs to reside in the lower 128k progmem. */ |
213 | *(.lowtext) | |
2bf2bf23 | 214 | *(.lowtext*)} |
28c9d252 | 215 | |
0c9b4fee MM |
216 | ${CONSTRUCTING+ __ctors_start = . ; } |
217 | ${CONSTRUCTING+ *(.ctors) } | |
218 | ${CONSTRUCTING+ __ctors_end = . ; } | |
219 | ${CONSTRUCTING+ __dtors_start = . ; } | |
220 | ${CONSTRUCTING+ *(.dtors) } | |
221 | ${CONSTRUCTING+ __dtors_end = . ; } | |
2bf2bf23 | 222 | ${RELOCATING+KEEP(SORT(*)(.ctors)) |
df406460 | 223 | KEEP(SORT(*)(.dtors)) |
0c9b4fee | 224 | |
2bf2bf23 | 225 | /* From this point on, we do not bother about whether the insns are |
28c9d252 | 226 | below or above the 16 bits boundary. */ |
0c9b4fee | 227 | *(.init0) /* Start here after reset. */ |
df406460 | 228 | KEEP (*(.init0)) |
0c9b4fee | 229 | *(.init1) |
df406460 | 230 | KEEP (*(.init1)) |
0c9b4fee | 231 | *(.init2) /* Clear __zero_reg__, set up stack pointer. */ |
df406460 | 232 | KEEP (*(.init2)) |
0c9b4fee | 233 | *(.init3) |
df406460 | 234 | KEEP (*(.init3)) |
0c9b4fee | 235 | *(.init4) /* Initialize data and BSS. */ |
df406460 | 236 | KEEP (*(.init4)) |
0c9b4fee | 237 | *(.init5) |
df406460 | 238 | KEEP (*(.init5)) |
0c9b4fee | 239 | *(.init6) /* C++ constructors. */ |
df406460 | 240 | KEEP (*(.init6)) |
0c9b4fee | 241 | *(.init7) |
df406460 | 242 | KEEP (*(.init7)) |
0c9b4fee | 243 | *(.init8) |
df406460 | 244 | KEEP (*(.init8)) |
0c9b4fee | 245 | *(.init9) /* Call main(). */ |
2bf2bf23 | 246 | KEEP (*(.init9))} |
7c8bf1e8 | 247 | *(.text) |
2bf2bf23 AM |
248 | ${RELOCATING+. = ALIGN(2); |
249 | *(.text.*) | |
250 | . = ALIGN(2); | |
0c9b4fee | 251 | *(.fini9) /* _exit() starts here. */ |
df406460 | 252 | KEEP (*(.fini9)) |
0c9b4fee | 253 | *(.fini8) |
df406460 | 254 | KEEP (*(.fini8)) |
0c9b4fee | 255 | *(.fini7) |
df406460 | 256 | KEEP (*(.fini7)) |
0c9b4fee | 257 | *(.fini6) /* C++ destructors. */ |
df406460 | 258 | KEEP (*(.fini6)) |
0c9b4fee | 259 | *(.fini5) |
df406460 | 260 | KEEP (*(.fini5)) |
0c9b4fee | 261 | *(.fini4) |
df406460 | 262 | KEEP (*(.fini4)) |
0c9b4fee | 263 | *(.fini3) |
df406460 | 264 | KEEP (*(.fini3)) |
0c9b4fee | 265 | *(.fini2) |
df406460 | 266 | KEEP (*(.fini2)) |
0c9b4fee | 267 | *(.fini1) |
df406460 | 268 | KEEP (*(.fini1)) |
0c9b4fee | 269 | *(.fini0) /* Infinite loop after program termination. */ |
df406460 | 270 | KEEP (*(.fini0)) |
4c0b797e GJL |
271 | |
272 | /* For code that needs not to reside in the lower progmem. */ | |
273 | *(.hightext) | |
2bf2bf23 | 274 | *(.hightext*) |
4c0b797e | 275 | |
2bf2bf23 | 276 | *(.progmemx.*) |
f726cc1c | 277 | |
2bf2bf23 | 278 | . = ALIGN(2); |
4c0b797e | 279 | |
2bf2bf23 | 280 | /* For tablejump instruction arrays. We do not relax |
4c0b797e GJL |
281 | JMP / CALL instructions within these sections. */ |
282 | *(.jumptables) | |
2bf2bf23 | 283 | *(.jumptables*) |
4c0b797e | 284 | |
2bf2bf23 | 285 | _etext = . ;} |
7c8bf1e8 | 286 | } ${RELOCATING+ > text} |
f4203b2b JL |
287 | EOF |
288 | ||
289 | # Devices like ATtiny816 allow to read from flash memory by means of LD* | |
290 | # instructions provided we add an offset of __RODATA_PM_OFFSET__ to the | |
291 | # flash addresses. | |
7c8bf1e8 | 292 | |
f4203b2b JL |
293 | if test -n "$RODATA_PM_OFFSET"; then |
294 | cat <<EOF | |
295 | .rodata ${RELOCATING+ ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ } ${RELOCATING-0} : | |
296 | { | |
297 | *(.rodata) | |
2bf2bf23 AM |
298 | ${RELOCATING+ *(.rodata*) |
299 | *(.gnu.linkonce.r*)} | |
f4203b2b JL |
300 | } ${RELOCATING+AT> text} |
301 | EOF | |
302 | fi | |
303 | ||
304 | cat <<EOF | |
5ed365b4 | 305 | .data ${RELOCATING-0} : |
7c8bf1e8 MM |
306 | { |
307 | ${RELOCATING+ PROVIDE (__data_start = .) ; } | |
b4841801 | 308 | *(.data) |
2bf2bf23 AM |
309 | ${RELOCATING+ *(.data*) |
310 | *(.gnu.linkonce.d*)} | |
f4203b2b JL |
311 | EOF |
312 | ||
313 | # Classical devices that don't show flash memory in the SRAM address space | |
314 | # need .rodata to be part of .data because the compiler will use LD* | |
315 | # instructions and LD* cannot access flash. | |
316 | ||
0804d18a | 317 | if test -z "$RODATA_PM_OFFSET" && test -z "${HAVE_FLMAP}" && test -n "${RELOCATING}"; then |
f4203b2b | 318 | cat <<EOF |
df406460 | 319 | *(.rodata) /* We need to include .rodata here if gcc is used */ |
2bf2bf23 | 320 | *(.rodata*) /* with -fdata-sections. */ |
f4203b2b JL |
321 | *(.gnu.linkonce.r*) |
322 | EOF | |
323 | fi | |
324 | ||
325 | cat <<EOF | |
7c8bf1e8 MM |
326 | ${RELOCATING+. = ALIGN(2);} |
327 | ${RELOCATING+ _edata = . ; } | |
0c9b4fee | 328 | ${RELOCATING+ PROVIDE (__data_end = .) ; } |
5ed365b4 | 329 | } ${RELOCATING+ > data ${RELOCATING+AT> text}} |
7c8bf1e8 | 330 | |
b4841801 | 331 | .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))} |
7c8bf1e8 MM |
332 | { |
333 | ${RELOCATING+ PROVIDE (__bss_start = .) ; } | |
334 | *(.bss) | |
865acd35 | 335 | ${RELOCATING+ *(.bss*)} |
2bf2bf23 | 336 | ${RELOCATING+ *(COMMON)} |
7c8bf1e8 | 337 | ${RELOCATING+ PROVIDE (__bss_end = .) ; } |
0c9b4fee MM |
338 | } ${RELOCATING+ > data} |
339 | ||
340 | ${RELOCATING+ __data_load_start = LOADADDR(.data); } | |
341 | ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); } | |
342 | ||
343 | /* Global data not cleared after reset. */ | |
7585b2b8 | 344 | .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0}: ${RELOCATING+ AT (ADDR (.noinit))} |
0c9b4fee MM |
345 | { |
346 | ${RELOCATING+ PROVIDE (__noinit_start = .) ; } | |
2c6f3e56 | 347 | *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*}) |
0c9b4fee | 348 | ${RELOCATING+ PROVIDE (__noinit_end = .) ; } |
7c8bf1e8 | 349 | ${RELOCATING+ _end = . ; } |
0c9b4fee | 350 | ${RELOCATING+ PROVIDE (__heap_start = .) ; } |
7c8bf1e8 | 351 | } ${RELOCATING+ > data} |
6490dc67 GJL |
352 | EOF |
353 | ||
0804d18a GJL |
354 | # Devices like AVR128DA32 and AVR64DA32 see a 32 KiB block of their program |
355 | # memory at 0x8000 (RODATA_LDS_OFFSET). Which portion will be determined by | |
356 | # bitfield NVMCTRL_CTRLB.FLMAP. | |
357 | ||
0804d18a GJL |
358 | if test -z "${HAVE_FLMAP}" && test -n "${RELOCATING}"; then |
359 | cat <<EOF | |
360 | ||
361 | PROVIDE (__flmap_init_label = DEFINED(__flmap_noinit_start) ? __flmap_noinit_start : 0) ; | |
362 | PROVIDE (__flmap = DEFINED(__flmap) ? __flmap : 0) ; | |
0804d18a GJL |
363 | |
364 | EOF | |
365 | fi | |
366 | ||
367 | if test -n "${HAVE_FLMAP}"; then | |
368 | cat <<EOF | |
369 | ||
370 | ${RELOCATING+ | |
371 | PROVIDE (__flmap_init_label = DEFINED(__flmap_init_start) ? __flmap_init_start : 0) ; | |
372 | /* User can specify position of .rodata in flash (LMA) by supplying | |
a5a863b4 GJL |
373 | __RODATA_FLASH_START__ or __flmap, where the former takes precedence. */ |
374 | __RODATA_FLASH_START__ = DEFINED(__RODATA_FLASH_START__) | |
375 | ? __RODATA_FLASH_START__ | |
376 | : DEFINED(__flmap) ? __flmap * 32K : ${RODATA_FLASH_START}; | |
0804d18a | 377 | ASSERT (__RODATA_FLASH_START__ % 32K == 0, \"__RODATA_FLASH_START__ must be a multiple of 32 KiB\") |
a5a863b4 | 378 | __flmap = ${FLMAP_MASK} & (__RODATA_FLASH_START__ >> 15); |
0804d18a GJL |
379 | __RODATA_FLASH_START__ = __flmap << 15; |
380 | __rodata_load_start = MAX (__data_load_end, __RODATA_FLASH_START__); | |
0804d18a GJL |
381 | __rodata_start = __RODATA_ORIGIN__ + __rodata_load_start - __RODATA_FLASH_START__;} |
382 | ||
383 | .rodata ${RELOCATING+ __rodata_start} ${RELOCATING-0} : ${RELOCATING+ AT (__rodata_load_start)} | |
384 | { | |
385 | *(.rodata) | |
386 | ${RELOCATING+ *(.rodata*)} | |
387 | ${RELOCATING+ *(.gnu.linkonce.r*)} | |
388 | ${RELOCATING+ __rodata_end = ABSOLUTE(.) ;} | |
389 | } ${RELOCATING+ > rodata} | |
390 | ||
391 | ${RELOCATING+ __rodata_load_end = __rodata_load_start + __rodata_end - __rodata_start;} | |
392 | ||
393 | EOF | |
394 | fi | |
395 | ||
a5a863b4 GJL |
396 | if test -n "${MAYBE_FLMAP}" && test -n "${RELOCATING}"; then |
397 | cat <<EOF | |
398 | ||
399 | __do_init_flmap = ${HAVE_FLMAP-0}; | |
400 | __flmap_value = __flmap << (DEFINED(__flmap_bpos) ? __flmap_bpos : 4); | |
401 | __flmap_value_with_lock = | |
402 | __flmap_value | (DEFINED(__flmap_lock) && DEFINED(__flmap_lock_mask) | |
403 | ? (__flmap_lock && __do_init_flmap ? __flmap_lock_mask : 0) | |
404 | : 0); | |
405 | ||
406 | EOF | |
407 | fi | |
408 | ||
6490dc67 GJL |
409 | if test -n "${EEPROM_LENGTH}"; then |
410 | cat <<EOF | |
7c8bf1e8 | 411 | |
ec2d9b29 | 412 | .eeprom ${RELOCATING-0}: |
7c8bf1e8 | 413 | { |
b176ded1 NC |
414 | /* See .data above... */ |
415 | KEEP(*(.eeprom*)) | |
7c8bf1e8 MM |
416 | ${RELOCATING+ __eeprom_end = . ; } |
417 | } ${RELOCATING+ > eeprom} | |
6490dc67 GJL |
418 | EOF |
419 | fi | |
420 | ||
421 | if test "$FUSE_NAME" = "fuse" ; then | |
422 | cat <<EOF | |
7c8bf1e8 | 423 | |
ef844a53 EW |
424 | .fuse ${RELOCATING-0}: |
425 | { | |
426 | KEEP(*(.fuse)) | |
2bf2bf23 | 427 | ${RELOCATING+KEEP(*(.lfuse)) |
ef844a53 | 428 | KEEP(*(.hfuse)) |
2bf2bf23 | 429 | KEEP(*(.efuse))} |
ef844a53 | 430 | } ${RELOCATING+ > fuse} |
6490dc67 GJL |
431 | EOF |
432 | fi | |
433 | ||
434 | cat <<EOF | |
ef844a53 EW |
435 | |
436 | .lock ${RELOCATING-0}: | |
437 | { | |
438 | KEEP(*(.lock*)) | |
439 | } ${RELOCATING+ > lock} | |
440 | ||
441 | .signature ${RELOCATING-0}: | |
442 | { | |
443 | KEEP(*(.signature*)) | |
444 | } ${RELOCATING+ > signature} | |
6490dc67 GJL |
445 | EOF |
446 | ||
447 | if test "$FUSE_NAME" = "config" ; then | |
448 | cat <<EOF | |
449 | ||
450 | .config ${RELOCATING-0}: | |
451 | { | |
452 | KEEP(*(.config*)) | |
453 | } ${RELOCATING+ > config} | |
454 | EOF | |
455 | fi | |
456 | ||
6752dd75 | 457 | source_sh $srcdir/scripttempl/misc-sections.sc |
ef844a53 | 458 | |
2d5783fa | 459 | cat <<EOF |
c2e86386 | 460 | .note.gnu.build-id ${RELOCATING-0} : { *(.note.gnu.build-id) } |
ceb0a680 | 461 | EOF |
2a995fc1 | 462 | |
6752dd75 | 463 | source_sh $srcdir/scripttempl/DWARF.sc |
2a995fc1 | 464 | |
ceb0a680 | 465 | cat <<EOF |
7c8bf1e8 MM |
466 | } |
467 | EOF |