1/*
2 * Copyright (c) 2020-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 ../armclang/mps2_an521_ns.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 NS_CODE_region =   mem:[from NS_CODE_START size NS_CODE_SIZE];
28
29define region NS_RAM_region  =  mem:[from NS_DATA_START size NS_DATA_SIZE];
30
31define block CSTACK             with alignment = 8, size = NS_STACK_SIZE { };
32define block HEAP               with alignment = 8, size = NS_HEAP_SIZE { };
33define block ARM_LIB_HEAP       with alignment = 8, size = NS_HEAP_SIZE { };
34define overlay HEAP_OVL         {block HEAP};
35define overlay HEAP_OVL         {block ARM_LIB_HEAP};
36
37define block ER_CODE            with fixed order, alignment = 8 {
38       section .intvec,
39       readonly};
40
41define block ER_DATA with alignment = 8 {readwrite};
42
43do not initialize  { section .noinit };
44initialize by copy { readwrite };
45if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
46{
47  // Required in a multi-threaded application
48  initialize by copy with packing = none { section __DLIB_PERTHREAD };
49}
50
51define block LR_CODE with fixed order {block ER_CODE};
52define block DATA with fixed order {block ER_DATA,
53                                    block CSTACK,
54                                    overlay HEAP_OVL};
55
56place in NS_CODE_region  { block LR_CODE };
57place in NS_RAM_region   { block DATA };
58