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