1 /* 2 ** ################################################################### 3 ** Processor: MPC5744P with 384 KB SRAM 4 ** Compiler: GNU C Compiler 5 ** 6 ** Abstract: 7 ** Linker file for the GNU C Compiler 8 ** 9 ** Copyright 2017-2019 NXP 10 ** All rights reserved. 11 ** 12 ** THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR 13 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 14 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 15 ** IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 16 ** INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 18 ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 20 ** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 ** IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 ** THE POSSIBILITY OF SUCH DAMAGE. 23 ** 24 ** http: www.nxp.com 25 ** 26 ** ################################################################### 27 */ 28 29 /* Entry Point */ 30 ENTRY(_start) 31 32 /* define heap and stack size */ 33 __HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000000; 34 __STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00001000; 35 36 /* Define FLASH */ 37 FLASH_BASE_ADDR = DEFINED(__flash_base_addr__) ? __flash_base_addr__ : 0x01000000; 38 FLASH_SIZE = DEFINED(__flash_size__) ? __flash_size__ : 2048K; 39 40 /* Define SRAM */ 41 SRAM_BASE_ADDR = DEFINED(__sram_base_addr__) ? __sram_base_addr__ : 0x40000000; 42 SRAM_SIZE = DEFINED(__sram_size__) ? __sram_size__ : 384K; 43 44 /* Define local data memory */ 45 LOCAL_DMEM_BASE_ADDR = DEFINED(__local_dmem_base_addr__) ? __local_dmem_base_addr__ : 0x50800000; 46 LOCAL_DMEM_SIZE = DEFINED(__local_dmem_size__) ? __local_dmem_size__ : 64K; 47 48 MEMORY 49 { 50 flash_rchw : org = 0x00FA0000, len = 0x4 51 cpu0_reset_vec : org = 0x00FA0000+0x04, len = 0x4 52 53 m_text : org = FLASH_BASE_ADDR, len = FLASH_SIZE 54 m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE 55 local_dmem : org = LOCAL_DMEM_BASE_ADDR, len = LOCAL_DMEM_SIZE 56 } 57 58 59 SECTIONS 60 { 61 .rchw : 62 { 63 KEEP(*(.rchw)) 64 } > flash_rchw 65 66 .cpu0_reset_vector : 67 { 68 KEEP(*(.cpu0_reset_vector)) 69 } > cpu0_reset_vec 70 71 /* Note: if you move the 'startup' section shall modify the RCHW2_2 value for the corresponding core in the flashrchw.c file. */ 72 .startup : ALIGN(0x400) 73 { 74 __start = .; 75 *(.startup) 76 } > m_text 77 78 .core_exceptions_table : ALIGN(4096) 79 { 80 __IVPR_VALUE = .; 81 *(.core_exceptions_table) 82 } > m_text 83 84 .intc_vector_table : ALIGN(4096) 85 { 86 __VECTOR_TABLE = .; 87 __interrupts_start__ = .; 88 KEEP(*(.intc_vector_table)) /* Startup code */ 89 __interrupts_end__ = .; 90 } > m_text 91 __RAM_VECTOR_TABLE_SIZE = 0xC00; 92 __VECTOR_TABLE_COPY_END = __VECTOR_TABLE + __RAM_VECTOR_TABLE_SIZE; 93 94 .text : 95 { 96 *(.text.startup) 97 *(.text) 98 *(.text.*) 99 KEEP(*(.init)) 100 KEEP(*(.fini)) 101 . = ALIGN(16); 102 } > m_text 103 .sdata2 : 104 { 105 . = ALIGN(4); 106 __sdata2_start__ = .; /* Create a global symbol at sdata2 start. */ 107 *(.sdata2) 108 *(.sdata2.*) 109 . = ALIGN(4); 110 __sdata2_end__ = .; /* Define a global symbol at sdata2 end. */ 111 } > m_text 112 .got2 : 113 { 114 *(.got2*) 115 } > m_text 116 /* migration to version v1.2 117 define section PREINIT_ARRAY */ 118 119 .preinit_array : 120 { 121 PROVIDE_HIDDEN (__preinit_array_start = .); 122 KEEP (*(.preinit_array)) 123 PROVIDE_HIDDEN (__preinit_array_end = .); 124 } > m_text 125 126 /* end section PREINIT_ARRAY */ 127 /* migration to version v1.2 128 define section INIT_ARRAY*/ 129 130 .init_array : 131 { 132 PROVIDE_HIDDEN (__init_array_start = .); 133 KEEP (*(SORT(.init_array.*))) 134 KEEP (*(.init_array )) 135 PROVIDE_HIDDEN (__init_array_end = .); 136 } > m_text 137 138 /* end section INIT_ARRAY */ 139 140 /* migration to version v1.2 141 define section DTORS */ 142 143 .dtors : 144 { 145 KEEP (*crtbegin.o(.dtors)) 146 KEEP (*crtbegin?.o(.dtors)) 147 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) 148 KEEP (*(SORT(.dtors.*))) 149 KEEP (*(.dtors)) 150 } > m_text 151 152 /* end section DTORS */ 153 /* migration to version v1.2 154 define section CTORS */ 155 156 .ctors : 157 { 158 /* gcc uses crtbegin.o to find the start of 159 the constructors, so we make sure it is 160 first. Because this is a wildcard, it 161 doesn't matter if the user does not 162 actually link against crtbegin.o; the 163 linker won't look for a file to match a 164 wildcard. The wildcard also means that it 165 doesn't matter which directory crtbegin.o 166 is in. */ 167 KEEP (*crtbegin.o(.ctors)) 168 KEEP (*crtbegin?.o(.ctors)) 169 /* We don't want to include the .ctor section from 170 the crtend.o file until after the sorted ctors. 171 The .ctor section from the crtend file contains the 172 end of ctors marker and it must be last */ 173 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) 174 KEEP (*(SORT(.ctors.*))) 175 KEEP (*(.ctors)) 176 } > m_text 177 178 /* end section CTORS */ 179 180 /* migration to version v1.2 181 define section FINI_ARRAY */ 182 183 .fini_array : 184 { 185 PROVIDE_HIDDEN (__fini_array_start = .); 186 KEEP (*(SORT(.fini_array.*))) 187 KEEP (*(.fini_array )) 188 PROVIDE_HIDDEN (__fini_array_end = .); 189 } > m_text 190 191 /* end section FINI_ARRAY */ 192 193 .rodata : 194 { 195 *(.rodata) 196 *(.rodata.*) 197 } > m_text 198 199 .eh_frame_hdr : { *(.eh_frame_hdr) } > m_text 200 .eh_frame : { KEEP (*(.eh_frame)) } > m_text 201 202 /* Sections used by startup for data initialization. */ 203 .init_table : 204 { 205 . = ALIGN(4); 206 __COPY_TABLE = .; 207 KEEP(*(.init_table)) 208 } > m_text 209 .zero_table : 210 { 211 . = ALIGN(4); 212 __ZERO_TABLE = .; 213 KEEP(*(.zero_table)) 214 } > m_text 215 216 __TEXT_END = .; /* Define a global symbol at end of code. */ 217 218 .interrupts_ram : ALIGN(4096) 219 { 220 __VECTOR_RAM = .; 221 *(.m_interrupts_ram) 222 . += __RAM_VECTOR_TABLE_SIZE; 223 } > m_data 224 225 __CUSTOM_ROM = __TEXT_END; /* Symbol is used by startup for custom initialization. */ 226 .customSectionBlock : AT (__CUSTOM_ROM) 227 { 228 . = ALIGN(4); 229 __CUSTOM_RAM = .; 230 __customSectionStart = .; 231 __customSection_start__ = .; 232 KEEP(*(.customSection)) /* Keep section even if not referenced. */ 233 . = ALIGN(4); 234 __customSection_end__ = .; 235 __customSectionEnd = .; 236 } > m_data 237 __CUSTOM_END = __CUSTOM_ROM + (__customSection_end__ - __customSection_start__); 238 239 __DATA_ROM = __CUSTOM_END; /* Symbol is used by startup for data initialization. */ 240 .data : AT (__DATA_ROM) 241 { 242 . = ALIGN(4); 243 __DATA_RAM = .; 244 __data_start__ = .; /* Create a global symbol at data start. */ 245 *(.data) 246 *(.data.*) 247 . = ALIGN(4); 248 __data_end__ = .; /* Define a global symbol at data end. */ 249 } > m_data 250 __DATA_END = __DATA_ROM + (__data_end__ - __data_start__); 251 252 __SDATA_ROM = __DATA_END; /* Symbol is used by startup for sdata initialization. */ 253 .sdata : AT (__SDATA_ROM) 254 { 255 . = ALIGN(4); 256 __SDATA_RAM = .; 257 __sdata_start__ = .; /* Create a global symbol at sdata start. */ 258 *(.sdata) 259 *(.sdata.*) 260 . = ALIGN(4); 261 __sdata_end__ = .; /* Define a global symbol at sdata end. */ 262 } > m_data 263 __SDATA_END = __SDATA_ROM + (__sdata_end__ - __sdata_start__); 264 265 .sbss (NOLOAD) : 266 { 267 . = ALIGN(4); 268 __SBSS_START = .; 269 __sbss_start__ = .; /* Create a global symbol at sbss start. */ 270 *(.sbss) 271 *(.sbss.*) 272 . = ALIGN(4); 273 __sbss_end__ = .; /* Define a global symbol at sbss end. */ 274 __SBSS_END = .; 275 } > m_data 276 277 .bss (NOLOAD) : 278 { 279 . = ALIGN(4); 280 __BSS_START = .; 281 __bss_start__ = .; /* Create a global symbol at bss start. */ 282 *(.bss) 283 *(.bss.*) 284 *(COMMON) 285 . = ALIGN(4); 286 __bss_end__ = .; /* Define a global symbol at bss end. */ 287 __BSS_END = .; 288 } > m_data 289 290 __CODE_ROM = __SDATA_END; /* Symbol is used by code initialization. */ 291 .code : AT (__CODE_ROM) 292 { 293 . = ALIGN(4); 294 __CODE_RAM = .; 295 __code_start__ = .; /* Create a global symbol at code start. */ 296 __code_ram_start__ = .; 297 KEEP(*(.code_ram)) /* Custom section for storing code in RAM */ 298 . = ALIGN(4); 299 __code_ram_end__ = .; 300 __code_end__ = .; /* Define a global symbol at code end. */ 301 } > m_data 302 __CODE_END = __CODE_ROM + (__code_end__ - __code_start__); 303 304 .stack (NOLOAD) : ALIGN(16) 305 { 306 __HEAP = .; 307 PROVIDE (_end = .); 308 PROVIDE (end = .); 309 . += __HEAP_SIZE; 310 __HEAP_END = .; 311 _stack_end = .; 312 . += __STACK_SIZE; 313 . = ALIGN(4); 314 _stack_addr = .; 315 __SP_INIT = .; 316 } > local_dmem 317 318 /*-------- LABELS USED IN CODE -------------------------------*/ 319 320 /* Labels Used for Initialising SRAM ECC */ 321 __SRAM_SIZE = SRAM_SIZE; 322 __SRAM_BASE_ADDR = SRAM_BASE_ADDR; 323 /* Labels Used for Initialising DMEM */ 324 __LOCAL_DMEM_SIZE = LOCAL_DMEM_SIZE; 325 __LOCAL_DMEM_BASE_ADDR = LOCAL_DMEM_BASE_ADDR; 326 327 __BSS_SIZE = __BSS_END - __BSS_START; 328 329 }
标签:__,linker,end,text,ALIGN,flash,KEEP,start,MPC5744P From: https://www.cnblogs.com/kunshanpipixia/p/17158619.html