1/* 2** ################################################################### 3** Processors: LPC5536JBD100 4** LPC5536JBD64 5** LPC5536JHI48 6** 7** Compiler: GNU C Compiler 8** Reference manual: LPC55S3x Reference Manual Rev. DraftG, 07/2021 9** Version: rev. 1.1, 2021-08-04 10** Build: b230601 11** 12** Abstract: 13** Linker file for the GNU C Compiler 14** 15** Copyright 2016 Freescale Semiconductor, Inc. 16** Copyright 2016-2023 NXP 17** SPDX-License-Identifier: BSD-3-Clause 18** 19** http: www.nxp.com 20** mail: support@nxp.com 21** 22** ################################################################### 23*/ 24 25 26 27/* Entry Point */ 28ENTRY(Reset_Handler) 29 30HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; 31STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800; 32 33/* __pkc__ : SRAM A(16K) reserved for; pkc __power_down__ : The first 0x604 bytes reserved to CPU retention for power down mode */ 34RETENTION_RAMSIZE = DEFINED(__pkc__) ? 0x00004000 : (DEFINED(__power_down__) ? 0x00000604 : 0x00000000); 35POWERQUAD_RAMSIZE = DEFINED(__powerquad__) ? 0x00004000 : 0x0; /* SRAM E(16K) reserved for powerquad */ 36 37/* Specify the memory areas */ 38MEMORY 39{ 40 m_interrupts (RX) : ORIGIN = 0x20000000 + RETENTION_RAMSIZE, LENGTH = 0x00000400 41 m_text (RX) : ORIGIN = 0x20000400 + RETENTION_RAMSIZE, LENGTH = 0x0001BC00 - RETENTION_RAMSIZE - POWERQUAD_RAMSIZE 42 m_data (RW) : ORIGIN = 0x04000000, 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 /* 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