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