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