]> git.donarmstrong.com Git - qmk_firmware.git/blob - lib/arm_atsam/packs/atmel/SAMD51_DFP/1.0.70/gcc/gcc/samd51j18a_flash.ld
Massdrop keyboard support (#3780)
[qmk_firmware.git] / lib / arm_atsam / packs / atmel / SAMD51_DFP / 1.0.70 / gcc / gcc / samd51j18a_flash.ld
1 /**
2  * \file
3  *
4  * \brief Linker script for running in internal FLASH on the SAMD51J18A
5  *
6  * Copyright (c) 2017 Microchip Technology Inc.
7  *
8  * \asf_license_start
9  *
10  * \page License
11  *
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License"); you may
15  * not use this file except in compliance with the License.
16  * You may obtain a copy of the Licence at
17  * 
18  * http://www.apache.org/licenses/LICENSE-2.0
19  * 
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
22  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  * \asf_license_stop
27  *
28  */
29
30
31 OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
32 OUTPUT_ARCH(arm)
33 SEARCH_DIR(.)
34
35 /* Memory Spaces Definitions */
36 MEMORY
37 {
38   //rom      (rx)  : ORIGIN = 0x00000000, LENGTH = 0x00040000
39   rom      (rx)  : ORIGIN = 0x00004000, LENGTH = 0x0003C000
40   ram      (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000
41   bkupram  (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000
42   qspi     (rwx) : ORIGIN = 0x04000000, LENGTH = 0x01000000
43 }
44
45 /* The stack size used by the application. NOTE: you need to adjust according to your application. */
46 STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x8000;
47
48 _srom = ORIGIN(rom);
49 _lrom = LENGTH(rom);
50 _erom = ORIGIN(rom) + LENGTH(rom);
51
52 /* Section Definitions */
53 SECTIONS
54 {
55     .text :
56     {
57         . = ALIGN(4);
58         _sfixed = .;
59         KEEP(*(.vectors .vectors.*))
60         *(.text .text.* .gnu.linkonce.t.*)
61         *(.glue_7t) *(.glue_7)
62         *(.rodata .rodata* .gnu.linkonce.r.*)
63         *(.ARM.extab* .gnu.linkonce.armextab.*)
64
65         /* Support C constructors, and C destructors in both user code
66            and the C library. This also provides support for C++ code. */
67         . = ALIGN(4);
68         KEEP(*(.init))
69         . = ALIGN(4);
70         __preinit_array_start = .;
71         KEEP (*(.preinit_array))
72         __preinit_array_end = .;
73
74         . = ALIGN(4);
75         __init_array_start = .;
76         KEEP (*(SORT(.init_array.*)))
77         KEEP (*(.init_array))
78         __init_array_end = .;
79
80         . = ALIGN(4);
81         KEEP (*crtbegin.o(.ctors))
82         KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
83         KEEP (*(SORT(.ctors.*)))
84         KEEP (*crtend.o(.ctors))
85
86         . = ALIGN(4);
87         KEEP(*(.fini))
88
89         . = ALIGN(4);
90         __fini_array_start = .;
91         KEEP (*(.fini_array))
92         KEEP (*(SORT(.fini_array.*)))
93         __fini_array_end = .;
94
95         KEEP (*crtbegin.o(.dtors))
96         KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
97         KEEP (*(SORT(.dtors.*)))
98         KEEP (*crtend.o(.dtors))
99
100         . = ALIGN(4);
101         _efixed = .;            /* End of text section */
102     } > rom
103
104     /* .ARM.exidx is sorted, so has to go in its own output section.  */
105     PROVIDE_HIDDEN (__exidx_start = .);
106     .ARM.exidx :
107     {
108       *(.ARM.exidx* .gnu.linkonce.armexidx.*)
109     } > rom
110     PROVIDE_HIDDEN (__exidx_end = .);
111
112     . = ALIGN(4);
113     _etext = .;
114
115     .relocate : AT (_etext)
116     {
117         . = ALIGN(4);
118         _srelocate = .;
119         *(.ramfunc .ramfunc.*);
120         *(.data .data.*);
121         . = ALIGN(4);
122         _erelocate = .;
123     } > ram
124
125     .bkupram (NOLOAD):
126     {
127         . = ALIGN(8);
128         _sbkupram = .;
129         *(.bkupram .bkupram.*);
130         . = ALIGN(8);
131         _ebkupram = .;
132     } > bkupram
133
134     .qspi (NOLOAD):
135     {
136         . = ALIGN(8);
137         _sqspi = .;
138         *(.qspi .qspi.*);
139         . = ALIGN(8);
140         _eqspi = .;
141     } > qspi
142
143     /* .bss section which is used for uninitialized data */
144     .bss (NOLOAD) :
145     {
146         . = ALIGN(4);
147         _sbss = . ;
148         _szero = .;
149         *(.bss .bss.*)
150         *(COMMON)
151         . = ALIGN(4);
152         _ebss = . ;
153         _ezero = .;
154     } > ram
155
156     /* stack section */
157     .stack (NOLOAD):
158     {
159         . = ALIGN(8);
160         _sstack = .;
161         . = . + STACK_SIZE;
162         . = ALIGN(8);
163         _estack = .;
164     } > ram
165
166     . = ALIGN(4);
167     _end = . ;
168 }