1/*
2 * Copyright (c) 2020 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 ../armclang/mps2_an519_bl2.sct
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
25define memory mem with size = 4G;
26
27define region BL2_CODE_region  =   mem:[from BL2_CODE_START size BL2_CODE_SIZE];
28
29define region BL2_RAM_region   =  mem:[from BL2_DATA_START size BL2_DATA_SIZE];
30
31do not initialize  { section .noinit };
32initialize by copy { readwrite };
33
34define block ER_CODE        with fixed order, alignment = 8 {
35       section .intvec,
36       readonly
37       };
38
39define block TFM_SHARED_DATA with alignment = 32, size = BOOT_TFM_SHARED_DATA_SIZE { };
40keep {block TFM_SHARED_DATA};
41
42define block ER_DATA        with maximum size = BL2_DATA_SIZE, alignment = 32 {readwrite};
43    /* MSP */
44
45define block ARM_LIB_STACK      with alignment = 32, size = BL2_MSP_STACK_SIZE { };
46define block HEAP               with alignment = 8, size = BL2_HEAP_SIZE { };
47define block ARM_LIB_HEAP       with alignment = 8, size = BL2_HEAP_SIZE { };
48define overlay HEAP_OVL         {block HEAP};
49define overlay HEAP_OVL         {block ARM_LIB_HEAP};
50
51if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
52{
53  // Required in a multi-threaded application
54  initialize by copy with packing = none { section __DLIB_PERTHREAD };
55}
56
57define block LR_CODE with fixed order {block ER_CODE};
58define block DATA with fixed order {block TFM_SHARED_DATA,
59                                    block ER_DATA,
60                                    block ARM_LIB_STACK,
61                                    overlay HEAP_OVL};
62
63place in BL2_CODE_region         { block LR_CODE };
64place in BL2_RAM_region          { block DATA};
65