109 lines
2.6 KiB
Plaintext
109 lines
2.6 KiB
Plaintext
/* Linker script for ATSAMD21G17D – no bootloader (flash starts at 0x00000000)
|
||
*
|
||
* Symbol names match Arduino SAMD core 1.8.14 (cortex_handlers.c / Reset.cpp):
|
||
* __StackTop, __data_start__, __data_end__, __etext,
|
||
* __bss_start__, __bss_end__, __text_start__, end
|
||
*/
|
||
|
||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||
OUTPUT_ARCH(arm)
|
||
SEARCH_DIR(.)
|
||
|
||
MEMORY
|
||
{
|
||
rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x0001FE00 /* 127.5K – Firmware */
|
||
config (rx) : ORIGIN = 0x0001FE00, LENGTH = 0x00000200 /* 512B – NVM Config (2 Rows) */
|
||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00004000 /* 16K */
|
||
}
|
||
|
||
/* Initial stack pointer = top of RAM */
|
||
__StackTop = ORIGIN(ram) + LENGTH(ram); /* 0x20004000 */
|
||
__StackLimit = __StackTop - 0x1000; /* 4 KB minimum stack */
|
||
|
||
SECTIONS
|
||
{
|
||
.text :
|
||
{
|
||
__text_start__ = .;
|
||
. = ALIGN(4);
|
||
KEEP(*(.isr_vector))
|
||
KEEP(*(.vectors .vectors.*))
|
||
*(.text .text.* .gnu.linkonce.t.*)
|
||
*(.glue_7t) *(.glue_7)
|
||
*(.rodata .rodata* .gnu.linkonce.r.*)
|
||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||
|
||
. = ALIGN(4);
|
||
KEEP(*(.init))
|
||
__preinit_array_start = .;
|
||
KEEP(*(.preinit_array))
|
||
__preinit_array_end = .;
|
||
|
||
__init_array_start = .;
|
||
KEEP(*(SORT(.init_array.*)))
|
||
KEEP(*(.init_array))
|
||
__init_array_end = .;
|
||
|
||
KEEP(*crtbegin.o(.ctors))
|
||
KEEP(*(EXCLUDE_FILE(*crtend.o) .ctors))
|
||
KEEP(*(SORT(.ctors.*)))
|
||
KEEP(*crtend.o(.ctors))
|
||
|
||
. = ALIGN(4);
|
||
KEEP(*(.fini))
|
||
__fini_array_start = .;
|
||
KEEP(*(.fini_array))
|
||
KEEP(*(SORT(.fini_array.*)))
|
||
__fini_array_end = .;
|
||
|
||
KEEP(*crtbegin.o(.dtors))
|
||
KEEP(*(EXCLUDE_FILE(*crtend.o) .dtors))
|
||
KEEP(*(SORT(.dtors.*)))
|
||
KEEP(*crtend.o(.dtors))
|
||
|
||
. = ALIGN(4);
|
||
} > rom
|
||
|
||
PROVIDE_HIDDEN(__exidx_start = .);
|
||
.ARM.exidx :
|
||
{
|
||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||
} > rom
|
||
PROVIDE_HIDDEN(__exidx_end = .);
|
||
|
||
. = ALIGN(4);
|
||
__etext = .; /* LMA of .data – where initialized data lives in flash */
|
||
_etext = .; /* legacy alias */
|
||
|
||
.data : AT(__etext)
|
||
{
|
||
. = ALIGN(4);
|
||
__data_start__ = .;
|
||
_srelocate = .; /* legacy alias */
|
||
*(.ramfunc .ramfunc.*);
|
||
*(.data .data.*);
|
||
. = ALIGN(4);
|
||
__data_end__ = .;
|
||
_erelocate = .; /* legacy alias */
|
||
} > ram
|
||
|
||
.bss (NOLOAD) :
|
||
{
|
||
. = ALIGN(4);
|
||
__bss_start__ = .;
|
||
_sbss = .; /* legacy alias */
|
||
_szero = .; /* legacy alias */
|
||
*(.bss .bss.*)
|
||
*(COMMON)
|
||
. = ALIGN(4);
|
||
__bss_end__ = .;
|
||
_ebss = .; /* legacy alias */
|
||
_ezero = .; /* legacy alias */
|
||
} > ram
|
||
|
||
/* Heap starts here (used by sbrk / malloc) */
|
||
. = ALIGN(4);
|
||
end = .;
|
||
_end = .;
|
||
}
|