1/* 2** ################################################################### 3** Processor: MKM34Z128ACLL5 4** Compiler: GNU C Compiler 5** Reference manual: MKMxxZxxACxx5RM, Rev. 2, 10/2017 6** Version: rev. 1.0, 2014-07-22 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 = 0x1FFFF000, LENGTH = 0x00000200 34 m_data (RW) : ORIGIN = 0x1FFFF200, LENGTH = 0x00000E00 35 m_text (RX) : ORIGIN = 0x20000000, LENGTH = 0x00003000 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 /* reserve MTB memory at the beginning of m_data */ 139 .mtb : /* MTB buffer address as defined by the hardware */ 140 { 141 . = ALIGN(8); 142 _mtb_start = .; 143 KEEP(*(.mtb_buf)) /* need to KEEP Micro Trace Buffer as not referenced by application */ 144 . = ALIGN(8); 145 _mtb_end = .; 146 } > m_data 147 148 .data : AT(__DATA_ROM) 149 { 150 . = ALIGN(4); 151 __DATA_RAM = .; 152 __data_start__ = .; /* create a global symbol at data start */ 153 *(.data) /* .data sections */ 154 *(.data*) /* .data* sections */ 155 *(NonCacheable.init) /* NonCacheable init section */ 156 *(NonCacheable) /* NonCacheable section */ 157 *(CodeQuickAccess) /* quick access code section */ 158 *(DataQuickAccess) /* quick access data section */ 159 KEEP(*(.jcr*)) 160 . = ALIGN(4); 161 __data_end__ = .; /* define a global symbol at data end */ 162 } > m_data 163 164 __DATA_END = __DATA_ROM + (__data_end__ - __data_start__); 165 text_end = ORIGIN(m_text) + LENGTH(m_text); 166 ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") 167 168 /* Uninitialized data section */ 169 .bss : 170 { 171 /* This is used by the startup in order to initialize the .bss section */ 172 . = ALIGN(4); 173 __START_BSS = .; 174 __bss_start__ = .; 175 *(.bss) 176 *(.bss*) 177 *(COMMON) 178 . = ALIGN(4); 179 __bss_end__ = .; 180 __END_BSS = .; 181 } > m_data 182 183 .heap : 184 { 185 . = ALIGN(8); 186 __end__ = .; 187 PROVIDE(end = .); 188 __HeapBase = .; 189 . += HEAP_SIZE; 190 __HeapLimit = .; 191 __heap_limit = .; /* Add for _sbrk */ 192 } > m_data 193 194 .stack : 195 { 196 . = ALIGN(8); 197 . += STACK_SIZE; 198 } > m_data 199 200 /* Initializes stack on the end of block */ 201 __StackTop = ORIGIN(m_data) + LENGTH(m_data); 202 __StackLimit = __StackTop - STACK_SIZE; 203 PROVIDE(__stack = __StackTop); 204 205 .ARM.attributes 0 : { *(.ARM.attributes) } 206 207 ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") 208} 209 210