Skip to content

Commit 96268d9

Browse files
Michael SchwarczOren Cohen
authored andcommitted
Updates after rebase
- postbuild: Use find_secure_image and update prebuilt binaries - Add CMSIS driver headers - Align with 2-region memory model
1 parent 36a8514 commit 96268d9

File tree

21 files changed

+493
-115
lines changed

21 files changed

+493
-115
lines changed

targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/device/TOOLCHAIN_ARMC6/musca_ns.sct

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,35 @@
3030
#endif
3131

3232
#if !defined(MBED_RAM_START)
33-
#define MBED_RAM_START NVIC_RAM_VECTOR_LIMIT // 0x20010170
33+
#define MBED_RAM_START NS_DATA_START
3434
#endif
3535

3636
#if !defined(MBED_RAM_SIZE)
37-
#define MBED_RAM_SIZE (NS_DATA_SIZE - NVIC_RAM_VECTOR_SIZE) // 0xfe90
37+
#define MBED_RAM_SIZE NS_DATA_SIZE
3838
#endif
3939

40-
LR_CODE MBED_ROM_START NS_CODE_SIZE {
41-
ER_CODE MBED_ROM_START NS_CODE_SIZE {
40+
#define VECTOR_SIZE NVIC_RAM_VECTOR_SIZE
41+
42+
#if !defined(MBED_BOOT_STACK_SIZE)
43+
#define MBED_BOOT_STACK_SIZE 0x400
44+
#endif
45+
46+
#define RAM_FIXED_SIZE (MBED_BOOT_STACK_SIZE+VECTOR_SIZE)
47+
48+
LR_CODE MBED_ROM_START MBED_ROM_SIZE {
49+
ER_CODE MBED_ROM_START MBED_ROM_SIZE {
4250
*.o (VECTOR +First)
4351
.ANY (+RO)
4452
}
4553

46-
RW_IRAM1 MBED_RAM_START MBED_RAM_SIZE {
54+
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) {
4755
* (+RW) ; RW data that gets copied from Flash to SRAM
4856
* (+ZI) ; ZI data that gets initialised to zero in SRAM
4957
}
5058

51-
HEAP_STACK +0 ALIGN 8 {
52-
startup_cmsdk_musca_ns.o (HEAP, +First)
53-
startup_cmsdk_musca_ns.o (STACK, +Last)
59+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
5460
}
55-
}
5661

62+
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; stack
63+
}
64+
}

targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/device/TOOLCHAIN_ARMC6/startup_cmsdk_musca_ns.S

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,7 @@
2323
;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
2424
;*/
2525

26-
27-
; <h> Stack Configuration
28-
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
29-
; </h>
30-
31-
Stack_Size EQU 0x00001000
32-
33-
AREA STACK, NOINIT, READWRITE, ALIGN=3
34-
__stack_base
35-
Stack_Mem SPACE Stack_Size
36-
__initial_sp
37-
38-
; <h> Heap Configuration
39-
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
40-
; </h>
41-
Heap_Size EQU 0x00001000
42-
43-
AREA HEAP, NOINIT, READWRITE, ALIGN=3
44-
__heap_base
45-
Heap_Mem SPACE Heap_Size
46-
__heap_limit
26+
__initial_sp EQU 0x20020000 ; Top of RAM
4727

4828
; Vector Table Mapped to Address 0 at Reset
4929

@@ -257,31 +237,4 @@ $handler_name PROC
257237

258238
ALIGN
259239

260-
; User Initial Stack & Heap
261-
262-
EXPORT __stack_base
263-
EXPORT __initial_sp
264-
265-
IF :DEF:__MICROLIB
266-
267-
EXPORT __heap_base
268-
EXPORT __heap_limit
269-
270-
ELSE
271-
272-
IMPORT __use_two_region_memory
273-
EXPORT __user_initial_stackheap
274-
275-
__user_initial_stackheap PROC
276-
LDR R0, = Heap_Mem
277-
LDR R1, = (Stack_Mem + Stack_Size)
278-
LDR R2, = (Heap_Mem + Heap_Size)
279-
LDR R3, = Stack_Mem
280-
BX LR
281-
ENDP
282-
283-
ENDIF
284-
285-
ALIGN
286-
287240
END

targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/device/TOOLCHAIN_GCC_ARM/musca_ns.ld

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@
2525
#include "../../../partition/region_defs.h"
2626
#include "../cmsis_nvic.h"
2727

28+
/* Stack size is 1K for Mbed-OS */
29+
#if !defined(MBED_BOOT_STACK_SIZE)
30+
#define MBED_BOOT_STACK_SIZE 0x400
31+
#endif
32+
2833
MEMORY
2934
{
3035
CODE_RAM (rx) : ORIGIN = NS_CODE_START, LENGTH = ((TOTAL_CODE_SRAM_SIZE / 2) - BL2_HEADER_SIZE)
3136
/* Vector table is copied to RAM, so RAM address needs to be adjusted */
3237
RAM (rwx) : ORIGIN = NVIC_RAM_VECTOR_LIMIT, LENGTH = (NS_DATA_SIZE - NVIC_RAM_VECTOR_SIZE)
3338
}
3439

35-
__heap_size__ = 0x00003000;
36-
__stack_size__ = 0x00003000;
40+
__stack_size__ = MBED_BOOT_STACK_SIZE;
3741

3842
/* Library configurations */
3943
GROUP(libgcc.a libc.a libm.a libnosys.a)
@@ -68,9 +72,9 @@ SECTIONS
6872
__exidx_end = .;
6973

7074
/* The text section is loaded into Flash but runs from SRAM
71-
* The load address is aligned to 4 bytes
75+
* The load address is aligned to 8 bytes
7276
*/
73-
.text : ALIGN(4)
77+
.text : ALIGN(8)
7478
{
7579
*(.text*)
7680

@@ -92,7 +96,7 @@ SECTIONS
9296

9397
KEEP(*(.eh_frame*))
9498
} >CODE_RAM
95-
. = ALIGN(4); /* This alignment is needed to make the section size 4 bytes aligned */
99+
. = ALIGN(8); /* This alignment is needed to make the section size 8 bytes aligned */
96100

97101
/* Create same symbols that armclang does so that in the c files
98102
* we do not have to deal with the compiler type
@@ -109,7 +113,7 @@ SECTIONS
109113
* define __STARTUP_COPY_MULTIPLE in startup_cmsdk_musca_ns.S */
110114
.copy.table :
111115
{
112-
. = ALIGN(4);
116+
. = ALIGN(8);
113117
__copy_table_start__ = .;
114118
LONG (__etext)
115119
LONG (__data_start__)
@@ -124,7 +128,7 @@ SECTIONS
124128
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_cmsdk_musca_ns.S */
125129
.zero.table :
126130
{
127-
. = ALIGN(4);
131+
. = ALIGN(8);
128132
__zero_table_start__ = .;
129133
LONG (__bss_start__)
130134
LONG (__bss_end__ - __bss_start__)
@@ -135,61 +139,52 @@ SECTIONS
135139

136140
__etext = .;
137141

138-
.data : ALIGN(4)
142+
.data : ALIGN(8)
139143
{
140144
__data_start__ = .;
141145
*(vtable)
142146
*(.data*)
143147

144-
. = ALIGN(4);
148+
. = ALIGN(8);
145149
/* preinit data */
146150
PROVIDE_HIDDEN (__preinit_array_start = .);
147151
KEEP(*(.preinit_array))
148152
PROVIDE_HIDDEN (__preinit_array_end = .);
149153

150-
. = ALIGN(4);
154+
. = ALIGN(8);
151155
/* init data */
152156
PROVIDE_HIDDEN (__init_array_start = .);
153157
KEEP(*(SORT(.init_array.*)))
154158
KEEP(*(.init_array))
155159
PROVIDE_HIDDEN (__init_array_end = .);
156160

157161

158-
. = ALIGN(4);
162+
. = ALIGN(8);
159163
/* finit data */
160164
PROVIDE_HIDDEN (__fini_array_start = .);
161165
KEEP(*(SORT(.fini_array.*)))
162166
KEEP(*(.fini_array))
163167
PROVIDE_HIDDEN (__fini_array_end = .);
164168

165169
KEEP(*(.jcr*))
166-
. = ALIGN(4);
170+
. = ALIGN(8);
167171
/* All data end */
168172
__data_end__ = .;
169173

170174
} > RAM AT>CODE_RAM
171175

172176
.bss :
173177
{
174-
. = ALIGN(4);
178+
. = ALIGN(8);
175179
__bss_start__ = .;
176180
*(.bss*)
177181
*(COMMON)
178-
. = ALIGN(4);
182+
. = ALIGN(8);
179183
__bss_end__ = .;
180184
} > RAM
181185

182186
bss_size = __bss_end__ - __bss_start__;
183187

184-
.heap (COPY):
185-
{
186-
__HeapBase = .;
187-
__end__ = .;
188-
end = __end__;
189-
KEEP(*(.heap*))
190-
__HeapLimit = .;
191-
} > RAM
192-
193188
.stack :
194189
{
195190
. = ALIGN(8);
@@ -198,20 +193,20 @@ SECTIONS
198193
. += __stack_size__;
199194
__StackTop = .;
200195
} > RAM
196+
PROVIDE(__stack = __StackTop);
201197

202-
.heap :
198+
.heap (COPY):
203199
{
204200
. = ALIGN(8);
205-
__end__ = .;
206-
PROVIDE(end = .);
207201
__HeapBase = .;
208-
. += __heap_size__;
202+
__end__ = .;
203+
end = __end__;
204+
KEEP(*(.heap*))
205+
. += (ORIGIN(RAM) + LENGTH(RAM) - .);
209206
__HeapLimit = .;
210207
__heap_limit = .; /* Add for _sbrk */
211208
} > RAM
212209

213-
PROVIDE(__stack = __StackTop);
214-
215210
/* Check if data + heap + stack exceeds RAM limit */
216211
ASSERT(__StackTop <= (NS_DATA_START + NS_DATA_SIZE), "RAM region overflowed")
217212
}
Binary file not shown.

targets/TARGET_ARM_SSG/TARGET_MUSCA_A1/TARGET_MUSCA_A1_NS/device/cmsis_nvic_virtual.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121

2222
void NVIC_SystemReset(void)
2323
{
24-
psa_system_reset();
24+
mbed_psa_system_reset();
2525
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Permissive Binary License
2+
3+
Version 1.0, December 2018
4+
5+
Redistribution. Redistribution and use in binary form, without
6+
modification, are permitted provided that the following conditions are
7+
met:
8+
9+
1) Redistributions must reproduce the above copyright notice and the
10+
following disclaimer in the documentation and/or other materials
11+
provided with the distribution.
12+
13+
2) Unless to the extent explicitly permitted by law, no reverse
14+
engineering, decompilation, or disassembly of this software is
15+
permitted.
16+
17+
3) Redistribution as part of a software development kit must include the
18+
accompanying file named DEPENDENCIES and any dependencies listed in
19+
that file.
20+
21+
4) Neither the name of the copyright holder nor the names of its
22+
contributors may be used to endorse or promote products derived from
23+
this software without specific prior written permission.
24+
25+
Limited patent license. The copyright holders (and contributors) grant a
26+
worldwide, non-exclusive, no-charge, royalty-free patent license to
27+
make, have made, use, offer to sell, sell, import, and otherwise
28+
transfer this software, where such license applies only to those patent
29+
claims licensable by the copyright holders (and contributors) that are
30+
necessarily infringed by this software. This patent license shall not
31+
apply to any combinations that include this software. No hardware is
32+
licensed hereunder.
33+
34+
If you institute patent litigation against any entity (including a
35+
cross-claim or counterclaim in a lawsuit) alleging that the software
36+
itself infringes your patent(s), then your rights granted under this
37+
license shall terminate as of the date such litigation is filed.
38+
39+
DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
40+
CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
41+
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
42+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
43+
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
45+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
46+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
47+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
49+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# MUSCA_A1_NS prebuilt secure binaries
2+
3+
This directory tree contains Secure images released under Permissive Binary License.
4+
5+
Built by mbed-cli using GNU Arm Embedded - version 6.3.1
6+
7+
These images were compiled by the following command:
8+
9+
## tfm.bin
10+
11+
```sh
12+
mbed compile -t GCC_ARM -m ARM_MUSCA_A1_S --app-config tools/psa/tfm/mbed_app.json --profile release
13+
```
14+
15+
## spm_smoke.bin
16+
17+
```sh
18+
mbed test --compile -t GCC_ARM -m ARM_MUSCA_A1_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_smoke -DUSE_PSA_TEST_PARTITIONS -DUSE_SMOKE_TESTS_PART1 --profile release
19+
```
20+
21+
## spm_client.bin
22+
23+
```sh
24+
mbed test --compile -t GCC_ARM -m ARM_MUSCA_A1_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_client -DUSE_PSA_TEST_PARTITIONS -DUSE_CLIENT_TESTS_PART1 --profile release
25+
```
26+
27+
## spm_server.bin
28+
29+
```sh
30+
mbed test --compile -t GCC_ARM -m ARM_MUSCA_A1_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_server -DUSE_PSA_TEST_PARTITIONS -DUSE_SERVER_TESTS_PART1 -DUSE_SERVER_TESTS_PART2 --profile release
31+
```
32+
33+
To update the prebuilt binaries run the previous commands.
Binary file not shown.

0 commit comments

Comments
 (0)