1 | /**
|
---|
2 | * \file
|
---|
3 | *
|
---|
4 | * \brief Linker script for running in internal FLASH on the SAMD21E18A
|
---|
5 | *
|
---|
6 | * Copyright (c) 2014 Atmel Corporation. All rights reserved.
|
---|
7 | *
|
---|
8 | * \asf_license_start
|
---|
9 | *
|
---|
10 | * \page License
|
---|
11 | *
|
---|
12 | * Redistribution and use in source and binary forms, with or without
|
---|
13 | * modification, are permitted provided that the following conditions are met:
|
---|
14 | *
|
---|
15 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
16 | * this list of conditions and the following disclaimer.
|
---|
17 | *
|
---|
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
19 | * this list of conditions and the following disclaimer in the documentation
|
---|
20 | * and/or other materials provided with the distribution.
|
---|
21 | *
|
---|
22 | * 3. The name of Atmel may not be used to endorse or promote products derived
|
---|
23 | * from this software without specific prior written permission.
|
---|
24 | *
|
---|
25 | * 4. This software may only be redistributed and used in connection with an
|
---|
26 | * Atmel microcontroller product.
|
---|
27 | *
|
---|
28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
---|
29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
---|
30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
---|
31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
---|
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
---|
36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
---|
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
---|
38 | * POSSIBILITY OF SUCH DAMAGE.
|
---|
39 | *
|
---|
40 | * \asf_license_stop
|
---|
41 | *
|
---|
42 | */
|
---|
43 |
|
---|
44 |
|
---|
45 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
---|
46 | OUTPUT_ARCH(arm)
|
---|
47 | SEARCH_DIR(.)
|
---|
48 |
|
---|
49 | /* Memory Spaces Definitions */
|
---|
50 | MEMORY
|
---|
51 | {
|
---|
52 | rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
|
---|
53 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
|
---|
54 | }
|
---|
55 |
|
---|
56 | /* The stack size used by the application. NOTE: you need to adjust according to your application. */
|
---|
57 | STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
|
---|
58 |
|
---|
59 | /* Section Definitions */
|
---|
60 | SECTIONS
|
---|
61 | {
|
---|
62 | .text :
|
---|
63 | {
|
---|
64 | . = ALIGN(4);
|
---|
65 | _sfixed = .;
|
---|
66 | KEEP(*(.vectors .vectors.*))
|
---|
67 | *(.text .text.* .gnu.linkonce.t.*)
|
---|
68 | *(.glue_7t) *(.glue_7)
|
---|
69 | *(.rodata .rodata* .gnu.linkonce.r.*)
|
---|
70 | *(.ARM.extab* .gnu.linkonce.armextab.*)
|
---|
71 |
|
---|
72 | /* Support C constructors, and C destructors in both user code
|
---|
73 | and the C library. This also provides support for C++ code. */
|
---|
74 | . = ALIGN(4);
|
---|
75 | KEEP(*(.init))
|
---|
76 | . = ALIGN(4);
|
---|
77 | __preinit_array_start = .;
|
---|
78 | KEEP (*(.preinit_array))
|
---|
79 | __preinit_array_end = .;
|
---|
80 |
|
---|
81 | . = ALIGN(4);
|
---|
82 | __init_array_start = .;
|
---|
83 | KEEP (*(SORT(.init_array.*)))
|
---|
84 | KEEP (*(.init_array))
|
---|
85 | __init_array_end = .;
|
---|
86 |
|
---|
87 | . = ALIGN(4);
|
---|
88 | KEEP (*crtbegin.o(.ctors))
|
---|
89 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
---|
90 | KEEP (*(SORT(.ctors.*)))
|
---|
91 | KEEP (*crtend.o(.ctors))
|
---|
92 |
|
---|
93 | . = ALIGN(4);
|
---|
94 | KEEP(*(.fini))
|
---|
95 |
|
---|
96 | . = ALIGN(4);
|
---|
97 | __fini_array_start = .;
|
---|
98 | KEEP (*(.fini_array))
|
---|
99 | KEEP (*(SORT(.fini_array.*)))
|
---|
100 | __fini_array_end = .;
|
---|
101 |
|
---|
102 | KEEP (*crtbegin.o(.dtors))
|
---|
103 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
---|
104 | KEEP (*(SORT(.dtors.*)))
|
---|
105 | KEEP (*crtend.o(.dtors))
|
---|
106 |
|
---|
107 | . = ALIGN(4);
|
---|
108 | _efixed = .; /* End of text section */
|
---|
109 | } > rom
|
---|
110 |
|
---|
111 | /* .ARM.exidx is sorted, so has to go in its own output section. */
|
---|
112 | PROVIDE_HIDDEN (__exidx_start = .);
|
---|
113 | .ARM.exidx :
|
---|
114 | {
|
---|
115 | *(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
---|
116 | } > rom
|
---|
117 | PROVIDE_HIDDEN (__exidx_end = .);
|
---|
118 |
|
---|
119 | . = ALIGN(4);
|
---|
120 | _etext = .;
|
---|
121 |
|
---|
122 | .relocate : AT (_etext)
|
---|
123 | {
|
---|
124 | . = ALIGN(4);
|
---|
125 | _srelocate = .;
|
---|
126 | *(.ramfunc .ramfunc.*);
|
---|
127 | *(.data .data.*);
|
---|
128 | . = ALIGN(4);
|
---|
129 | _erelocate = .;
|
---|
130 | } > ram
|
---|
131 |
|
---|
132 | /* .bss section which is used for uninitialized data */
|
---|
133 | .bss (NOLOAD) :
|
---|
134 | {
|
---|
135 | . = ALIGN(4);
|
---|
136 | _sbss = . ;
|
---|
137 | _szero = .;
|
---|
138 | *(.bss .bss.*)
|
---|
139 | *(COMMON)
|
---|
140 | . = ALIGN(4);
|
---|
141 | _ebss = . ;
|
---|
142 | _ezero = .;
|
---|
143 | } > ram
|
---|
144 |
|
---|
145 | /* stack section */
|
---|
146 | .stack (NOLOAD):
|
---|
147 | {
|
---|
148 | . = ALIGN(8);
|
---|
149 | _sstack = .;
|
---|
150 | . = . + STACK_SIZE;
|
---|
151 | . = ALIGN(8);
|
---|
152 | _estack = .;
|
---|
153 | } > ram
|
---|
154 |
|
---|
155 | . = ALIGN(4);
|
---|
156 | _end = . ;
|
---|
157 | }
|
---|