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