aboutsummaryrefslogtreecommitdiff
path: root/platform/ext/common/armclang/tfm_isolation_l3.sct.template
blob: 13c3a4313f0f82e4f2baa1416e310ab7071a2006 (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
 * Copyright (c) 2017-2021 Arm Limited. All rights reserved.
 *
 * 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
 *
 *     http://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.
 */

{{utilities.donotedit_warning}}

/*
 * Customized region name prefix abbreviation:
 *  LR : A Load region.
 *  ER : A typical execution region.
 *  PT : An empty execution region used as position-tag/address-alignment.
 *
 * No applying customzied prefixes on linker/system reserved/intentional
 * names, such as 'ARM_LIB_STACK'.
 */

#include "region_defs.h"

LR_CODE S_CODE_START {

    PT_RO_START S_CODE_START ALIGN 32 EMPTY 0x0 {
        /* Position tag: code + RO-data */
    }

    /**** This initial section contains mainly the SPM code and RO-data */
    ER_TFM_CODE +0 ALIGN 32 {
        *.o (RESET +First)
        * (+RO)
    }

    /**** PSA RoT CODE + RO-data starts here */
{% for manifest in manifests %}
    {% if manifest.manifest.type == 'PSA-ROT' %}
    {% if manifest.attr.conditional %}
#ifdef {{manifest.attr.conditional}}
    {% endif %}
    ER_{{manifest.manifest.name}}_RO +0 ALIGN 32 {
    {% if manifest.attr.linker_pattern.library_list %}
        {% for pattern in manifest.attr.linker_pattern.library_list %}
        {{pattern}} (+RO)
        {% endfor %}
    {% endif %}
    {% if manifest.attr.linker_pattern.object_list %}
        {% for pattern in manifest.attr.linker_pattern.object_list %}
        {{pattern}} (+RO)
        {% endfor %}
    {% endif %}
        *({{manifest.manifest.name}}_PSA-ROT_ATTR_FN)
    }
    {% if manifest.attr.conditional %}
#endif /* {{manifest.attr.conditional}} */
    {% endif %}

    {% endif %}
{% endfor %}
    /**** PSA RoT CODE + RO-data ends here */

    /**** APPLICATION RoT CODE + RO-data starts here */
{% for manifest in manifests %}
    {% if manifest.manifest.type == 'APPLICATION-ROT' %}
    {% if manifest.attr.conditional %}
#ifdef {{manifest.attr.conditional}}
    {% endif %}
    ER_{{manifest.manifest.name}}_RO +0 ALIGN 32 {
    {% if manifest.attr.linker_pattern.library_list %}
        {% for pattern in manifest.attr.linker_pattern.library_list %}
        {{pattern}} (+RO)
        {% endfor %}
    {% endif %}
    {% if manifest.attr.linker_pattern.object_list %}
        {% for pattern in manifest.attr.linker_pattern.object_list %}
        {{pattern}} (+RO)
        {% endfor %}
    {% endif %}
        *({{manifest.manifest.name}}_APP-ROT_ATTR_FN)
    }
    {% if manifest.attr.conditional %}
#endif /* {{manifest.attr.conditional}} */
    {% endif %}

    {% endif %}
{% endfor %}
    /**** APPLICATION RoT CODE + RO-data ends here */

    /**** Unprivileged Secure code + RO-data starts here */
    TFM_UNPRIV_CODE +0 ALIGN 32 {
        *(SFN)
        *armlib* (+RO)
        *libtfm_sprt.a (+RO)
        *psa_client.* (+RO)
        *psa_service.* (+RO)
        *psa_lifecycle.* (+RO)
    }

    PT_RO_END +0 ALIGN 32 EMPTY 0x0 {
        /* Position tag */
    }

    /**** Base address of secure data area */
    PT_SECURE_DATA_START S_DATA_START EMPTY 0x0 {
        /* Position tag */
    }

    PT_PRIV_RWZI_START +0 ALIGN 32 EMPTY 0x0 {
        /* Position tag */
    }

    /* Shared area between BL2 and runtime to exchange data */
    TFM_SHARED_DATA +0 ALIGN 32 OVERLAY EMPTY BOOT_TFM_SHARED_DATA_SIZE {
    }

    /* MSP */
    ARM_LIB_STACK_MSP +0 ALIGN 32 OVERLAY EMPTY S_MSP_STACK_SIZE {
    }

    ARM_LIB_HEAP +0 ALIGN 8 EMPTY S_HEAP_SIZE {
    }

    ER_TFM_DATA +0 {
        * (+RW +ZI)
    }

    /**** PSA RoT RWZI starts here */
{% for manifest in manifests %}
    {% if manifest.manifest.type == 'PSA-ROT' %}
    {% if manifest.attr.conditional %}
#ifdef {{manifest.attr.conditional}}
    {% endif %}

    PT_{{manifest.manifest.name}}_PRIVATE_DATA_START +0 ALIGN 32 {
        /* Position tag */
    }

    ER_{{manifest.manifest.name}}_RWZI +0 ALIGN 32 {
    {% if manifest.attr.linker_pattern.library_list %}
        {% for pattern in manifest.attr.linker_pattern.library_list %}
        {{pattern}} (+RW +ZI)
        {% endfor %}
    {% endif %}
    {% if manifest.attr.linker_pattern.object_list %}
        {% for pattern in manifest.attr.linker_pattern.object_list %}
        {{pattern}} (+RW +ZI)
        {% endfor %}
    {% endif %}
        *({{manifest.manifest.name}}_PSA-ROT_ATTR_RW)
        *({{manifest.manifest.name}}_PSA-ROT_ATTR_ZI)
    }

    PT_{{manifest.manifest.name}}_PRIVATE_DATA_END +0 ALIGN 32 {
        /* Position tag */
    }

    {% if manifest.attr.conditional %}
#endif /* {{manifest.attr.conditional}} */
    {% endif %}

    {% endif %}
{% endfor %}

    /**** PSA RoT RWZI ends here */
    PT_PRIV_RWZI_END +0 ALIGN 32 EMPTY 0x0 {
        /* Position tag */
    }

    /* PSP is unprivileged in single-core topology */
    ARM_LIB_STACK +0 ALIGN 32 EMPTY S_PSP_STACK_SIZE {
    }

{% for manifest in manifests %}
    {% if manifest.manifest.type == 'APPLICATION-ROT' %}
    {% if manifest.attr.conditional %}
#ifdef {{manifest.attr.conditional}}
    {% endif %}

    PT_{{manifest.manifest.name}}_PRIVATE_DATA_START +0 ALIGN 32 {
        /* Position tag */
    }

    ER_{{manifest.manifest.name}}_RWZI +0 ALIGN 32 {
    {% if manifest.attr.linker_pattern.library_list %}
        {% for pattern in manifest.attr.linker_pattern.library_list %}
        {{pattern}} (+RW +ZI)
        {% endfor %}
    {% endif %}
    {% if manifest.attr.linker_pattern.object_list %}
        {% for pattern in manifest.attr.linker_pattern.object_list %}
        {{pattern}} (+RW +ZI)
        {% endfor %}
    {% endif %}
        *({{manifest.manifest.name}}_APP-ROT_ATTR_RW)
        *({{manifest.manifest.name}}_APP-ROT_ATTR_ZI)
    }

    PT_{{manifest.manifest.name}}_PRIVATE_DATA_END +0 ALIGN 32 {
        /* Position tag */
    }

    {% if manifest.attr.conditional %}
#endif /* {{manifest.attr.conditional}} */
    {% endif %}

    {% endif %}
{% endfor %}

    PT_SRAM_WATERMARK +0 EMPTY 0x0 {
        /* Position tag */
    }

    /* Make sure that the sections allocated in the SRAM does not exceed the
     * size of the SRAM available.
     */
    ScatterAssert(ImageLimit(PT_SRAM_WATERMARK) <= S_DATA_START + S_DATA_SIZE)

#if defined(S_CODE_SRAM_ALIAS_BASE)
    /* eFlash driver code that gets copied from Flash to SRAM */
    ER_EFLASH_DRIVER_RO S_CODE_SRAM_ALIAS_BASE ALIGN 32 {
        Driver_GFC100_EFlash.o (+RO)
        gfc100_eflash_drv.o (+RO)
        musca_b1_eflash_drv.o (+RO)
    }
#endif
}

LR_VENEER CMSE_VENEER_REGION_START {
    /*
     * Place the CMSE Veneers (containing the SG instruction) in a separate
     * 32 bytes aligned region so that the SAU can be programmed to
     * just set this region as Non-Secure Callable.
     */
    ER_CODE_CMSE_VENEER CMSE_VENEER_REGION_START CMSE_VENEER_REGION_SIZE {
        *(Veneer$$CMSE)
    }
}

LR_NS_PARTITION NS_PARTITION_START {
    /* Reserved place for NS application.
     * No code will be placed here, just address of this region is used in the
     * secure code to configure certain HW components. This generates an empty
     * execution region description warning during linking.
     */
    ER_NS_PARTITION NS_PARTITION_START UNINIT NS_PARTITION_SIZE {
    }
}

#ifdef BL2
LR_SECONDARY_PARTITION SECONDARY_PARTITION_START {
    /* Reserved place for new image in case of firmware upgrade.
     * No code will be placed here, just address of this region is used in the
     * secure code to configure certain HW components. This generates an empty
     * execution region description warning during linking.
     */
    ER_SECONDARY_PARTITION SECONDARY_PARTITION_START \
        UNINIT SECONDARY_PARTITION_SIZE {
    }
}
#endif /* BL2 */