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