aboutsummaryrefslogtreecommitdiff
path: root/applications/trustzone_inference/corstone-300/trustzone.h
blob: 70fe7170e8c5b9c659e36a022c2c6abbc73e7328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * Copyright (c) 2021 Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the License); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef TRUSTZONE_H_
#define TRUSTZONE_H_

/* For the I-/DTCM memory the S/NS gating is handled by the I-/DTGU block.
 * The block defines a block size depending on the size of the memory.
 * The slice between secure and nonsecure has to be on a block boundary
 * to be able to map whole respective region to its security state.
 * For MPS3 with SSE300 + U55 the block size is 0x2000.
 */

#define TZ_S_ITCM_START 0x10000000
#define TZ_S_ITCM_SIZE  0x0007c000
#define TZ_S_BRAM_START 0x11000000
#define TZ_S_BRAM_SIZE  0x001fc000
#define TZ_S_DTCM_START 0x30000000
#define TZ_S_DTCM_SIZE  0x00040000
#define TZ_S_SRAM_START 0x31000000
#define TZ_S_SRAM_SIZE  0x00100000
#define TZ_S_STACK_HEAP 0x30040000

#define TZ_NSC_START 0x111fb000
#define TZ_NSC_SIZE  0x00001000

#define TZ_NS_ITCM_START 0x0007c000
#define TZ_NS_ITCM_SIZE  0x00004000
#define TZ_NS_BRAM_START 0x011fc000
#define TZ_NS_BRAM_SIZE  0x00004000
#define TZ_NS_DTCM_START 0x20040000
#define TZ_NS_DTCM_SIZE  0x00040000
#define TZ_NS_SRAM_START 0x21100000
#define TZ_NS_SRAM_SIZE  0x00100000
#define TZ_NS_STACK_HEAP 0x20080000

/* Add separate definition for secure world to use for booting
 * non secure world.
 */
#define TZ_NS_START_VECTOR TZ_NS_ITCM_START

#ifdef TRUSTZONE_SECURE
#define ITCM_START TZ_S_ITCM_START
#define ITCM_SIZE  TZ_S_ITCM_SIZE
#define BRAM_START TZ_S_BRAM_START
#define BRAM_SIZE  TZ_S_BRAM_SIZE
#define DTCM_START TZ_S_DTCM_START
#define DTCM_SIZE  TZ_S_DTCM_SIZE
#define SRAM_START TZ_S_SRAM_START
#define SRAM_SIZE  TZ_S_SRAM_SIZE
#define STACK_HEAP TZ_S_STACK_HEAP
#else
#define ITCM_START TZ_NS_ITCM_START
#define ITCM_SIZE  TZ_NS_ITCM_SIZE
#define BRAM_START TZ_NS_BRAM_START
#define BRAM_SIZE  TZ_NS_BRAM_SIZE
#define DTCM_START TZ_NS_DTCM_START
#define DTCM_SIZE  TZ_NS_DTCM_SIZE
#define SRAM_START TZ_NS_SRAM_START
#define SRAM_SIZE  TZ_NS_SRAM_SIZE
#define STACK_HEAP TZ_NS_STACK_HEAP
#endif

#define LR_START ITCM_START
#define LR_SIZE  ITCM_SIZE

#define ITCM_TOTAL_SIZE 0x00080000
#define ITCM_ITGU       0xE001E500

#define DTCM_TOTAL_SIZE 0x00080000
#define DTCM_DTGU       0xE001E600

#define BRAM_BASE_S     0x11000000
#define BRAM_BASE_NS    0x01000000
#define BRAM_TOTAL_SIZE 0x00200000
#define BRAM_MPC        0x57000000

#define SRAM0_BASE_S     0x31000000
#define SRAM0_BASE_NS    0x21000000
#define SRAM0_SIZE       0x00200000
#define SRAM0_MPC        0x50083000

#define DDR0_BASE_S     0x70000000
#define DDR0_BASE_NS    0x60000000
#define DDR0_SIZE       0x02000000

#ifdef TRUSTZONE_BUILD
#define DDR_START DDR0_BASE_S
#else
#define DDR_START DDR0_BASE_NS
#endif
/* Separate DDRs for secure and nonsecure */
#define DDR_SIZE  DDR0_SIZE

#if (S_TZ_ITCM_SIZE + TZ_NS_ITCM_SIZE) > ITCM_TOTAL_SIZE
#error Missconfigured ITCM memory
#endif

#if (S_TZ_DTCM_SIZE + TZ_NS_DTCM_SIZE) > DTCM_TOTAL_SIZE
#error Missconfigured ITCM memory
#endif

#endif // TRUSTZONE_H_