1/*
2 * Copyright (c) 2020-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 * This file is derivative of ../armclang/musca_ns.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
26define block ER_CODE            with fixed order, alignment = 8 {
27       section .intvec,
28       readonly};
29define block LR_CODE with fixed order, maximum size = NS_CODE_SIZE {block ER_CODE};
30place at address NS_CODE_START {block LR_CODE};
31
32define block ER_DATA with alignment = 8 {readwrite};
33define block CSTACK             with alignment = 32, size = NS_STACK_SIZE { };
34define block HEAP               with alignment = 8, size = NS_HEAP_SIZE { };
35define block ARM_LIB_HEAP       with alignment = 8, size = NS_HEAP_SIZE { };
36define overlay HEAP_OVL         {block HEAP};
37define overlay HEAP_OVL         {block ARM_LIB_HEAP};
38keep {block CSTACK, block HEAP, block ARM_LIB_HEAP};
39
40do not initialize  { section .noinit };
41initialize by copy { readwrite };
42if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
43{
44  // Required in a multi-threaded application
45  initialize by copy with packing = none { section __DLIB_PERTHREAD };
46}
47
48define block DATA with fixed order, maximum size = NS_DATA_SIZE {
49       block ER_DATA,
50       block CSTACK,
51       overlay HEAP_OVL
52};
53place at address NS_DATA_START {block DATA};
54