blob: 209a07113e874440d64d8bffe5b09a287fc2773b [file] [log] [blame]
Christina Quastb0a05702014-11-28 10:27:32 +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 ATSAM3S4
32 *----------------------------------------------------------------------------*/
33
34OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
35OUTPUT_ARCH(arm)
36SEARCH_DIR(.)
37ENTRY(main)
38
39/* Memory Spaces Definitions */
40MEMORY
41{
42 rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00020000 /* flash, 256K */
43 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 /* sram, 48K */
44 /* rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00040000 /* flash, 256K */
45 /*ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x0000c000 /* sram, 48K */
46}
47
48/* Section Definitions */
49SECTIONS
50{
51 .text :
52 {
53 . = ALIGN(4);
54 _sfixed = .;
55 KEEP(*(.vectors .vectors.*))
56 *(.text .text.* .gnu.linkonce.t.*)
57 *(.glue_7t) *(.glue_7)
58 *(.rodata .rodata* .gnu.linkonce.r.*)
59 *(.ARM.extab* .gnu.linkonce.armextab.*)
60
61 /* Support C constructors, and C destructors in both user code
62 and the C library. This also provides support for C++ code. */
63 . = ALIGN(4);
64 KEEP(*(.init))
65 . = ALIGN(4);
66 __preinit_array_start = .;
67 KEEP (*(.preinit_array))
68 __preinit_array_end = .;
69
70 . = ALIGN(4);
71 __init_array_start = .;
72 KEEP (*(SORT(.init_array.*)))
73 KEEP (*(.init_array))
74 __init_array_end = .;
75
76 . = ALIGN(0x4);
77 KEEP (*crtbegin.o(.ctors))
78 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
79 KEEP (*(SORT(.ctors.*)))
80 KEEP (*crtend.o(.ctors))
81
82 . = ALIGN(4);
83 KEEP(*(.fini))
84
85 . = ALIGN(4);
86 __fini_array_start = .;
87 KEEP (*(.fini_array))
88 KEEP (*(SORT(.fini_array.*)))
89 __fini_array_end = .;
90
91 KEEP (*crtbegin.o(.dtors))
92 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
93 KEEP (*(SORT(.dtors.*)))
94 KEEP (*crtend.o(.dtors))
95
96 . = ALIGN(4);
97 _efixed = .; /* End of text section */
98 } > rom
99
100 /* .ARM.exidx is sorted, so has to go in its own output section. */
101 PROVIDE_HIDDEN (__exidx_start = .);
102 .ARM.exidx :
103 {
104 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
105 } > rom
106 PROVIDE_HIDDEN (__exidx_end = .);
107
108 . = ALIGN(4);
109 _etext = .;
110
111 .relocate : AT (_etext)
112 {
113 . = ALIGN(4);
114 _srelocate = .;
115 *(.ramfunc .ramfunc.*);
116 *(.data .data.*);
117 . = ALIGN(4);
118 _erelocate = .;
119 } > ram
120
121 /* .bss section which is used for uninitialized data */
122 .bss (NOLOAD) :
123 {
124 . = ALIGN(4);
125 _sbss = . ;
126 _szero = .;
127 *(.bss .bss.*)
128 *(COMMON)
129 . = ALIGN(4);
130 _ebss = . ;
131 _ezero = .;
132 } > ram
133
134 /* stack section */
135 .stack (NOLOAD):
136 {
137 . = ALIGN(8);
138 *(.stack .stack.*)
139 } > ram
140
141 . = ALIGN(4);
142 _end = . ;
143}