|
| 1 | +/* |
| 2 | +** ################################################################### |
| 3 | +** Processors: MK64FN1M0CAJ12 |
| 4 | +** MK64FN1M0VDC12 |
| 5 | +** MK64FN1M0VLL12 |
| 6 | +** MK64FN1M0VLQ12 |
| 7 | +** MK64FN1M0VMD12 |
| 8 | +** |
| 9 | +** Compiler: GNU C Compiler |
| 10 | +** Reference manual: K64P144M120SF5RM, Rev.2, January 2014 |
| 11 | +** Version: rev. 2.9, 2016-03-21 |
| 12 | +** Build: b160613 |
| 13 | +** |
| 14 | +** Abstract: |
| 15 | +** Linker file for the GNU C Compiler |
| 16 | +** |
| 17 | +** Copyright (c) 2016 Freescale Semiconductor, Inc. |
| 18 | +** All rights reserved. |
| 19 | +** |
| 20 | +** Redistribution and use in source and binary forms, with or without modification, |
| 21 | +** are permitted provided that the following conditions are met: |
| 22 | +** |
| 23 | +** o Redistributions of source code must retain the above copyright notice, this list |
| 24 | +** of conditions and the following disclaimer. |
| 25 | +** |
| 26 | +** o Redistributions in binary form must reproduce the above copyright notice, this |
| 27 | +** list of conditions and the following disclaimer in the documentation and/or |
| 28 | +** other materials provided with the distribution. |
| 29 | +** |
| 30 | +** o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
| 31 | +** contributors may be used to endorse or promote products derived from this |
| 32 | +** software without specific prior written permission. |
| 33 | +** |
| 34 | +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 35 | +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 36 | +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 37 | +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
| 38 | +** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 39 | +** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 40 | +** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 41 | +** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 42 | +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 43 | +** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 44 | +** |
| 45 | +** http: www.freescale.com |
| 46 | + |
| 47 | +** |
| 48 | +** ################################################################### |
| 49 | +*/ |
| 50 | + |
| 51 | +/* Entry Point */ |
| 52 | +ENTRY(Reset_Handler) |
| 53 | + |
| 54 | +__ram_vector_table__ = 1; |
| 55 | + |
| 56 | +#if !defined(MBED_APP_START) |
| 57 | + #define MBED_APP_START 0 |
| 58 | +#elif MBED_APP_START > 0 && MBED_APP_START < 0x410 |
| 59 | + #error MBED_APP_START too small and will overwrite interrupts and flash config |
| 60 | +#endif |
| 61 | + |
| 62 | +#if !defined(MBED_APP_SIZE) |
| 63 | + #define MBED_APP_SIZE 0x100000 |
| 64 | +#endif |
| 65 | + |
| 66 | +#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE) |
| 67 | + #define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400 |
| 68 | +#endif |
| 69 | + |
| 70 | +#if defined(MCUBOOT_SHARED_DATA_SIZE) |
| 71 | + #define SRAM_U_SIZE 0x00030000-MCUBOOT_SHARED_DATA_SIZE |
| 72 | +#else |
| 73 | + #define SRAM_U_SIZE 0x00030000 |
| 74 | +#endif |
| 75 | + |
| 76 | +__stack_size__ = MBED_CONF_TARGET_BOOT_STACK_SIZE; |
| 77 | + |
| 78 | +STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; |
| 79 | +M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0; |
| 80 | +M_CRASH_DATA_RAM_SIZE = 0x100; |
| 81 | + |
| 82 | +/* Specify the memory areas */ |
| 83 | +MEMORY |
| 84 | +{ |
| 85 | +#if MBED_APP_START == 0 |
| 86 | + m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x400 |
| 87 | + m_flash_config (RX) : ORIGIN = MBED_APP_START + 0x400, LENGTH = 0x10 |
| 88 | + m_text (RX) : ORIGIN = MBED_APP_START + 0x410, LENGTH = MBED_APP_SIZE - 0x410 |
| 89 | +#else |
| 90 | + m_text (RX) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE |
| 91 | +#endif |
| 92 | + m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000 |
| 93 | + m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = SRAM_U_SIZE |
| 94 | +} |
| 95 | + |
| 96 | +/* Define output sections */ |
| 97 | +SECTIONS |
| 98 | +{ |
| 99 | + /* The startup code goes first into internal flash */ |
| 100 | + .interrupts : |
| 101 | + { |
| 102 | + __VECTOR_TABLE = .; |
| 103 | + . = ALIGN(8); |
| 104 | + KEEP(*(.isr_vector)) /* Startup code */ |
| 105 | + . = ALIGN(8); |
| 106 | +#if MBED_APP_START == 0 |
| 107 | + } > m_interrupts |
| 108 | + |
| 109 | + .flash_config : |
| 110 | + { |
| 111 | + . = ALIGN(8); |
| 112 | + KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */ |
| 113 | + . = ALIGN(8); |
| 114 | + } > m_flash_config |
| 115 | +#else |
| 116 | + } > m_text |
| 117 | +#endif |
| 118 | + .text : |
| 119 | + { |
| 120 | + |
| 121 | + . = ALIGN(8); |
| 122 | + *(.text) /* .text sections (code) */ |
| 123 | + *(.text*) /* .text* sections (code) */ |
| 124 | + *(.rodata) /* .rodata sections (constants, strings, etc.) */ |
| 125 | + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ |
| 126 | + *(.glue_7) /* glue arm to thumb code */ |
| 127 | + *(.glue_7t) /* glue thumb to arm code */ |
| 128 | + *(.eh_frame) |
| 129 | + KEEP (*(.init)) |
| 130 | + KEEP (*(.fini)) |
| 131 | + . = ALIGN(8); |
| 132 | + } > m_text |
| 133 | + |
| 134 | + .ARM.extab : |
| 135 | + { |
| 136 | + *(.ARM.extab* .gnu.linkonce.armextab.*) |
| 137 | + } > m_text |
| 138 | + |
| 139 | + .ARM : |
| 140 | + { |
| 141 | + __exidx_start = .; |
| 142 | + *(.ARM.exidx*) |
| 143 | + __exidx_end = .; |
| 144 | + } > m_text |
| 145 | + |
| 146 | + .ctors : |
| 147 | + { |
| 148 | + __CTOR_LIST__ = .; |
| 149 | + /* gcc uses crtbegin.o to find the start of |
| 150 | + the constructors, so we make sure it is |
| 151 | + first. Because this is a wildcard, it |
| 152 | + doesn't matter if the user does not |
| 153 | + actually link against crtbegin.o; the |
| 154 | + linker won't look for a file to match a |
| 155 | + wildcard. The wildcard also means that it |
| 156 | + doesn't matter which directory crtbegin.o |
| 157 | + is in. */ |
| 158 | + KEEP (*crtbegin.o(.ctors)) |
| 159 | + KEEP (*crtbegin?.o(.ctors)) |
| 160 | + /* We don't want to include the .ctor section from |
| 161 | + from the crtend.o file until after the sorted ctors. |
| 162 | + The .ctor section from the crtend file contains the |
| 163 | + end of ctors marker and it must be last */ |
| 164 | + KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) |
| 165 | + KEEP (*(SORT(.ctors.*))) |
| 166 | + KEEP (*(.ctors)) |
| 167 | + __CTOR_END__ = .; |
| 168 | + } > m_text |
| 169 | + |
| 170 | + .dtors : |
| 171 | + { |
| 172 | + __DTOR_LIST__ = .; |
| 173 | + KEEP (*crtbegin.o(.dtors)) |
| 174 | + KEEP (*crtbegin?.o(.dtors)) |
| 175 | + KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) |
| 176 | + KEEP (*(SORT(.dtors.*))) |
| 177 | + KEEP (*(.dtors)) |
| 178 | + __DTOR_END__ = .; |
| 179 | + } > m_text |
| 180 | + |
| 181 | + .preinit_array : |
| 182 | + { |
| 183 | + PROVIDE_HIDDEN (__preinit_array_start = .); |
| 184 | + KEEP (*(.preinit_array*)) |
| 185 | + PROVIDE_HIDDEN (__preinit_array_end = .); |
| 186 | + } > m_text |
| 187 | + |
| 188 | + .init_array : |
| 189 | + { |
| 190 | + PROVIDE_HIDDEN (__init_array_start = .); |
| 191 | + KEEP (*(SORT(.init_array.*))) |
| 192 | + KEEP (*(.init_array*)) |
| 193 | + PROVIDE_HIDDEN (__init_array_end = .); |
| 194 | + } > m_text |
| 195 | + |
| 196 | + .fini_array : |
| 197 | + { |
| 198 | + PROVIDE_HIDDEN (__fini_array_start = .); |
| 199 | + KEEP (*(SORT(.fini_array.*))) |
| 200 | + KEEP (*(.fini_array*)) |
| 201 | + PROVIDE_HIDDEN (__fini_array_end = .); |
| 202 | + } > m_text |
| 203 | + |
| 204 | + .interrupts_ram : |
| 205 | + { |
| 206 | + . = ALIGN(8); |
| 207 | + __VECTOR_RAM__ = .; |
| 208 | + __interrupts_ram_start__ = .; /* Create a global symbol at data start */ |
| 209 | + *(.m_interrupts_ram) /* This is a user defined section */ |
| 210 | + . += M_VECTOR_RAM_SIZE; |
| 211 | + . = ALIGN(8); |
| 212 | + __interrupts_ram_end__ = .; /* Define a global symbol at data end */ |
| 213 | + } > m_data |
| 214 | + |
| 215 | + .crash_data_ram : |
| 216 | + { |
| 217 | + . = ALIGN(8); |
| 218 | + __CRASH_DATA_RAM__ = .; |
| 219 | + __CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */ |
| 220 | + KEEP(*(.keep.crash_data_ram)) |
| 221 | + *(.m_crash_data_ram) /* This is a user defined section */ |
| 222 | + . += M_CRASH_DATA_RAM_SIZE; |
| 223 | + . = ALIGN(8); |
| 224 | + __CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */ |
| 225 | + } > m_data |
| 226 | + |
| 227 | + .heap_0 : |
| 228 | + { |
| 229 | + . = ALIGN(8); |
| 230 | + __mbed_sbrk_start_0 = .; |
| 231 | + . += (ORIGIN(m_data) + LENGTH(m_data) - .); |
| 232 | + __mbed_krbs_start_0 = .; |
| 233 | + } > m_data |
| 234 | + |
| 235 | + __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts); |
| 236 | + __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0; |
| 237 | + |
| 238 | + .data : |
| 239 | + { |
| 240 | + PROVIDE(__etext = LOADADDR(.data)); /* Define a global symbol at end of code, */ |
| 241 | + PROVIDE(__DATA_ROM = LOADADDR(.data)); /* Symbol is used by startup for data initialization. */ |
| 242 | + . = ALIGN(8); |
| 243 | + __DATA_RAM = .; |
| 244 | + __data_start__ = .; /* create a global symbol at data start */ |
| 245 | + *(.data) /* .data sections */ |
| 246 | + *(.data*) /* .data* sections */ |
| 247 | + KEEP(*(.jcr*)) |
| 248 | + . = ALIGN(8); |
| 249 | + __data_end__ = .; /* define a global symbol at data end */ |
| 250 | + } > m_data_2 AT > m_text |
| 251 | + |
| 252 | + __DATA_END = __DATA_ROM + (__data_end__ - __data_start__); |
| 253 | + text_end = ORIGIN(m_text) + LENGTH(m_text); |
| 254 | + ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") |
| 255 | + |
| 256 | + |
| 257 | + /* Uninitialized data section |
| 258 | + * This region is not initialized by the C/C++ library and can be used to |
| 259 | + * store state across soft reboots. */ |
| 260 | + .uninitialized (NOLOAD): |
| 261 | + { |
| 262 | + . = ALIGN(32); |
| 263 | + __uninitialized_start = .; |
| 264 | + *(.uninitialized) |
| 265 | + KEEP(*(.keep.uninitialized)) |
| 266 | + . = ALIGN(32); |
| 267 | + __uninitialized_end = .; |
| 268 | + } > m_data_2 |
| 269 | + |
| 270 | + USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x800; |
| 271 | + |
| 272 | + /* Uninitialized data section */ |
| 273 | + .bss : |
| 274 | + { |
| 275 | + /* This is used by the startup in order to initialize the .bss section */ |
| 276 | + . = ALIGN(8); |
| 277 | + __START_BSS = .; |
| 278 | + __bss_start__ = .; |
| 279 | + *(.bss) |
| 280 | + *(.bss*) |
| 281 | + . = ALIGN(512); |
| 282 | + USB_RAM_START = .; |
| 283 | + . += USB_RAM_GAP; |
| 284 | + *(COMMON) |
| 285 | + . = ALIGN(8); |
| 286 | + __bss_end__ = .; |
| 287 | + __END_BSS = .; |
| 288 | + } > m_data_2 |
| 289 | + |
| 290 | + .heap : |
| 291 | + { |
| 292 | + . = ALIGN(8); |
| 293 | + __end__ = .; |
| 294 | + PROVIDE(end = .); |
| 295 | + __mbed_sbrk_start = .; |
| 296 | + __HeapBase = .; |
| 297 | + . = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE; |
| 298 | + __mbed_krbs_start = .; |
| 299 | + __HeapLimit = .; |
| 300 | + __heap_limit = .; /* Add for _sbrk */ |
| 301 | + } > m_data_2 |
| 302 | + |
| 303 | + m_usb_bdt USB_RAM_START (NOLOAD) : |
| 304 | + { |
| 305 | + *(m_usb_bdt) |
| 306 | + USB_RAM_BDT_END = .; |
| 307 | + } |
| 308 | + |
| 309 | + m_usb_global USB_RAM_BDT_END (NOLOAD) : |
| 310 | + { |
| 311 | + *(m_usb_global) |
| 312 | + } |
| 313 | + |
| 314 | + /* Initializes stack on the end of block */ |
| 315 | + __StackTop = ORIGIN(m_data_2) + LENGTH(m_data_2); |
| 316 | + __StackLimit = __StackTop - STACK_SIZE; |
| 317 | + PROVIDE(__stack = __StackTop); |
| 318 | + |
| 319 | + .ARM.attributes 0 : { *(.ARM.attributes) } |
| 320 | + |
| 321 | + ASSERT(__StackLimit >= __HeapLimit, "Region m_data_2 overflowed with stack and heap") |
| 322 | + |
| 323 | +} |
0 commit comments