1;/* 2; * Copyright (c) 2018-2022 ARM Limited 3; * 4; * Licensed under the Apache License, Version 2.0 (the "License"); 5; * you may not use this file except in compliance with the License. 6; * You may obtain a copy of the License at 7; * 8; * http://www.apache.org/licenses/LICENSE-2.0 9; * 10; * Unless required by applicable law or agreed to in writing, software 11; * distributed under the License is distributed on an "AS IS" BASIS, 12; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13; * See the License for the specific language governing permissions and 14; * limitations under the License. 15; * 16; * 17; * This file is derivative of CMSIS V5.00 gcc_arm.ld 18; */ 19 20/* Linker script to configure memory regions. */ 21/* This file will be run trough the pre-processor. */ 22 23#include "region_defs.h" 24 25MEMORY 26{ 27 FLASH (rx) : ORIGIN = NS_CODE_START, LENGTH = NS_CODE_SIZE 28 RAM (rwx) : ORIGIN = NS_DATA_START, LENGTH = NS_DATA_SIZE 29} 30 31__heap_size__ = NS_HEAP_SIZE; 32__stack_size__ = NS_STACK_SIZE; 33 34/* Library configurations */ 35GROUP(libgcc.a libc.a libm.a libnosys.a) 36 37ENTRY(Reset_Handler) 38 39SECTIONS 40{ 41 .text : 42 { 43 KEEP(*(.vectors)) 44 __Vectors_End = .; 45 __Vectors_Size = __Vectors_End - __Vectors; 46 __end__ = .; 47 48 *(.text*) 49 50 KEEP(*(.init)) 51 KEEP(*(.fini)) 52 53 54 /* .ctors */ 55 *crtbegin.o(.ctors) 56 *crtbegin?.o(.ctors) 57 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) 58 *(SORT(.ctors.*)) 59 *(.ctors) 60 61 /* .dtors */ 62 *crtbegin.o(.dtors) 63 *crtbegin?.o(.dtors) 64 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) 65 *(SORT(.dtors.*)) 66 *(.dtors) 67 68 *(.rodata*) 69 70 KEEP(*(.eh_frame*)) 71 } > FLASH 72 73 .ARM.extab : 74 { 75 *(.ARM.extab* .gnu.linkonce.armextab.*) 76 } > FLASH 77 78 __exidx_start = .; 79 .ARM.exidx : 80 { 81 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 82 } > FLASH 83 __exidx_end = .; 84 85 /* To copy multiple ROM to RAM sections, 86 * define etext2/data2_start/data2_end and 87 * define __STARTUP_COPY_MULTIPLE in startup_cmsdk_mps2_an519_ns.S */ 88 .copy.table : 89 { 90 . = ALIGN(4); 91 __copy_table_start__ = .; 92 LONG (__etext) 93 LONG (__data_start__) 94 LONG ((__data_end__ - __data_start__) / 4) 95 LONG (DEFINED(__etext2) ? __etext2 : 0) 96 LONG (DEFINED(__data2_start__) ? __data2_start__ : 0) 97 LONG (DEFINED(__data2_start__) ? ((__data2_end__ - __data2_start__) / 4) : 0) 98 __copy_table_end__ = .; 99 } > FLASH 100 101 /* To clear multiple BSS sections, 102 * uncomment .zero.table section and, 103 * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_cmsdk_mps2_an519_ns.S */ 104 .zero.table : 105 { 106 . = ALIGN(4); 107 __zero_table_start__ = .; 108 LONG (__bss_start__) 109 LONG ((__bss_end__ - __bss_start__) / 4) 110 LONG (DEFINED(__bss2_start__) ? __bss2_start__ : 0) 111 LONG (DEFINED(__bss2_start__) ? ((__bss2_end__ - __bss2_start__) / 4) : 0) 112 __zero_table_end__ = .; 113 } > FLASH 114 115 __etext = ALIGN(4); 116 117 .data : AT (__etext) 118 { 119 __data_start__ = .; 120 *(vtable) 121 *(.data*) 122 123 . = ALIGN(4); 124 /* preinit data */ 125 PROVIDE_HIDDEN (__preinit_array_start = .); 126 KEEP(*(.preinit_array)) 127 PROVIDE_HIDDEN (__preinit_array_end = .); 128 129 . = ALIGN(4); 130 /* init data */ 131 PROVIDE_HIDDEN (__init_array_start = .); 132 KEEP(*(SORT(.init_array.*))) 133 KEEP(*(.init_array)) 134 PROVIDE_HIDDEN (__init_array_end = .); 135 136 137 . = ALIGN(4); 138 /* finit data */ 139 PROVIDE_HIDDEN (__fini_array_start = .); 140 KEEP(*(SORT(.fini_array.*))) 141 KEEP(*(.fini_array)) 142 PROVIDE_HIDDEN (__fini_array_end = .); 143 144 KEEP(*(.jcr*)) 145 . = ALIGN(4); 146 /* All data end */ 147 __data_end__ = .; 148 149 } > RAM 150 151 .bss : 152 { 153 . = ALIGN(4); 154 __bss_start__ = .; 155 *(.bss*) 156 *(COMMON) 157 . = ALIGN(4); 158 __bss_end__ = .; 159 } > RAM 160 161 bss_size = __bss_end__ - __bss_start__; 162 163 .stack : ALIGN(32) 164 { 165 . += __stack_size__; 166 } > RAM 167 __StackLimit = ADDR(.stack); 168 __StackTop = ADDR(.stack) + SIZEOF(.stack); 169 170 .heap : ALIGN(8) 171 { 172 __end__ = .; 173 PROVIDE(end = .); 174 __HeapBase = .; 175 . += __heap_size__; 176 __HeapLimit = .; 177 __heap_limit = .; /* Add for _sbrk */ 178 } > RAM 179 180 PROVIDE(__stack = __StackTop); 181} 182