1/*
2 * Copyright (c) 2020-2023 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 * This file is derivative of ../armclang/musca_bl2.sct
19 */
20
21/* Linker script to configure memory regions. */
22/* This file will be run trough the pre-processor. */
23
24#include "region_defs.h"
25
26do not initialize  { section .noinit };
27initialize by copy { readwrite };
28initialize by copy {
29       ro object *libflash_drivers*,
30       };
31
32define block ER_CODE        with fixed order, alignment = 8 {
33       section .intvec,
34       readonly
35       };
36define block LR_CODE with fixed order, maximum size = BL2_CODE_SIZE {block ER_CODE};
37place at address BL2_CODE_START {block LR_CODE};
38
39define block ER_CODE_SRAM  with fixed order, alignment = 8 {
40       rw section .text,
41       rw section .rodata
42       };
43
44place at address BL2_CODE_SRAM_BASE {block ER_CODE_SRAM};
45
46define block TFM_SHARED_DATA with alignment = 32, size = BOOT_TFM_SHARED_DATA_SIZE { };
47define block ER_DATA         with alignment = 32 {readwrite};
48define block ARM_LIB_STACK   with alignment = 32, size = BL2_MSP_STACK_SIZE { };
49define block HEAP            with alignment = 8, size = BL2_HEAP_SIZE { };
50define block ARM_LIB_HEAP    with alignment = 8, size = BL2_HEAP_SIZE { };
51define overlay HEAP_OVL      {block HEAP};
52define overlay HEAP_OVL      {block ARM_LIB_HEAP};
53keep {block TFM_SHARED_DATA, block ER_DATA, block ARM_LIB_STACK,
54      block HEAP, block ARM_LIB_HEAP};
55
56if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
57{
58  // Required in a multi-threaded application
59  initialize by copy with packing = none { section __DLIB_PERTHREAD };
60}
61
62define block DATA with fixed order, maximum size = BL2_DATA_SIZE {
63       block TFM_SHARED_DATA,
64       block ER_DATA,
65       block ARM_LIB_STACK,
66       overlay HEAP_OVL
67};
68place at address BL2_DATA_START {block DATA};
69