2017-01-02 11:36:43 +08:00
|
|
|
# Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
2014-08-20 17:34:58 +08:00
|
|
|
#
|
|
|
|
# Copying and distribution of this file, with or without modification,
|
|
|
|
# are permitted in any medium without royalty provided the copyright
|
|
|
|
# notice and this notice are preserved.
|
|
|
|
|
2002-05-17 03:51:08 +08:00
|
|
|
cat <<EOF
|
2017-01-02 11:36:43 +08:00
|
|
|
/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
2014-08-20 17:34:58 +08:00
|
|
|
|
|
|
|
Copying and distribution of this script, with or without modification,
|
|
|
|
are permitted in any medium without royalty provided the copyright
|
|
|
|
notice and this notice are preserved. */
|
|
|
|
|
2002-05-17 03:51:08 +08:00
|
|
|
OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
|
|
|
|
OUTPUT_ARCH(${ARCH})
|
|
|
|
|
2015-02-24 19:26:28 +08:00
|
|
|
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
|
|
|
|
__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
|
|
|
|
__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K;
|
|
|
|
__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K;
|
|
|
|
__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K;
|
|
|
|
__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K;
|
|
|
|
__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K;
|
|
|
|
|
2002-05-17 03:51:08 +08:00
|
|
|
MEMORY
|
|
|
|
{
|
2015-02-24 19:26:28 +08:00
|
|
|
text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
|
|
|
|
data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
|
|
|
|
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
|
|
|
|
fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
|
|
|
|
lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
|
|
|
|
signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
|
|
|
|
user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__
|
2002-05-17 03:51:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
/* Read-only sections, merged into text segment: */
|
|
|
|
${TEXT_DYNAMIC+${DYNAMIC}}
|
2009-10-10 12:34:39 +08:00
|
|
|
.hash ${RELOCATING-0} : { *(.hash) }
|
|
|
|
.dynsym ${RELOCATING-0} : { *(.dynsym) }
|
|
|
|
.dynstr ${RELOCATING-0} : { *(.dynstr) }
|
|
|
|
.gnu.version ${RELOCATING-0} : { *(.gnu.version) }
|
|
|
|
.gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
|
|
|
|
.gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
|
|
|
|
|
|
|
|
.rel.init ${RELOCATING-0} : { *(.rel.init) }
|
|
|
|
.rela.init ${RELOCATING-0} : { *(.rela.init) }
|
|
|
|
.rel.text ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
*(.rel.text)
|
|
|
|
${RELOCATING+*(.rel.text.*)}
|
|
|
|
${RELOCATING+*(.rel.gnu.linkonce.t*)}
|
|
|
|
}
|
2009-10-10 12:34:39 +08:00
|
|
|
.rela.text ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
*(.rela.text)
|
|
|
|
${RELOCATING+*(.rela.text.*)}
|
|
|
|
${RELOCATING+*(.rela.gnu.linkonce.t*)}
|
|
|
|
}
|
2009-10-10 12:34:39 +08:00
|
|
|
.rel.fini ${RELOCATING-0} : { *(.rel.fini) }
|
|
|
|
.rela.fini ${RELOCATING-0} : { *(.rela.fini) }
|
|
|
|
.rel.rodata ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
*(.rel.rodata)
|
|
|
|
${RELOCATING+*(.rel.rodata.*)}
|
|
|
|
${RELOCATING+*(.rel.gnu.linkonce.r*)}
|
|
|
|
}
|
2009-10-10 12:34:39 +08:00
|
|
|
.rela.rodata ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
*(.rela.rodata)
|
|
|
|
${RELOCATING+*(.rela.rodata.*)}
|
|
|
|
${RELOCATING+*(.rela.gnu.linkonce.r*)}
|
|
|
|
}
|
2009-10-10 12:34:39 +08:00
|
|
|
.rel.data ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
*(.rel.data)
|
|
|
|
${RELOCATING+*(.rel.data.*)}
|
|
|
|
${RELOCATING+*(.rel.gnu.linkonce.d*)}
|
|
|
|
}
|
2009-10-10 12:34:39 +08:00
|
|
|
.rela.data ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
*(.rela.data)
|
|
|
|
${RELOCATING+*(.rela.data.*)}
|
|
|
|
${RELOCATING+*(.rela.gnu.linkonce.d*)}
|
|
|
|
}
|
2009-10-10 12:34:39 +08:00
|
|
|
.rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
|
|
|
|
.rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
|
|
|
|
.rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
|
|
|
|
.rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
|
|
|
|
.rel.got ${RELOCATING-0} : { *(.rel.got) }
|
|
|
|
.rela.got ${RELOCATING-0} : { *(.rela.got) }
|
|
|
|
.rel.bss ${RELOCATING-0} : { *(.rel.bss) }
|
|
|
|
.rela.bss ${RELOCATING-0} : { *(.rela.bss) }
|
|
|
|
.rel.plt ${RELOCATING-0} : { *(.rel.plt) }
|
|
|
|
.rela.plt ${RELOCATING-0} : { *(.rela.plt) }
|
2002-05-17 03:51:08 +08:00
|
|
|
|
2006-05-24 15:36:12 +08:00
|
|
|
/* Internal text space or external memory. */
|
2009-10-10 12:34:39 +08:00
|
|
|
.text ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.vectors)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP(*(.vectors))
|
2002-06-02 07:28:59 +08:00
|
|
|
|
2006-05-24 15:36:12 +08:00
|
|
|
/* For data that needs to reside in the lower 64k of progmem. */
|
2013-08-23 23:21:53 +08:00
|
|
|
${RELOCATING+ *(.progmem.gcc*)}
|
2006-05-24 15:36:12 +08:00
|
|
|
|
2013-03-27 21:21:38 +08:00
|
|
|
/* PR 13812: Placing the trampolines here gives a better chance
|
|
|
|
that they will be in range of the code that uses them. */
|
|
|
|
${RELOCATING+. = ALIGN(2);}
|
2006-05-24 15:36:12 +08:00
|
|
|
${CONSTRUCTING+ __trampolines_start = . ; }
|
|
|
|
/* The jump trampolines for the 16-bit limited relocs will reside here. */
|
|
|
|
*(.trampolines)
|
2013-08-23 23:21:53 +08:00
|
|
|
${RELOCATING+ *(.trampolines*)}
|
2006-05-24 15:36:12 +08:00
|
|
|
${CONSTRUCTING+ __trampolines_end = . ; }
|
|
|
|
|
2016-05-17 20:14:26 +08:00
|
|
|
/* avr-libc expects these data to reside in lower 64K. */
|
|
|
|
${RELOCATING+ *libprintf_flt.a:*(.progmem.data)}
|
|
|
|
${RELOCATING+ *libc.a:*(.progmem.data)}
|
|
|
|
|
2013-08-23 23:21:53 +08:00
|
|
|
${RELOCATING+ *(.progmem*)}
|
2013-03-27 21:21:38 +08:00
|
|
|
|
2013-04-26 23:27:55 +08:00
|
|
|
${RELOCATING+. = ALIGN(2);}
|
|
|
|
|
2006-05-24 15:36:12 +08:00
|
|
|
/* For future tablejump instruction arrays for 3 byte pc devices.
|
|
|
|
We don't relax jump/call instructions within these sections. */
|
|
|
|
*(.jumptables)
|
2013-08-23 23:21:53 +08:00
|
|
|
${RELOCATING+ *(.jumptables*)}
|
2006-05-24 15:36:12 +08:00
|
|
|
|
|
|
|
/* For code that needs to reside in the lower 128k progmem. */
|
|
|
|
*(.lowtext)
|
2013-08-23 23:21:53 +08:00
|
|
|
${RELOCATING+ *(.lowtext*)}
|
2006-05-24 15:36:12 +08:00
|
|
|
|
2002-06-02 07:28:59 +08:00
|
|
|
${CONSTRUCTING+ __ctors_start = . ; }
|
|
|
|
${CONSTRUCTING+ *(.ctors) }
|
|
|
|
${CONSTRUCTING+ __ctors_end = . ; }
|
|
|
|
${CONSTRUCTING+ __dtors_start = . ; }
|
|
|
|
${CONSTRUCTING+ *(.dtors) }
|
|
|
|
${CONSTRUCTING+ __dtors_end = . ; }
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP(SORT(*)(.ctors))
|
|
|
|
KEEP(SORT(*)(.dtors))
|
2002-06-02 07:28:59 +08:00
|
|
|
|
2006-05-24 15:36:12 +08:00
|
|
|
/* From this point on, we don't bother about wether the insns are
|
|
|
|
below or above the 16 bits boundary. */
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init0) /* Start here after reset. */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init0))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init1)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init1))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init2))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init3)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init3))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init4) /* Initialize data and BSS. */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init4))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init5)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init5))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init6) /* C++ constructors. */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init6))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init7)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init7))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init8)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init8))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.init9) /* Call main(). */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.init9))
|
2002-05-17 03:51:08 +08:00
|
|
|
*(.text)
|
|
|
|
${RELOCATING+. = ALIGN(2);}
|
2013-08-23 15:37:31 +08:00
|
|
|
${RELOCATING+ *(.text.*)}
|
2002-05-17 03:51:08 +08:00
|
|
|
${RELOCATING+. = ALIGN(2);}
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini9) /* _exit() starts here. */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini9))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini8)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini8))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini7)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini7))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini6) /* C++ destructors. */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini6))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini5)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini5))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini4)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini4))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini3)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini3))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini2)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini2))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini1)
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini1))
|
2002-06-02 07:28:59 +08:00
|
|
|
*(.fini0) /* Infinite loop after program termination. */
|
2006-03-03 23:25:31 +08:00
|
|
|
KEEP (*(.fini0))
|
2002-05-17 03:51:08 +08:00
|
|
|
${RELOCATING+ _etext = . ; }
|
|
|
|
} ${RELOCATING+ > text}
|
|
|
|
|
2013-11-22 20:00:55 +08:00
|
|
|
.data ${RELOCATING-0} :
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
${RELOCATING+ PROVIDE (__data_start = .) ; }
|
2014-07-09 00:15:18 +08:00
|
|
|
*(.data)
|
2013-08-23 23:21:53 +08:00
|
|
|
${RELOCATING+ *(.data*)}
|
2006-03-03 23:25:31 +08:00
|
|
|
*(.rodata) /* We need to include .rodata here if gcc is used */
|
2013-08-23 15:37:31 +08:00
|
|
|
${RELOCATING+ *(.rodata*)} /* with -fdata-sections. */
|
2002-05-17 03:51:08 +08:00
|
|
|
*(.gnu.linkonce.d*)
|
|
|
|
${RELOCATING+. = ALIGN(2);}
|
|
|
|
${RELOCATING+ _edata = . ; }
|
2002-06-02 07:28:59 +08:00
|
|
|
${RELOCATING+ PROVIDE (__data_end = .) ; }
|
2013-11-22 20:00:55 +08:00
|
|
|
} ${RELOCATING+ > data ${RELOCATING+AT> text}}
|
2002-05-17 03:51:08 +08:00
|
|
|
|
2014-07-09 00:15:18 +08:00
|
|
|
.bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
|
|
|
${RELOCATING+ PROVIDE (__bss_start = .) ; }
|
|
|
|
*(.bss)
|
2013-08-23 15:37:31 +08:00
|
|
|
${RELOCATING+ *(.bss*)}
|
2002-05-17 03:51:08 +08:00
|
|
|
*(COMMON)
|
|
|
|
${RELOCATING+ PROVIDE (__bss_end = .) ; }
|
2002-06-02 07:28:59 +08:00
|
|
|
} ${RELOCATING+ > data}
|
|
|
|
|
|
|
|
${RELOCATING+ __data_load_start = LOADADDR(.data); }
|
|
|
|
${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
|
|
|
|
|
|
|
|
/* Global data not cleared after reset. */
|
2016-01-26 03:33:25 +08:00
|
|
|
.noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0}: ${RELOCATING+ AT (ADDR (.noinit))}
|
2002-06-02 07:28:59 +08:00
|
|
|
{
|
|
|
|
${RELOCATING+ PROVIDE (__noinit_start = .) ; }
|
|
|
|
*(.noinit*)
|
|
|
|
${RELOCATING+ PROVIDE (__noinit_end = .) ; }
|
2002-05-17 03:51:08 +08:00
|
|
|
${RELOCATING+ _end = . ; }
|
2002-06-02 07:28:59 +08:00
|
|
|
${RELOCATING+ PROVIDE (__heap_start = .) ; }
|
2002-05-17 03:51:08 +08:00
|
|
|
} ${RELOCATING+ > data}
|
|
|
|
|
2009-10-10 12:34:39 +08:00
|
|
|
.eeprom ${RELOCATING-0}:
|
2002-05-17 03:51:08 +08:00
|
|
|
{
|
2013-01-23 19:56:02 +08:00
|
|
|
/* See .data above... */
|
|
|
|
KEEP(*(.eeprom*))
|
2002-05-17 03:51:08 +08:00
|
|
|
${RELOCATING+ __eeprom_end = . ; }
|
|
|
|
} ${RELOCATING+ > eeprom}
|
|
|
|
|
2011-03-22 04:07:42 +08:00
|
|
|
.fuse ${RELOCATING-0}:
|
|
|
|
{
|
|
|
|
KEEP(*(.fuse))
|
|
|
|
KEEP(*(.lfuse))
|
|
|
|
KEEP(*(.hfuse))
|
|
|
|
KEEP(*(.efuse))
|
|
|
|
} ${RELOCATING+ > fuse}
|
|
|
|
|
|
|
|
.lock ${RELOCATING-0}:
|
|
|
|
{
|
|
|
|
KEEP(*(.lock*))
|
|
|
|
} ${RELOCATING+ > lock}
|
|
|
|
|
|
|
|
.signature ${RELOCATING-0}:
|
|
|
|
{
|
|
|
|
KEEP(*(.signature*))
|
|
|
|
} ${RELOCATING+ > signature}
|
|
|
|
|
2002-05-17 03:51:08 +08:00
|
|
|
/* Stabs debugging sections. */
|
|
|
|
.stab 0 : { *(.stab) }
|
|
|
|
.stabstr 0 : { *(.stabstr) }
|
|
|
|
.stab.excl 0 : { *(.stab.excl) }
|
|
|
|
.stab.exclstr 0 : { *(.stab.exclstr) }
|
|
|
|
.stab.index 0 : { *(.stab.index) }
|
|
|
|
.stab.indexstr 0 : { *(.stab.indexstr) }
|
2013-04-15 16:51:58 +08:00
|
|
|
.comment 0 : { *(.comment) }
|
2013-04-24 23:28:12 +08:00
|
|
|
.note.gnu.build-id : { *(.note.gnu.build-id) }
|
2013-04-15 16:51:58 +08:00
|
|
|
EOF
|
2012-06-29 15:58:46 +08:00
|
|
|
|
2013-04-28 22:52:55 +08:00
|
|
|
. $srcdir/scripttempl/DWARF.sc
|
2012-06-29 15:58:46 +08:00
|
|
|
|
2013-04-15 16:51:58 +08:00
|
|
|
cat <<EOF
|
2002-05-17 03:51:08 +08:00
|
|
|
}
|
|
|
|
EOF
|