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