1/* 2 * Copyright (c) 2022 Arm Limited 3 * Copyright (c) 2021 IAR Systems AB 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19/* Linker script to configure memory regions. */ 20/* This file will be run trough the pre-processor. */ 21 22#include "region_defs.h" 23 24do not initialize { section .noinit }; 25initialize by copy { readwrite }; 26 27define block ER_CODE with fixed order, alignment = 8 { 28 section .intvec, 29 readonly 30 }; 31define block LR_CODE with fixed order, maximum size = BL2_CODE_SIZE {block ER_CODE}; 32place at address BL2_CODE_START {block LR_CODE}; 33 34define block TFM_SHARED_DATA with alignment = 32, size = BOOT_TFM_SHARED_DATA_SIZE { }; 35define block ER_DATA with alignment = 32 {readwrite}; 36define block ARM_LIB_STACK with alignment = 32, size = BL2_MSP_STACK_SIZE { }; 37define block HEAP with alignment = 8, size = BL2_HEAP_SIZE { }; 38define block ARM_LIB_HEAP with alignment = 8, size = BL2_HEAP_SIZE { }; 39define overlay HEAP_OVL {block HEAP}; 40define overlay HEAP_OVL {block ARM_LIB_HEAP}; 41keep {block TFM_SHARED_DATA, block ER_DATA, block ARM_LIB_STACK, 42 block HEAP, block ARM_LIB_HEAP}; 43 44if (isdefinedsymbol(__USE_DLIB_PERTHREAD)) 45{ 46 // Required in a multi-threaded application 47 initialize by copy with packing = none { section __DLIB_PERTHREAD }; 48} 49 50define block DATA with fixed order, maximum size = BL2_DATA_SIZE { 51 block TFM_SHARED_DATA, 52 block ER_DATA, 53 block ARM_LIB_STACK, 54 overlay HEAP_OVL 55}; 56place at address BOOT_TFM_SHARED_DATA_BASE {block DATA}; 57