1/**
2 * \file
3 *
4 * \brief Linker script for running in internal SRAM on the SAML21E15B
5 *
6 * Copyright (c) 2016 Atmel Corporation,
7 *                    a wholly owned subsidiary of Microchip Technology Inc.
8 *
9 * \asf_license_start
10 *
11 * \page License
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the Licence at
16 *
17 *     http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 * \asf_license_stop
26 *
27 */
28
29
30OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
31OUTPUT_ARCH(arm)
32SEARCH_DIR(.)
33
34/* Memory Spaces Definitions */
35MEMORY
36{
37  ram      (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000
38  lpram    (rwx) : ORIGIN = 0x30000000, LENGTH = 0x00000800
39}
40
41/* The stack size used by the application. NOTE: you need to adjust according to your application. */
42STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x400;
43
44/* Section Definitions */
45SECTIONS
46{
47    .text :
48    {
49        . = ALIGN(4);
50        _sfixed = .;
51        KEEP(*(.vectors .vectors.*))
52        *(.text .text.* .gnu.linkonce.t.*)
53        *(.glue_7t) *(.glue_7)
54        *(.rodata .rodata* .gnu.linkonce.r.*)
55        *(.ARM.extab* .gnu.linkonce.armextab.*)
56
57        /* Support C constructors, and C destructors in both user code
58           and the C library. This also provides support for C++ code. */
59        . = ALIGN(4);
60        KEEP(*(.init))
61        . = ALIGN(4);
62        __preinit_array_start = .;
63        KEEP (*(.preinit_array))
64        __preinit_array_end = .;
65
66        . = ALIGN(4);
67        __init_array_start = .;
68        KEEP (*(SORT(.init_array.*)))
69        KEEP (*(.init_array))
70        __init_array_end = .;
71
72        . = ALIGN(4);
73        KEEP (*crtbegin.o(.ctors))
74        KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
75        KEEP (*(SORT(.ctors.*)))
76        KEEP (*crtend.o(.ctors))
77
78        . = ALIGN(4);
79        KEEP(*(.fini))
80
81        . = ALIGN(4);
82        __fini_array_start = .;
83        KEEP (*(.fini_array))
84        KEEP (*(SORT(.fini_array.*)))
85        __fini_array_end = .;
86
87        KEEP (*crtbegin.o(.dtors))
88        KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
89        KEEP (*(SORT(.dtors.*)))
90        KEEP (*crtend.o(.dtors))
91
92        . = ALIGN(4);
93        _efixed = .;            /* End of text section */
94    } > ram
95
96    /* .ARM.exidx is sorted, so has to go in its own output section.  */
97    PROVIDE_HIDDEN (__exidx_start = .);
98    .ARM.exidx :
99    {
100      *(.ARM.exidx* .gnu.linkonce.armexidx.*)
101    } > ram
102    PROVIDE_HIDDEN (__exidx_end = .);
103
104    . = ALIGN(4);
105    _etext = .;
106
107    .relocate : AT (_etext)
108    {
109        . = ALIGN(4);
110        _srelocate = .;
111        *(.ramfunc .ramfunc.*);
112        *(.data .data.*);
113        . = ALIGN(4);
114        _erelocate = .;
115    } > ram
116
117    .lpram (NOLOAD):
118    {
119        . = ALIGN(8);
120        _slpram = .;
121        *(.lpram .lpram.*);
122        . = ALIGN(8);
123        _elpram = .;
124    } > lpram
125
126    /* .bss section which is used for uninitialized data */
127    .bss (NOLOAD) :
128    {
129        . = ALIGN(4);
130        _sbss = . ;
131        _szero = .;
132        *(.bss .bss.*)
133        *(COMMON)
134        . = ALIGN(4);
135        _ebss = . ;
136        _ezero = .;
137    } > ram
138
139    /* stack section */
140    .stack (NOLOAD):
141    {
142        . = ALIGN(8);
143        _sstack = .;
144        . = . + STACK_SIZE;
145        . = ALIGN(8);
146        _estack = .;
147    } > ram
148
149    . = ALIGN(4);
150    _end = . ;
151}
152