1/** 2 * \file 3 * 4 * \brief Linker script for running in internal FLASH on the SAME54P20A 5 * 6 * Copyright (c) 2019 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 31OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") 32OUTPUT_ARCH(arm) 33SEARCH_DIR(.) 34 35/* Memory Spaces Definitions */ 36MEMORY 37{ 38 rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00100000 39 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000 40 bkupram (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000 41 qspi (rwx) : ORIGIN = 0x04000000, LENGTH = 0x01000000 42} 43 44/* The stack size used by the application. NOTE: you need to adjust according to your application. */ 45STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000; 46 47/* The heapsize used by the application. NOTE: you need to adjust according to your application. */ 48HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : DEFINED(__heap_size__) ? __heap_size__ : 0x2000; 49 50/* Section Definitions */ 51SECTIONS 52{ 53 .text : 54 { 55 . = ALIGN(4); 56 _sfixed = .; 57 KEEP(*(.vectors .vectors.*)) 58 *(.text .text.* .gnu.linkonce.t.*) 59 *(.glue_7t) *(.glue_7) 60 *(.rodata .rodata* .gnu.linkonce.r.*) 61 *(.ARM.extab* .gnu.linkonce.armextab.*) 62 63 /* section information for finsh shell */ 64 . = ALIGN(4); 65 __fsymtab_start = .; 66 KEEP(*(FSymTab)) 67 __fsymtab_end = .; 68 . = ALIGN(4); 69 __vsymtab_start = .; 70 KEEP(*(VSymTab)) 71 __vsymtab_end = .; 72 . = ALIGN(4); 73 74 /* section information for initial. */ 75 . = ALIGN(4); 76 __rt_init_start = .; 77 KEEP(*(SORT(.rti_fn*))) 78 __rt_init_end = .; 79 . = ALIGN(4); 80 81 /* section information for utest */ 82 . = ALIGN(4); 83 __rt_utest_tc_tab_start = .; 84 KEEP(*(UtestTcTab)) 85 __rt_utest_tc_tab_end = .; 86 87 88 /* Support C constructors, and C destructors in both user code 89 and the C library. This also provides support for C++ code. */ 90 . = ALIGN(4); 91 KEEP(*(.init)) 92 . = ALIGN(4); 93 __preinit_array_start = .; 94 KEEP (*(.preinit_array)) 95 __preinit_array_end = .; 96 97 . = ALIGN(4); 98 __init_array_start = .; 99 KEEP (*(SORT(.init_array.*))) 100 KEEP (*(.init_array)) 101 __init_array_end = .; 102 103 . = ALIGN(4); 104 KEEP (*crtbegin.o(.ctors)) 105 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 106 KEEP (*(SORT(.ctors.*))) 107 KEEP (*crtend.o(.ctors)) 108 109 . = ALIGN(4); 110 KEEP(*(.fini)) 111 112 . = ALIGN(4); 113 __fini_array_start = .; 114 KEEP (*(.fini_array)) 115 KEEP (*(SORT(.fini_array.*))) 116 __fini_array_end = .; 117 118 KEEP (*crtbegin.o(.dtors)) 119 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 120 KEEP (*(SORT(.dtors.*))) 121 KEEP (*crtend.o(.dtors)) 122 123 . = ALIGN(4); 124 _efixed = .; /* End of text section */ 125 } > rom 126 127 /* .ARM.exidx is sorted, so has to go in its own output section. */ 128 PROVIDE_HIDDEN (__exidx_start = .); 129 .ARM.exidx : 130 { 131 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 132 } > rom 133 PROVIDE_HIDDEN (__exidx_end = .); 134 135 . = ALIGN(4); 136 _etext = .; 137 138 .relocate : AT (_etext) 139 { 140 . = ALIGN(4); 141 _srelocate = .; 142 *(.ramfunc .ramfunc.*); 143 *(.data .data.*); 144 . = ALIGN(4); 145 _erelocate = .; 146 } > ram 147 148 .bkupram (NOLOAD): 149 { 150 . = ALIGN(8); 151 _sbkupram = .; 152 *(.bkupram .bkupram.*); 153 . = ALIGN(8); 154 _ebkupram = .; 155 } > bkupram 156 157 .qspi (NOLOAD): 158 { 159 . = ALIGN(8); 160 _sqspi = .; 161 *(.qspi .qspi.*); 162 . = ALIGN(8); 163 _eqspi = .; 164 } > qspi 165 166 /* .bss section which is used for uninitialized data */ 167 .bss (NOLOAD) : 168 { 169 . = ALIGN(4); 170 _sbss = . ; 171 _szero = .; 172 *(.bss .bss.*) 173 *(COMMON) 174 . = ALIGN(4); 175 _ebss = . ; 176 _ezero = .; 177 } > ram 178 179 /* heap section */ 180 .heap (NOLOAD): 181 { 182 . = ALIGN(8); 183 _sheap = .; 184 . = . + HEAP_SIZE; 185 . = ALIGN(8); 186 _eheap = .; 187 } > ram 188 189 /* stack section */ 190 .stack (NOLOAD): 191 { 192 . = ALIGN(8); 193 _sstack = .; 194 . = . + STACK_SIZE; 195 . = ALIGN(8); 196 _estack = .; 197 } > ram 198 199 . = ALIGN(4); 200 _end = . ; 201 __bss_end = _end; 202 _ram_end_ = ORIGIN(ram) + LENGTH(ram) - 1 ; 203} 204