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