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