1/* 2** ################################################################### 3** Processors: MKL17Z32VDA4 4** MKL17Z32VFM4 5** MKL17Z32VFT4 6** MKL17Z32VLH4 7** MKL17Z32VMP4 8** 9** Compiler: GNU C Compiler 10** Reference manual: KL17P64M48SF2RM, Rev. 1, Sep 2014 11** Version: rev. 1.3, 2014-09-22 12** Build: b190916 13** 14** Abstract: 15** Linker file for the GNU C Compiler 16** 17** Copyright 2016 Freescale Semiconductor, Inc. 18** Copyright 2016-2019 NXP 19** All rights reserved. 20** 21** SPDX-License-Identifier: BSD-3-Clause 22** 23** http: www.nxp.com 24** mail: support@nxp.com 25** 26** ################################################################### 27*/ 28 29/* Entry Point */ 30ENTRY(Reset_Handler) 31 32HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0200; 33STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0100; 34 35/* Specify the memory areas */ 36MEMORY 37{ 38 m_interrupts (RX) : ORIGIN = 0x1FFFF800, LENGTH = 0x00000200 39 m_data (RW) : ORIGIN = 0x1FFFFA00, LENGTH = 0x00000600 40 m_text (RX) : ORIGIN = 0x20000000, LENGTH = 0x00001800 41} 42 43/* Define output sections */ 44SECTIONS 45{ 46 /* The startup code goes first into internal RAM */ 47 .interrupts : 48 { 49 . = ALIGN(4); 50 KEEP(*(.isr_vector)) /* Startup code */ 51 . = ALIGN(4); 52 } > m_interrupts 53 54 /* The program code and other data goes into internal RAM */ 55 .text : 56 { 57 . = ALIGN(4); 58 *(.text) /* .text sections (code) */ 59 *(.text*) /* .text* sections (code) */ 60 *(.rodata) /* .rodata sections (constants, strings, etc.) */ 61 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 62 *(.glue_7) /* glue arm to thumb code */ 63 *(.glue_7t) /* glue thumb to arm code */ 64 *(.eh_frame) 65 KEEP (*(.init)) 66 KEEP (*(.fini)) 67 . = ALIGN(4); 68 } > m_text 69 70 .ARM.extab : 71 { 72 *(.ARM.extab* .gnu.linkonce.armextab.*) 73 } > m_text 74 75 .ARM : 76 { 77 __exidx_start = .; 78 *(.ARM.exidx*) 79 __exidx_end = .; 80 } > m_text 81 82 .ctors : 83 { 84 __CTOR_LIST__ = .; 85 /* gcc uses crtbegin.o to find the start of 86 the constructors, so we make sure it is 87 first. Because this is a wildcard, it 88 doesn't matter if the user does not 89 actually link against crtbegin.o; the 90 linker won't look for a file to match a 91 wildcard. The wildcard also means that it 92 doesn't matter which directory crtbegin.o 93 is in. */ 94 KEEP (*crtbegin.o(.ctors)) 95 KEEP (*crtbegin?.o(.ctors)) 96 /* We don't want to include the .ctor section from 97 from the crtend.o file until after the sorted ctors. 98 The .ctor section from the crtend file contains the 99 end of ctors marker and it must be last */ 100 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) 101 KEEP (*(SORT(.ctors.*))) 102 KEEP (*(.ctors)) 103 __CTOR_END__ = .; 104 } > m_text 105 106 .dtors : 107 { 108 __DTOR_LIST__ = .; 109 KEEP (*crtbegin.o(.dtors)) 110 KEEP (*crtbegin?.o(.dtors)) 111 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) 112 KEEP (*(SORT(.dtors.*))) 113 KEEP (*(.dtors)) 114 __DTOR_END__ = .; 115 } > m_text 116 117 .preinit_array : 118 { 119 PROVIDE_HIDDEN (__preinit_array_start = .); 120 KEEP (*(.preinit_array*)) 121 PROVIDE_HIDDEN (__preinit_array_end = .); 122 } > m_text 123 124 .init_array : 125 { 126 PROVIDE_HIDDEN (__init_array_start = .); 127 KEEP (*(SORT(.init_array.*))) 128 KEEP (*(.init_array*)) 129 PROVIDE_HIDDEN (__init_array_end = .); 130 } > m_text 131 132 .fini_array : 133 { 134 PROVIDE_HIDDEN (__fini_array_start = .); 135 KEEP (*(SORT(.fini_array.*))) 136 KEEP (*(.fini_array*)) 137 PROVIDE_HIDDEN (__fini_array_end = .); 138 } > m_text 139 140 __etext = .; /* define a global symbol at end of code */ 141 __DATA_ROM = .; /* Symbol is used by startup for data initialization */ 142 143 /* reserve MTB memory at the beginning of m_data */ 144 .mtb : /* MTB buffer address as defined by the hardware */ 145 { 146 . = ALIGN(8); 147 _mtb_start = .; 148 KEEP(*(.mtb_buf)) /* need to KEEP Micro Trace Buffer as not referenced by application */ 149 . = ALIGN(8); 150 _mtb_end = .; 151 } > m_data 152 153 .data : AT(__DATA_ROM) 154 { 155 . = ALIGN(4); 156 __DATA_RAM = .; 157 __data_start__ = .; /* create a global symbol at data start */ 158 *(.data) /* .data sections */ 159 *(.data*) /* .data* sections */ 160 KEEP(*(.jcr*)) 161 . = ALIGN(4); 162 __data_end__ = .; /* define a global symbol at data end */ 163 } > m_data 164 165 __DATA_END = __DATA_ROM + (__data_end__ - __data_start__); 166 text_end = ORIGIN(m_text) + LENGTH(m_text); 167 ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") 168 169 /* Uninitialized data section */ 170 .bss : 171 { 172 /* This is used by the startup in order to initialize the .bss section */ 173 . = ALIGN(4); 174 __START_BSS = .; 175 __bss_start__ = .; 176 *(.bss) 177 *(.bss*) 178 *(COMMON) 179 . = ALIGN(4); 180 __bss_end__ = .; 181 __END_BSS = .; 182 } > m_data 183 184 .heap : 185 { 186 . = ALIGN(8); 187 __end__ = .; 188 PROVIDE(end = .); 189 __HeapBase = .; 190 . += HEAP_SIZE; 191 __HeapLimit = .; 192 __heap_limit = .; /* Add for _sbrk */ 193 } > m_data 194 195 .stack : 196 { 197 . = ALIGN(8); 198 . += STACK_SIZE; 199 } > m_data 200 201 /* Initializes stack on the end of block */ 202 __StackTop = ORIGIN(m_data) + LENGTH(m_data); 203 __StackLimit = __StackTop - STACK_SIZE; 204 PROVIDE(__stack = __StackTop); 205 206 .ARM.attributes 0 : { *(.ARM.attributes) } 207 208 ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") 209} 210 211