Skip to content

Commit 5575f92

Browse files
david-hazi-armAnton-TF
authored andcommitted
build: Add BL1 compile and linker flags to BL1
Signed-off-by: Dávid Házi <david.hazi@arm.com> Change-Id: I07644042885b973b4190b0b1035ca43e20d5fd4d
1 parent d825ed4 commit 5575f92

7 files changed

+75
-2
lines changed

bl1/bl1_1/CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#-------------------------------------------------------------------------------
2-
# Copyright (c) 2021-2023, Arm Limited. All rights reserved.
2+
# Copyright (c) 2021-2024, Arm Limited. All rights reserved.
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55
#
@@ -26,6 +26,16 @@ target_link_options(bl1_1
2626
$<$<C_COMPILER_ID:IAR>:--map\;${CMAKE_BINARY_DIR}/bin/bl1_1.map>
2727
)
2828

29+
target_compile_options(bl1_1
30+
PUBLIC
31+
${BL1_COMPILER_CP_FLAG}
32+
)
33+
34+
target_link_options(bl1_1
35+
PUBLIC
36+
${BL1_LINKER_CP_OPTION}
37+
)
38+
2939
target_sources(bl1_1
3040
PRIVATE
3141
main.c

bl1/bl1_1/shared_lib/CMakeLists.txt

+30
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,34 @@ if(TFM_BL1_SOFTWARE_CRYPTO)
105105
$<$<C_COMPILER_ID:GNU>:-Wno-unused-parameter>
106106
$<$<C_COMPILER_ID:ARMClang>:-Wno-unused-parameter>
107107
)
108+
109+
target_compile_options(bl1_1_crypto_mbedcrypto
110+
PRIVATE
111+
${BL1_COMPILER_CP_FLAG}
112+
)
113+
114+
target_link_options(bl1_1_crypto_mbedcrypto
115+
PUBLIC
116+
${BL1_LINKER_CP_OPTION}
117+
)
118+
119+
target_compile_options(bl1_1_crypto_mbedtls
120+
PRIVATE
121+
${BL1_COMPILER_CP_FLAG}
122+
)
123+
124+
target_link_options(bl1_1_crypto_mbedtls
125+
PUBLIC
126+
${BL1_LINKER_CP_OPTION}
127+
)
128+
129+
target_compile_options(bl1_1_crypto_mbedx509
130+
PRIVATE
131+
${BL1_COMPILER_CP_FLAG}
132+
)
133+
134+
target_link_options(bl1_1_crypto_mbedx509
135+
PUBLIC
136+
${BL1_LINKER_CP_OPTION}
137+
)
108138
endif()

bl1/bl1_2/CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ target_link_options(bl1_2
2828
$<$<C_COMPILER_ID:IAR>:--map\;${CMAKE_BINARY_DIR}/bin/bl1_2.map>
2929
)
3030

31+
target_compile_options(bl1_2
32+
PUBLIC
33+
${BL1_COMPILER_CP_FLAG}
34+
)
35+
36+
target_link_options(bl1_2
37+
PUBLIC
38+
${BL1_LINKER_CP_OPTION}
39+
)
40+
3141
target_sources(bl1_2
3242
PRIVATE
3343
main.c

bl2/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ target_compile_options(bl2
4848
target_link_options(bl2
4949
PRIVATE
5050
$<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/bl2.map>
51-
$<$<C_COMPILER_ID:ARMClang>:--map;${BL2_LINKER_CP_OPTION}>
51+
$<$<C_COMPILER_ID:ARMClang>:--map>
5252
$<$<C_COMPILER_ID:IAR>:--map\;${CMAKE_BINARY_DIR}/bin/bl2.map>
53+
${BL2_LINKER_CP_OPTION}
5354
)
5455

5556
target_compile_definitions(bl2

platform/CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,12 @@ if(BL1 AND PLATFORM_DEFAULT_BL1)
273273
target_compile_options(platform_bl1_1
274274
PUBLIC
275275
$<$<BOOL:${BL1_1_SANITIZE}>:-fsanitize=${BL1_1_SANITIZE}>
276+
${BL1_COMPILER_CP_FLAG}
277+
)
278+
279+
target_link_options(platform_bl1_1
280+
PUBLIC
281+
${BL1_LINKER_CP_OPTION}
276282
)
277283

278284
target_sources(platform_bl1_1
@@ -352,6 +358,12 @@ if(BL1 AND PLATFORM_DEFAULT_BL1)
352358
target_compile_options(platform_bl1_2
353359
PUBLIC
354360
$<$<BOOL:${BL1_2_SANITIZE}>:-fsanitize=${BL1_2_SANITIZE}>
361+
${BL1_COMPILER_CP_FLAG}
362+
)
363+
364+
target_link_options(platform_bl1_2
365+
PUBLIC
366+
${BL1_LINKER_CP_OPTION}
355367
)
356368
endif()
357369

toolchain_ARMCLANG.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ macro(tfm_toolchain_reload_compiler)
233233
# is not actually enabled in BL2, it will cause BL2 runtime fault.
234234
set(BL2_LINKER_CP_OPTION --fpu=SoftVFP)
235235

236+
set(BL1_COMPILER_CP_FLAG
237+
$<$<COMPILE_LANGUAGE:C>:-mfpu=softvfp>
238+
$<$<COMPILE_LANGUAGE:ASM>:--fpu=softvfp>
239+
)
240+
set(BL1_LINKER_CP_OPTION --fpu=SoftVFP)
241+
236242
if (CONFIG_TFM_FLOAT_ABI STREQUAL "hard")
237243
set(COMPILER_CP_FLAG
238244
$<$<COMPILE_LANGUAGE:C>:-mfloat-abi=hard>

toolchain_GNUARM.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_INIT})
180180
set(CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS_INIT})
181181

182182
set(BL2_COMPILER_CP_FLAG -mfloat-abi=soft)
183+
set(BL2_LINKER_CP_OPTION -mfloat-abi=soft)
184+
185+
set(BL1_COMPILER_CP_FLAG -mfloat-abi=soft)
186+
set(BL1_LINKER_CP_OPTION -mfloat-abi=soft)
183187

184188
if (CONFIG_TFM_FLOAT_ABI STREQUAL "hard")
185189
set(COMPILER_CP_FLAG -mfloat-abi=hard)

0 commit comments

Comments
 (0)