Skip to content

Commit

Permalink
[buildmgr] Add C pre-processor secure flags
Browse files Browse the repository at this point in the history
  • Loading branch information
grasci-arm authored Jul 7, 2023
1 parent bac6f79 commit 74b06bd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
10 changes: 5 additions & 5 deletions tools/buildmgr/cbuildgen/config/AC6.6.18.0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ set(AS_GNU_BYTE_ORDER "${AS_BYTE_ORDER}")

# C Pre-Processor

set(CPP_FLAGS "-E --target=arm-arm-none-eabi ${ARMCLANG_CPU} -xc")
if(SECURE STREQUAL "Secure")
set(CC_SECURE "-mcmse")
endif()

set(CPP_FLAGS "-E --target=arm-arm-none-eabi ${ARMCLANG_CPU} -xc ${CC_SECURE}")
set(CPP_DEFINES ${LD_SCRIPT_PP_DEFINES})
cbuild_set_defines(CC CPP_DEFINES)
if(DEFINED LD_REGIONS AND NOT LD_REGIONS STREQUAL "")
Expand All @@ -565,10 +569,6 @@ set(_ISYS "-isystem ")
set(CC_OPTIONS_FLAGS)
cbuild_set_options_flags(CC "${OPTIMIZE}" "${DEBUG}" "${WARNINGS}" "${LANGUAGE_CC}" CC_OPTIONS_FLAGS)

if(SECURE STREQUAL "Secure")
set(CC_SECURE "-mcmse")
endif()

if(BRANCHPROT STREQUAL "NO_BRANCHPROT")
set(CC_BRANCHPROT "-mbranch-protection=none")
elseif(BRANCHPROT STREQUAL "BTI")
Expand Down
12 changes: 5 additions & 7 deletions tools/buildmgr/cbuildgen/config/CLANG.16.0.0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ endif()

# C Pre-Processor

set(CPP_FLAGS "-E -P -xc")
if(SECURE STREQUAL "Secure")
set(CC_SECURE "-mcmse")
endif()

set(CPP_FLAGS "-E -P ${CLANG_CPU} -xc ${CC_SECURE}")
set(CPP_DEFINES ${LD_SCRIPT_PP_DEFINES})
cbuild_set_defines(CC CPP_DEFINES)
if(DEFINED LD_REGIONS AND NOT LD_REGIONS STREQUAL "")
Expand All @@ -275,12 +279,6 @@ set(CC_FLAGS "--target=${CLANG_ARCH}-none-eabi --sysroot=${TOOLCHAIN_ROOT}/../li
set(CC_OPTIONS_FLAGS)
cbuild_set_options_flags(CC "${OPTIMIZE}" "${DEBUG}" "${WARNINGS}" "${LANGUAGE_CC}" CC_OPTIONS_FLAGS)

if(SECURE STREQUAL "Secure")
set(CC_SECURE "-mcmse")
else()
set(CC_SECURE "")
endif()

if(BRANCHPROT STREQUAL "NO_BRANCHPROT")
set(CC_BRANCHPROT "-mbranch-protection=none")
elseif(BRANCHPROT STREQUAL "BTI")
Expand Down
12 changes: 5 additions & 7 deletions tools/buildmgr/cbuildgen/config/GCC.10.3.1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ set(AS_GNU_BYTE_ORDER "${AS_BYTE_ORDER}")

# C Pre-Processor

set(CPP_FLAGS "-E -P -xc")
if(SECURE STREQUAL "Secure")
set(CC_SECURE "-mcmse")
endif()

set(CPP_FLAGS "-E -P ${GNUASM_CPU} -xc ${CC_SECURE}")
set(CPP_DEFINES ${LD_SCRIPT_PP_DEFINES})
cbuild_set_defines(CC CPP_DEFINES)
if(DEFINED LD_REGIONS AND NOT LD_REGIONS STREQUAL "")
Expand All @@ -274,12 +278,6 @@ set(_ISYS "-isystem ")
set(CC_OPTIONS_FLAGS)
cbuild_set_options_flags(CC "${OPTIMIZE}" "${DEBUG}" "${WARNINGS}" "${LANGUAGE_CC}" CC_OPTIONS_FLAGS)

if(SECURE STREQUAL "Secure")
set(CC_SECURE "-mcmse")
else()
set(CC_SECURE "")
endif()

if(BRANCHPROT STREQUAL "NO_BRANCHPROT")
set(CC_BRANCHPROT "-mbranch-protection=none")
elseif(BRANCHPROT STREQUAL "BTI")
Expand Down
15 changes: 8 additions & 7 deletions tools/buildmgr/cbuildgen/config/IAR.9.32.1.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,19 @@ cbuild_set_options_flags(ASM "${OPTIMIZE}" "${DEBUG}" "${WARNINGS}" "" ASM_OPTIO

# C Pre-Processor

if((SECURE STREQUAL "Secure") AND
(TZ STREQUAL "NO_TZ") AND
${SUPPORTS_TZ} )
set(CC_SECURE "--cmse")
endif()

set(CPP_FLAGS "--cpu=${IAR_CPU} --fpu=${IAR_FPU} ${CC_SECURE}")
set(CPP_DEFINES ${LD_SCRIPT_PP_DEFINES})
cbuild_set_defines(CC CPP_DEFINES)
if(DEFINED LD_REGIONS AND NOT LD_REGIONS STREQUAL "")
set(CPP_INCLUDES "--preinclude \"${LD_REGIONS}\"")
endif()
set(CPP_ARGS_LD_SCRIPT "${CPP_DEFINES} \"${LD_SCRIPT}\" ${CPP_INCLUDES} --preprocess=ns \"${LD_SCRIPT_PP}\"")
set(CPP_ARGS_LD_SCRIPT "${CPP_FLAGS} ${CPP_DEFINES} \"${LD_SCRIPT}\" ${CPP_INCLUDES} --preprocess=ns \"${LD_SCRIPT_PP}\"")
separate_arguments(CPP_ARGS_LD_SCRIPT NATIVE_COMMAND ${CPP_ARGS_LD_SCRIPT})

# C Compiler
Expand All @@ -300,12 +307,6 @@ set(CC_OPTIONS_FLAGS)
cbuild_set_options_flags(CC "${OPTIMIZE}" "${DEBUG}" "${WARNINGS}" "${LANGUAGE_CC}" CC_OPTIONS_FLAGS)
set(_PI "--preinclude ")

if((SECURE STREQUAL "Secure") AND
(TZ STREQUAL "NO_TZ") AND
${SUPPORTS_TZ} )
set(CC_SECURE "--cmse")
endif()

# C++ Compiler

set(CXX_CPU "${CC_CPU}")
Expand Down

0 comments on commit 74b06bd

Please sign in to comment.