Skip to content

Commit aacb1ad

Browse files
committed
atmel-samd: Add linker file for bootloaderless board with external flash.
1 parent 853e5fc commit aacb1ad

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
GNU linker script for SAMD21
3+
*/
4+
5+
/* Specify the memory areas */
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 /* 256 KiB */
9+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x008000 /* 32 KiB */
10+
}
11+
12+
/* top end of the stack */
13+
_estack = ORIGIN(RAM) + LENGTH(RAM);
14+
15+
/* define output sections */
16+
SECTIONS
17+
{
18+
/* The program code and other data goes into FLASH */
19+
.text :
20+
{
21+
. = ALIGN(4);
22+
_sfixed = .;
23+
KEEP(*(.vectors)) /* isr vector table */
24+
*(.text) /* .text sections (code) */
25+
*(.text*) /* .text* sections (code) */
26+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
27+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
28+
29+
. = ALIGN(4);
30+
_etext = .; /* define a global symbol at end of code */
31+
_sidata = _etext; /* This is used by the startup in order to initialize the .data section */
32+
} >FLASH
33+
34+
/* This is the initialized data section
35+
The program executes knowing that the data is in the RAM
36+
but the loader puts the initial values in the FLASH (inidata).
37+
It is one task of the startup to copy the initial values from FLASH to RAM. */
38+
.data : AT ( _sidata )
39+
{
40+
. = ALIGN(4);
41+
_srelocate = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
42+
*(.ramfunc)
43+
*(.ramfunc*)
44+
*(.data) /* .data sections */
45+
*(.data*) /* .data* sections */
46+
47+
. = ALIGN(4);
48+
_erelocate = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
49+
} >RAM
50+
51+
/* Uninitialized data section */
52+
.bss :
53+
{
54+
. = ALIGN(4);
55+
_sbss = .;
56+
_szero = .; /* define a global symbol at bss start; used by startup code */
57+
*(.bss)
58+
*(.bss*)
59+
*(COMMON)
60+
61+
. = ALIGN(4);
62+
_ezero = .; /* define a global symbol at bss end; used by startup code */
63+
_ebss = .;
64+
} >RAM
65+
66+
/* this just checks there is enough RAM for a minimal stack */
67+
.stack :
68+
{
69+
. = ALIGN(4);
70+
. = . + 0x800; /* Reserve a minimum of 2K for the stack. */
71+
. = ALIGN(4);
72+
} >RAM
73+
74+
.ARM.attributes 0 : { *(.ARM.attributes) }
75+
}

0 commit comments

Comments
 (0)