Skip to content

Commit cc7ae38

Browse files
committed
CMake: Simplify inclusion of cryptocell310 library files
1 parent a044bfa commit cc7ae38

File tree

2 files changed

+28
-45
lines changed

2 files changed

+28
-45
lines changed
Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
function(_mbed_get_libcc_310_ext)
5-
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
6-
set(LIBCC_310_EXT TOOLCHAIN_GCC_ARM/libcc_310_ext.a)
7-
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
8-
set(LIBCC_310_EXT TOOLCHAIN_ARM/libcc_310_ext.ar)
9-
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
10-
set(LIBCC_310_EXT TOOLCHAIN_IAR/lib_cc310_ext.a)
11-
endif()
12-
target_link_libraries(mbed-mbedtls-cryptocell310
13-
INTERFACE
14-
./${LIBCC_310_EXT}
15-
)
16-
endfunction()
17-
18-
function(_mbed_get_libcc_310_trng)
19-
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
20-
set(LIBCC_310_TRNG TOOLCHAIN_GCC_ARM/libcc_310_trng.a)
21-
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
22-
set(LIBCC_310_TRNG TOOLCHAIN_ARM/libcc_310_trng.ar)
23-
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
24-
set(LIBCC_310_TRNG TOOLCHAIN_IAR/lib_cc310_trng.a)
25-
endif()
26-
target_link_libraries(mbed-mbedtls-cryptocell310
27-
INTERFACE
28-
./${LIBCC_310_TRNG}
29-
)
30-
endfunction()
31-
32-
_mbed_get_libcc_310_ext()
33-
_mbed_get_libcc_310_trng()
4+
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
5+
set(LIBCC_310_EXT ./TOOLCHAIN_GCC_ARM/libcc_310_ext.a)
6+
set(LIBCC_310_TRNG ./TOOLCHAIN_GCC_ARM/libcc_310_trng.a)
7+
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
8+
set(LIBCC_310_EXT ./TOOLCHAIN_ARM/libcc_310_ext.ar)
9+
set(LIBCC_310_TRNG ./TOOLCHAIN_ARM/libcc_310_trng.ar)
10+
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
11+
set(LIBCC_310_EXT ./TOOLCHAIN_IAR/lib_cc310_ext.a)
12+
set(LIBCC_310_TRNG ./TOOLCHAIN_IAR/lib_cc310_trng.a)
13+
endif()
3414

3515
target_include_directories(mbed-mbedtls-cryptocell310
3616
INTERFACE
@@ -40,4 +20,10 @@ target_include_directories(mbed-mbedtls-cryptocell310
4020
target_sources(mbed-mbedtls-cryptocell310
4121
INTERFACE
4222
crypto_device_platform.c
43-
)
23+
)
24+
25+
target_link_libraries(mbed-mbedtls-cryptocell310
26+
INTERFACE
27+
${LIBCC_310_EXT}
28+
${LIBCC_310_TRNG}
29+
)
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
function(_mbed_get_libcc_310_core)
5-
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
6-
set(LIBCC_310_CORE TOOLCHAIN_GCC_ARM/libcc_310_core.a)
7-
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
8-
set(LIBCC_310_CORE TOOLCHAIN_ARM/libcc_310_core.ar)
9-
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
10-
set(LIBCC_310_CORE TOOLCHAIN_IAR/lib_cc310_ext.a)
11-
endif()
12-
target_link_libraries(mbed-mbedtls-cryptocell310
13-
INTERFACE
14-
./${LIBCC_310_CORE}
15-
)
16-
endfunction()
4+
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
5+
set(LIBCC_310_CORE ./TOOLCHAIN_GCC_ARM/libcc_310_core.a)
6+
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
7+
set(LIBCC_310_CORE ./TOOLCHAIN_ARM/libcc_310_core.ar)
8+
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
9+
set(LIBCC_310_CORE ./TOOLCHAIN_IAR/lib_cc310_ext.a)
10+
endif()
1711

18-
_mbed_get_libcc_310_core()
12+
target_link_libraries(mbed-mbedtls-cryptocell310
13+
INTERFACE
14+
${LIBCC_310_CORE}
15+
)

0 commit comments

Comments
 (0)