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