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
24define block ER_CODE            with fixed order, alignment = 8 {
25       section .intvec,
26       readonly};
27define block LR_CODE with fixed order {block ER_CODE};
28place at address NS_CODE_START {block LR_CODE};
29
30define block ER_DATA	        with alignment = 8 {readwrite};
31define block CSTACK             with alignment = 32, 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};
36keep {block CSTACK, block HEAP, block ARM_LIB_HEAP};
37
38do not initialize  { section .noinit };
39initialize by copy { readwrite };
40if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
41{
42  // Required in a multi-threaded application
43  initialize by copy with packing = none { section __DLIB_PERTHREAD };
44}
45
46define block DATA with fixed order, maximum size = NS_DATA_SIZE  {
47       block ER_DATA,
48       block CSTACK,
49       overlay HEAP_OVL
50};
51place at address NS_DATA_START {block DATA};
52