1/* 2** ################################################################### 3** Processor: MIMX8DX4AVLFZ 4** Compiler: GNU C Compiler 5** Reference manual: IMX8DQXPRM, Rev. E, 6/2019 6** Version: rev. 4.0, 2020-06-19 7** Build: b201113 8** 9** Abstract: 10** Linker file for the GNU C Compiler 11** 12** Copyright 2016 Freescale Semiconductor, Inc. 13** Copyright 2016-2020 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/* Reserved for PFU fetches, which is six 16-bit Thumb instructions */ 31SAFE_BOUNDARY_LEN = 12; 32 33/* Specify the memory areas */ 34/* M4 always start up from TCM. The SCU will copy the first 32 bytes of the binary to TCM 35if the start address is not TCM. The TCM region [0x1FFE0000-0x1FFE001F] is reserved for this purpose. */ 36MEMORY 37{ 38 m_interrupts (RX) : ORIGIN = DEFINED(__STARTUP_CONFIG_DDR_ALIAS)?0x08000000:0x88000000, LENGTH = 0x00000A00 39 m_text (RX) : ORIGIN = DEFINED(__STARTUP_CONFIG_DDR_ALIAS)?0x08000A00:0x88000A00, LENGTH = 0x001FF600 40 m_data (RW) : ORIGIN = 0x88200000, LENGTH = 0x00200000 41 m_data2 (RW) : ORIGIN = 0x88400000, LENGTH = 0x07C00000 42 m_tcml (RW) : ORIGIN = 0x1FFE0020, LENGTH = 0x0001FFE0 43 m_tcmu (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000 44} 45 46/* Define output sections */ 47SECTIONS 48{ 49 /* The startup code goes first into internal RAM */ 50 .interrupts : 51 { 52 . = ALIGN(4); 53 KEEP(*(.isr_vector)) /* Startup code */ 54 . = ALIGN(4); 55 } > m_interrupts 56 57 .resource_table : 58 { 59 . = ALIGN(8); 60 KEEP(*(.resource_table)) /* Resource table */ 61 . = ALIGN(8); 62 } > m_text 63 64 /* The program code and other data goes into internal RAM */ 65 .text : 66 { 67 . = ALIGN(4); 68 *(.text) /* .text sections (code) */ 69 *(.text*) /* .text* sections (code) */ 70 *(.rodata) /* .rodata sections (constants, strings, etc.) */ 71 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 72 *(.glue_7) /* glue arm to thumb code */ 73 *(.glue_7t) /* glue thumb to arm code */ 74 *(.eh_frame) 75 KEEP (*(.init)) 76 KEEP (*(.fini)) 77 . = ALIGN(4); 78 } > m_text 79 80 .ARM.extab : 81 { 82 *(.ARM.extab* .gnu.linkonce.armextab.*) 83 } > m_text 84 85 .ARM : 86 { 87 __exidx_start = .; 88 *(.ARM.exidx*) 89 __exidx_end = .; 90 } > m_text 91 92 .ctors : 93 { 94 __CTOR_LIST__ = .; 95 /* gcc uses crtbegin.o to find the start of 96 the constructors, so we make sure it is 97 first. Because this is a wildcard, it 98 doesn't matter if the user does not 99 actually link against crtbegin.o; the 100 linker won't look for a file to match a 101 wildcard. The wildcard also means that it 102 doesn't matter which directory crtbegin.o 103 is in. */ 104 KEEP (*crtbegin.o(.ctors)) 105 KEEP (*crtbegin?.o(.ctors)) 106 /* We don't want to include the .ctor section from 107 from the crtend.o file until after the sorted ctors. 108 The .ctor section from the crtend file contains the 109 end of ctors marker and it must be last */ 110 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) 111 KEEP (*(SORT(.ctors.*))) 112 KEEP (*(.ctors)) 113 __CTOR_END__ = .; 114 } > m_text 115 116 .dtors : 117 { 118 __DTOR_LIST__ = .; 119 KEEP (*crtbegin.o(.dtors)) 120 KEEP (*crtbegin?.o(.dtors)) 121 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) 122 KEEP (*(SORT(.dtors.*))) 123 KEEP (*(.dtors)) 124 __DTOR_END__ = .; 125 } > m_text 126 127 .preinit_array : 128 { 129 PROVIDE_HIDDEN (__preinit_array_start = .); 130 KEEP (*(.preinit_array*)) 131 PROVIDE_HIDDEN (__preinit_array_end = .); 132 } > m_text 133 134 .init_array : 135 { 136 PROVIDE_HIDDEN (__init_array_start = .); 137 KEEP (*(SORT(.init_array.*))) 138 KEEP (*(.init_array*)) 139 PROVIDE_HIDDEN (__init_array_end = .); 140 } > m_text 141 142 .fini_array : 143 { 144 PROVIDE_HIDDEN (__fini_array_start = .); 145 KEEP (*(SORT(.fini_array.*))) 146 KEEP (*(.fini_array*)) 147 PROVIDE_HIDDEN (__fini_array_end = .); 148 } > m_text 149 150 __etext = .; /* define a global symbol at end of code */ 151 __DATA_ROM = .; /* Symbol is used by startup for data initialization */ 152 153 .data : AT(__DATA_ROM) 154 { 155 . = ALIGN(4); 156 __DATA_RAM = .; 157 __data_start__ = .; /* create a global symbol at data start */ 158 *(.data) /* .data sections */ 159 *(.data*) /* .data* sections */ 160 KEEP(*(.jcr*)) 161 . = ALIGN(4); 162 __data_end__ = .; /* define a global symbol at data end */ 163 } > m_data 164 165 __TDATA_ROM = __DATA_ROM + SIZEOF(.data); /* Symbol is used by startup for TCM data initialization */ 166 .quickaccess : AT(__TDATA_ROM) 167 { 168 __quickaccess_start__ = .; 169 . = ALIGN(32); 170 *(CodeQuickAccess) 171 . += SAFE_BOUNDARY_LEN; 172 *(DataQuickAccess) 173 . = ALIGN(128); 174 __quickaccess_end__ = .; 175 } > m_tcml 176 177 __CACHE_REGION_START = DEFINED(__STARTUP_CONFIG_DDR_ALIAS) ? ORIGIN(m_data) : ORIGIN(m_interrupts); 178 __CACHE_REGION_SIZE = DEFINED(__STARTUP_CONFIG_DDR_ALIAS) ? LENGTH(m_data) : LENGTH(m_interrupts) + LENGTH(m_text) + LENGTH(m_data); 179 180 181 __NDATA_ROM = __TDATA_ROM + SIZEOF(.quickaccess); /* Symbol is used by startup for ncache data initialization */ 182 183 .ncache.init : AT(__NDATA_ROM) 184 { 185 __noncachedata_start__ = .; /* create a global symbol at ncache data start */ 186 *(NonCacheable.init) 187 . = ALIGN(4); 188 __noncachedata_init_end__ = .; /* create a global symbol at initialized ncache data end */ 189 } > m_data2 190 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_data2 198 199 __DATA_END = __NDATA_ROM + SIZEOF(.ncache.init); 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 /* Uninitialized data section */ 204 .bss : 205 { 206 /* This is used by the startup in order to initialize the .bss section */ 207 . = ALIGN(4); 208 __START_BSS = .; 209 __bss_start__ = .; 210 *(.bss) 211 *(.bss*) 212 *(COMMON) 213 . = ALIGN(4); 214 __bss_end__ = .; 215 __END_BSS = .; 216 } > m_data 217 218 .heap : 219 { 220 . = ALIGN(8); 221 __end__ = .; 222 PROVIDE(end = .); 223 __HeapBase = .; 224 . += HEAP_SIZE; 225 __HeapLimit = .; 226 __heap_limit = .; /* Add for _sbrk */ 227 } > m_data 228 229 .stack : 230 { 231 . = ALIGN(8); 232 . += STACK_SIZE; 233 } > m_data 234 235 /* Initializes stack on the end of block */ 236 __StackTop = ORIGIN(m_data) + LENGTH(m_data); 237 __StackLimit = __StackTop - STACK_SIZE; 238 PROVIDE(__stack = __StackTop); 239 240 .ARM.attributes 0 : { *(.ARM.attributes) } 241 242 ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") 243} 244 245