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