@@ -31,16 +31,35 @@ MBED_TLS_RELEASE ?= mbedtls-2.13.1
31
31
32
32
# Translate between mbed TLS namespace and mbed namespace
33
33
TARGET_PREFIX: =../
34
+ TARGET_PREFIX_CRYPTO: =../mbed-crypto/
34
35
TARGET_SRC: =$(TARGET_PREFIX ) src
35
36
TARGET_INC: =$(TARGET_PREFIX ) inc
36
37
TARGET_TESTS: =$(TARGET_PREFIX ) TESTS
37
38
39
+ # New folder structure is introduced here for targets with Secured-Partition-Environment
40
+ # and Non-Secured-Partition-Environment, below documentation for each folder:
41
+ # COMPONENT_PSA_SRV_IMPL - include secure service business logic implementation
42
+ # code. For example Mbed Crypto or secure time core logic
43
+ TARGET_SRV_IMPL: =$(TARGET_PREFIX_CRYPTO ) /platform/TARGET_PSA/COMPONENT_PSA_SRV_IMPL
44
+ # COMPONENT_SPE - include code that compiles ONLY to secure image and never
45
+ # compiles to non-secure image
46
+ TARGET_SPE: =$(TARGET_PREFIX_CRYPTO ) /platform/TARGET_PSA/COMPONENT_SPE
47
+ # The folder contain specific target implementation using hardware.
48
+ TARGET_PSA_DRIVERS: =$(TARGET_PREFIX_CRYPTO ) /targets
49
+ # COMPONENT_NSPE - include code that compiles ONLY to non-secure image and
50
+ # never compiles to secure image
51
+ TARGET_NSPE: =$(TARGET_SRV_IMPL ) /COMPONENT_NSPE
52
+
38
53
# mbed TLS source directory - hidden from mbed via TARGET_IGNORE
39
54
MBED_TLS_URL: [email protected] :ARMmbed/mbedtls-restricted.git
40
55
MBED_TLS_DIR: =TARGET_IGNORE/mbedtls
41
56
MBED_TLS_API: =$(MBED_TLS_DIR ) /include/mbedtls
42
57
MBED_TLS_GIT_CFG =$(MBED_TLS_DIR ) /.git/config
43
58
59
+ # Mbed Crypto directory - hidden from mbed via TARGET_IGNORE
60
+ MBED_CRYPTO_DIR: =$(MBED_TLS_DIR ) /crypto
61
+ MBED_CRYPTO_API: =$(MBED_CRYPTO_DIR ) /include/psa
62
+
44
63
.PHONY : all deploy deploy-tests rsync mbedtls clean update
45
64
46
65
all : mbedtls
@@ -62,6 +81,23 @@ rsync:
62
81
cp $(MBED_TLS_DIR ) /LICENSE $(TARGET_PREFIX )
63
82
cp $(MBED_TLS_DIR ) /apache-2.0.txt $(TARGET_PREFIX )
64
83
#
84
+ # Create Mbed Crypto target folder
85
+ mkdir -p $(TARGET_PREFIX_CRYPTO )
86
+ #
87
+ # Copying Mbed Crypto into Mbed OS..
88
+ rm -rf $(TARGET_SRV_IMPL )
89
+ rm -rf $(TARGET_SPE )
90
+
91
+ mkdir -p $(TARGET_SRV_IMPL)
92
+ mkdir -p $(TARGET_SPE)
93
+ mkdir -p $(TARGET_NSPE)
94
+ mkdir -p $(TARGET_PSA_DRIVERS)
95
+
96
+ rsync -a --delete --exclude='crypto_struct.h' $(MBED_CRYPTO_API) $(TARGET_INC)
97
+ rsync -a --delete $(MBED_CRYPTO_API)/crypto_struct.h $(TARGET_NSPE)
98
+ rsync -a --delete $(MBED_CRYPTO_API)/crypto_struct.h $(TARGET_SPE)/crypto_struct_spe.h
99
+ rsync -a --delete $(MBED_CRYPTO_DIR)/library/psa_*.c $(TARGET_SRV_IMPL)
100
+ rsync -a --delete $(MBED_CRYPTO_DIR)/library/psa_*.h $(TARGET_SRV_IMPL)
65
101
66
102
deploy : rsync
67
103
#
@@ -92,6 +128,9 @@ update: $(MBED_TLS_GIT_CFG) $(MBED_TLS_HA_GIT_CFG)
92
128
# Checking out the required release
93
129
git -C $(MBED_TLS_DIR ) checkout $(MBED_TLS_RELEASE )
94
130
#
131
+ # Update and checkout git submodules
132
+ git -C $(MBED_TLS_DIR ) submodule update --init --recursive
133
+ #
95
134
# Updating checked out version tag
96
135
echo $(MBED_TLS_RELEASE ) > $(TARGET_PREFIX ) VERSION.txt
97
136
@@ -107,4 +146,5 @@ clean:
107
146
rm -rf $(TARGET_SRC )
108
147
rm -rf $(TARGET_INC )
109
148
rm -rf $(MBED_TLS_DIR )
110
-
149
+ rm -rf $(TARGET_SRV_IMPL )
150
+ rm -rf $(TARGET_SPE )
0 commit comments