blob: 22cfe59d4d4c7c21c910c0d61c4d3446b4fa02d8 [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 FLASH on the ATSAM3S2
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 = 0x00020000 /* flash, 128K */
42 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 /* sram, 32K */
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 } > rom
96
97 /* .ARM.exidx is sorted, so has to go in its own output section. */
98 PROVIDE_HIDDEN (__exidx_start = .);
99 .ARM.exidx :
100 {
101 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
102 } > rom
103 PROVIDE_HIDDEN (__exidx_end = .);
104
105 . = ALIGN(4);
106 _etext = .;
107
108 .relocate : AT (_etext)
109 {
110 . = ALIGN(4);
111 _srelocate = .;
112 *(.ramfunc .ramfunc.*);
113 *(.data .data.*);
114 . = ALIGN(4);
115 _erelocate = .;
116 } > ram
117
118 /* .bss section which is used for uninitialized data */
119 .bss (NOLOAD) :
120 {
121 . = ALIGN(4);
122 _sbss = . ;
123 _szero = .;
124 *(.bss .bss.*)
125 *(COMMON)
126 . = ALIGN(4);
127 _ebss = . ;
128 _ezero = .;
129 } > ram
130
131 /* stack section */
132 .stack (NOLOAD):
133 {
134 . = ALIGN(8);
135 *(.stack .stack.*)
136 } > ram
137
138 . = ALIGN(4);
139 _end = . ;
140}