1/*
2 * Copyright (c) 2020-2022 Arm Limited
3 * Copyright (c) 2020-2021 IAR Systems AB
4 * Copyright (c) 2021 Cypress Semiconductor Corp. All rights reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 *
19 * This file is derivative of ../armclang/psoc6_ns.sct
20 */
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, maximum size = NS_CODE_SIZE {block ER_CODE};
28place at address NS_CODE_START {block LR_CODE};
29
30define block ER_DATA with alignment = 8 {readwrite};
31#ifdef RAM_VECTORS_SUPPORT
32define block ER_RAM_VECTORS      with alignment = 256 { section .ramvec };
33#endif
34define block TFM_RAM_CODE       with alignment = 32 { readonly section .ramfunc };
35define block CSTACK             with alignment = 32, size = NS_STACK_SIZE { };
36define block HEAP               with alignment = 8, size = NS_HEAP_SIZE { };
37define block ARM_LIB_HEAP       with alignment = 8, size = NS_HEAP_SIZE { };
38define overlay HEAP_OVL         {block HEAP};
39define overlay HEAP_OVL         {block ARM_LIB_HEAP};
40keep {block CSTACK, block HEAP, block ARM_LIB_HEAP, block TFM_RAM_CODE};
41
42do not initialize  {
43   section .noinit,
44   rw section .ramvec
45   };
46initialize by copy { readwrite };
47if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
48{
49  // Required in a multi-threaded application
50  initialize by copy with packing = none { section __DLIB_PERTHREAD };
51}
52
53define block DATA with fixed order, maximum size = NS_DATA_SIZE {
54#ifdef RAM_VECTORS_SUPPORT
55       block ER_RAM_VECTORS,
56#endif
57       block TFM_RAM_CODE,
58       block ER_DATA,
59       block CSTACK,
60       overlay HEAP_OVL,
61};
62place at address NS_DATA_START {block DATA};
63
64#if defined(PSA_API_TEST_ENABLED)
65define region PSA_NVMEM_region = mem:[from PSA_API_TEST_NVMEM_START size PSA_API_TEST_NVMEM_SIZE];
66#endif
67
68#if defined (NS_DATA_SHARED_START)
69    /* Shared memory data */
70define block TFM_SHARED_MEM with size = NS_DATA_SHARED_SIZE { };
71keep {block TFM_SHARED_MEM};
72place at address NS_DATA_SHARED_START {block TFM_SHARED_MEM};
73#endif
74