1/** 2 * \file 3 * 4 * \brief GCC linker script (flash) for ATSAME70Q21B 5 * 6 * Copyright (c) 2019 Microchip Technology Inc. 7 * 8 * \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"); 15 * you may not use this file except in compliance with the License. 16 * You may obtain a copy of the License 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, 22 * WITHOUT 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 * \license_stop 27 * 28 */ 29 30/*------------------------------------------------------------------------------ 31 * Linker script for running in internal FLASH on the ATSAME70Q21B 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 = 0x00200000 /* rom, 2097152K */ 42 ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000 /* ram, 393216K */ 43} 44 45/* The stack size used by the application. NOTE: you need to adjust according to your application. */ 46STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x0400; 47 48/* The heapsize used by the application. NOTE: you need to adjust according to your application. */ 49HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : DEFINED(__heap_size__) ? __heap_size__ : 0x0200; 50 51/* Section Definitions */ 52SECTIONS 53{ 54 .text : 55 { 56 . = ALIGN(4); 57 _sfixed = .; 58 KEEP(*(.vectors .vectors.*)) 59 *(.text .text.* .gnu.linkonce.t.*) 60 *(.glue_7t) *(.glue_7) 61 *(.rodata .rodata* .gnu.linkonce.r.*) 62 *(.ARM.extab* .gnu.linkonce.armextab.*) 63 64 /* section information for finsh shell */ 65 . = ALIGN(4); 66 __fsymtab_start = .; 67 KEEP(*(FSymTab)) 68 __fsymtab_end = .; 69 . = ALIGN(4); 70 __vsymtab_start = .; 71 KEEP(*(VSymTab)) 72 __vsymtab_end = .; 73 . = ALIGN(4); 74 75 /* section information for initial. */ 76 . = ALIGN(4); 77 __rt_init_start = .; 78 KEEP(*(SORT(.rti_fn*))) 79 __rt_init_end = .; 80 . = ALIGN(4); 81 82 /* section information for utest */ 83 . = ALIGN(4); 84 __rt_utest_tc_tab_start = .; 85 KEEP(*(UtestTcTab)) 86 __rt_utest_tc_tab_end = .; 87 88 89 /* Support C constructors, and C destructors in both user code 90 and the C library. This also provides support for C++ code. */ 91 . = ALIGN(4); 92 KEEP(*(.init)) 93 . = ALIGN(4); 94 __preinit_array_start = .; 95 KEEP (*(.preinit_array)) 96 __preinit_array_end = .; 97 98 . = ALIGN(4); 99 __init_array_start = .; 100 KEEP (*(SORT(.init_array.*))) 101 KEEP (*(.init_array)) 102 __init_array_end = .; 103 104 . = ALIGN(4); 105 KEEP (*crtbegin.o(.ctors)) 106 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 107 KEEP (*(SORT(.ctors.*))) 108 KEEP (*crtend.o(.ctors)) 109 110 . = ALIGN(4); 111 KEEP(*(.fini)) 112 113 . = ALIGN(4); 114 __fini_array_start = .; 115 KEEP (*(.fini_array)) 116 KEEP (*(SORT(.fini_array.*))) 117 __fini_array_end = .; 118 119 KEEP (*crtbegin.o(.dtors)) 120 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 121 KEEP (*(SORT(.dtors.*))) 122 KEEP (*crtend.o(.dtors)) 123 124 . = ALIGN(4); 125 _efixed = .; /* End of text section */ 126 } > rom 127 128 /* .ARM.exidx is sorted, so has to go in its own output section. */ 129 PROVIDE_HIDDEN (__exidx_start = .); 130 .ARM.exidx : 131 { 132 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 133 } > rom 134 PROVIDE_HIDDEN (__exidx_end = .); 135 136 . = ALIGN(4); 137 _etext = .; 138 139 .relocate : AT (_etext) 140 { 141 . = ALIGN(4); 142 _srelocate = .; 143 *(.ramfunc .ramfunc.*); 144 *(.data .data.*); 145 . = ALIGN(4); 146 _erelocate = .; 147 } > ram 148 149 /* .bss section which is used for uninitialized data */ 150 .bss (NOLOAD) : 151 { 152 . = ALIGN(4); 153 _sbss = . ; 154 _szero = .; 155 *(.bss .bss.*) 156 *(COMMON) 157 . = ALIGN(4); 158 _ebss = . ; 159 _ezero = .; 160 } > ram 161 162 /* heap section */ 163 .heap (NOLOAD): 164 { 165 . = ALIGN(8); 166 _sheap = .; 167 . = . + HEAP_SIZE; 168 . = ALIGN(8); 169 _eheap = .; 170 } > ram 171 172 /* stack section */ 173 .stack (NOLOAD): 174 { 175 . = ALIGN(8); 176 _sstack = .; 177 . = . + STACK_SIZE; 178 . = ALIGN(8); 179 _estack = .; 180 } > ram 181 182 . = ALIGN(4); 183 _end = . ; 184 __bss_end = _end; 185 _ram_end_ = ORIGIN(ram) + LENGTH(ram) - 1 ; 186} 187