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 FLASH 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 } > rom 115 116 /* .ARM.exidx is sorted, so has to go in its own output section. */ 117 PROVIDE_HIDDEN (__exidx_start = .); 118 .ARM.exidx : 119 { 120 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 121 } > rom 122 PROVIDE_HIDDEN (__exidx_end = .); 123 124 . = ALIGN(4); 125 _etext = .; 126 127 .relocate : AT (_etext) 128 { 129 . = ALIGN(4); 130 _srelocate = .; 131 *(.ramfunc .ramfunc.*); 132 *(.data .data.*); 133 . = ALIGN(4); 134 _erelocate = .; 135 } > ram 136 137 /* .bss section which is used for uninitialized data */ 138 .bss (NOLOAD) : 139 { 140 . = ALIGN(4); 141 _sbss = . ; 142 _szero = .; 143 *(.bss .bss.*) 144 *(COMMON) 145 . = ALIGN(4); 146 _ebss = . ; 147 _ezero = .; 148 } > ram 149 150 /* stack section */ 151 .stack (NOLOAD): 152 { 153 . = ALIGN(8); 154 _sstack = .; 155 . = . + STACK_SIZE; 156 . = ALIGN(8); 157 _estack = .; 158 } > ram 159 160 /* heap section */ 161 .heap (NOLOAD): 162 { 163 . = ALIGN(8); 164 _sheap = .; 165 . = . + HEAP_SIZE; 166 . = ALIGN(8); 167 _eheap = .; 168 } > ram 169 170 . = ALIGN(4); 171 _end = . ; 172 _ram_end_ = ORIGIN(ram) + LENGTH(ram) -1 ; 173} 174