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