1/* 2** ################################################################### 3** Processors: MIMXRT1021CAF4A 4** MIMXRT1021CAF4B 5** MIMXRT1021CAG4A 6** MIMXRT1021CAG4B 7** MIMXRT1021DAF5A 8** MIMXRT1021DAF5B 9** MIMXRT1021DAG5A 10** MIMXRT1021DAG5B 11** 12** Compiler: GNU C Compiler 13** Reference manual: IMXRT1020RM Rev.2, 01/2021 | IMXRT102XSRM Rev.0 14** Version: rev. 0.1, 2017-06-06 15** Build: b230821 16** 17** Abstract: 18** Linker file for the GNU C Compiler 19** 20** Copyright 2016 Freescale Semiconductor, Inc. 21** Copyright 2016-2023 NXP 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; 35NCACHE_HEAP_START = DEFINED(__heap_noncacheable__) ? 0x82000000 - HEAP_SIZE : 0x20220000 - HEAP_SIZE; 36NCACHE_HEAP_SIZE = DEFINED(__heap_noncacheable__) ? HEAP_SIZE : 0x0000; 37 38/* Specify the memory areas */ 39MEMORY 40{ 41 m_interrupts (RX) : ORIGIN = 0x80000000, LENGTH = 0x00000400 42 m_text (RX) : ORIGIN = 0x80000400, LENGTH = 0x001FFC00 43 m_qacode (RX) : ORIGIN = 0x00000000, LENGTH = 0x00010000 44 m_data (RW) : ORIGIN = 0x20200000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x00020000 : 0x00020000 - HEAP_SIZE 45 m_data2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000 46 m_data3 (RW) : ORIGIN = 0x80200000, LENGTH = 0x01C00000 47 m_ncache (RW) : ORIGIN = 0x81E00000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x00200000 - HEAP_SIZE : 0x00200000 48 m_heap (RW) : ORIGIN = NCACHE_HEAP_START, LENGTH = HEAP_SIZE 49} 50 51/* Define output sections */ 52SECTIONS 53{ 54 __NCACHE_REGION_START = ORIGIN(m_ncache); 55 __NCACHE_REGION_SIZE = LENGTH(m_ncache) + NCACHE_HEAP_SIZE; 56 57 /* The startup code goes first into internal RAM */ 58 .interrupts : 59 { 60 __VECTOR_TABLE = .; 61 __Vectors = .; 62 . = ALIGN(4); 63 KEEP(*(.isr_vector)) /* Startup code */ 64 . = ALIGN(4); 65 } > m_interrupts 66 67 /* The program code and other data goes into internal RAM */ 68 .text : 69 { 70 . = ALIGN(4); 71 *(.text) /* .text sections (code) */ 72 *(.text*) /* .text* sections (code) */ 73 *(.rodata) /* .rodata sections (constants, strings, etc.) */ 74 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 75 *(.glue_7) /* glue arm to thumb code */ 76 *(.glue_7t) /* glue thumb to arm code */ 77 *(.eh_frame) 78 KEEP (*(.init)) 79 KEEP (*(.fini)) 80 . = ALIGN(4); 81 } > m_text 82 83 .ARM.extab : 84 { 85 *(.ARM.extab* .gnu.linkonce.armextab.*) 86 } > m_text 87 88 .ARM : 89 { 90 __exidx_start = .; 91 *(.ARM.exidx*) 92 __exidx_end = .; 93 } > m_text 94 95 .ctors : 96 { 97 __CTOR_LIST__ = .; 98 /* gcc uses crtbegin.o to find the start of 99 the constructors, so we make sure it is 100 first. Because this is a wildcard, it 101 doesn't matter if the user does not 102 actually link against crtbegin.o; the 103 linker won't look for a file to match a 104 wildcard. The wildcard also means that it 105 doesn't matter which directory crtbegin.o 106 is in. */ 107 KEEP (*crtbegin.o(.ctors)) 108 KEEP (*crtbegin?.o(.ctors)) 109 /* We don't want to include the .ctor section from 110 from the crtend.o file until after the sorted ctors. 111 The .ctor section from the crtend file contains the 112 end of ctors marker and it must be last */ 113 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) 114 KEEP (*(SORT(.ctors.*))) 115 KEEP (*(.ctors)) 116 __CTOR_END__ = .; 117 } > m_text 118 119 .dtors : 120 { 121 __DTOR_LIST__ = .; 122 KEEP (*crtbegin.o(.dtors)) 123 KEEP (*crtbegin?.o(.dtors)) 124 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) 125 KEEP (*(SORT(.dtors.*))) 126 KEEP (*(.dtors)) 127 __DTOR_END__ = .; 128 } > m_text 129 130 .preinit_array : 131 { 132 PROVIDE_HIDDEN (__preinit_array_start = .); 133 KEEP (*(.preinit_array*)) 134 PROVIDE_HIDDEN (__preinit_array_end = .); 135 } > m_text 136 137 .init_array : 138 { 139 PROVIDE_HIDDEN (__init_array_start = .); 140 KEEP (*(SORT(.init_array.*))) 141 KEEP (*(.init_array*)) 142 PROVIDE_HIDDEN (__init_array_end = .); 143 } > m_text 144 145 .fini_array : 146 { 147 PROVIDE_HIDDEN (__fini_array_start = .); 148 KEEP (*(SORT(.fini_array.*))) 149 KEEP (*(.fini_array*)) 150 PROVIDE_HIDDEN (__fini_array_end = .); 151 } > m_text 152 153 __etext = .; /* define a global symbol at end of code */ 154 __DATA_ROM = .; /* Symbol is used by startup for data initialization */ 155 156 __VECTOR_RAM = ORIGIN(m_interrupts); 157 __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0; 158 159 .data : AT(__DATA_ROM) 160 { 161 . = ALIGN(4); 162 __DATA_RAM = .; 163 __data_start__ = .; /* create a global symbol at data start */ 164 *(m_usb_dma_init_data) 165 *(.data) /* .data sections */ 166 *(.data*) /* .data* sections */ 167 KEEP(*(.jcr*)) 168 . = ALIGN(4); 169 __data_end__ = .; /* define a global symbol at data end */ 170 } > m_data 171 172 __ram_function_flash_start = __DATA_ROM + (__data_end__ - __data_start__); /* Symbol is used by startup for TCM data initialization */ 173 174 .ram_function : AT(__ram_function_flash_start) 175 { 176 . = ALIGN(32); 177 __ram_function_start__ = .; 178 *(CodeQuickAccess) 179 . = ALIGN(128); 180 __ram_function_end__ = .; 181 } > m_qacode 182 183 __NDATA_ROM = __ram_function_flash_start + (__ram_function_end__ - __ram_function_start__); 184 .ncache.init : AT(__NDATA_ROM) 185 { 186 __noncachedata_start__ = .; /* create a global symbol at ncache data start */ 187 *(NonCacheable.init) 188 . = ALIGN(4); 189 __noncachedata_init_end__ = .; /* create a global symbol at initialized ncache data end */ 190 } > m_ncache 191 . = __noncachedata_init_end__; 192 .ncache : 193 { 194 *(NonCacheable) 195 . = ALIGN(4); 196 __noncachedata_end__ = .; /* define a global symbol at ncache data end */ 197 } > m_ncache 198 199 __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__); 200 text_end = ORIGIN(m_text) + LENGTH(m_text); 201 ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") 202 203 .qadata : 204 { 205 . = ALIGN(4); 206 *(DataQuickAccess) /* quick access data section */ 207 . = ALIGN(4); 208 } > m_data2 209 210 /* Uninitialized data section */ 211 .bss : 212 { 213 /* This is used by the startup in order to initialize the .bss section */ 214 . = ALIGN(4); 215 __START_BSS = .; 216 __bss_start__ = .; 217 *(m_usb_dma_noninit_data) 218 *(.bss) 219 *(.bss*) 220 *(COMMON) 221 . = ALIGN(4); 222 __bss_end__ = .; 223 __END_BSS = .; 224 } > m_data 225 226 .heap : 227 { 228 . = ALIGN(8); 229 __end__ = .; 230 PROVIDE(end = .); 231 __HeapBase = .; 232 . += HEAP_SIZE; 233 __HeapLimit = .; 234 __heap_limit = .; /* Add for _sbrk */ 235 } > m_heap 236 237 .stack : 238 { 239 . = ALIGN(8); 240 . += STACK_SIZE; 241 } > m_data 242 243 /* Initializes stack on the end of block */ 244 __StackTop = ORIGIN(m_data) + LENGTH(m_data); 245 __StackLimit = __StackTop - STACK_SIZE; 246 PROVIDE(__stack = __StackTop); 247 248 .ARM.attributes 0 : { *(.ARM.attributes) } 249} 250