diff --git a/arch/arm/core/cortex_m/tz/CMakeLists.txt b/arch/arm/core/cortex_m/tz/CMakeLists.txt index 19c67476e40..aac4f651619 100644 --- a/arch/arm/core/cortex_m/tz/CMakeLists.txt +++ b/arch/arm/core/cortex_m/tz/CMakeLists.txt @@ -2,7 +2,10 @@ # '-mcmse' enables the generation of code for the Secure state of the ARMv8-M # Security Extensions. This option is required when building a Secure firmware. -zephyr_compile_options_ifdef(CONFIG_ARM_SECURE_FIRMWARE -mcmse) + +zephyr_compile_options_ifdef(CONFIG_ARM_SECURE_FIRMWARE $<$:$>) +zephyr_compile_options_ifdef(CONFIG_ARM_SECURE_FIRMWARE $<$:$>) +zephyr_compile_options_ifdef(CONFIG_ARM_SECURE_FIRMWARE $<$:$>) if(CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS) diff --git a/cmake/compiler/compiler_flags_template.cmake b/cmake/compiler/compiler_flags_template.cmake index 447db04a2d3..bea8027bb0f 100644 --- a/cmake/compiler/compiler_flags_template.cmake +++ b/cmake/compiler/compiler_flags_template.cmake @@ -125,6 +125,9 @@ set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics) # Required ASM flags when compiling set_property(TARGET asm PROPERTY required) +# GCC compiler flags for imacros. The specific header must be appended by user. +set_property(TARGET asm PROPERTY imacros) + # Compiler flag for disabling pointer arithmetic warnings set_compiler_property(PROPERTY warning_no_pointer_arithmetic) @@ -149,3 +152,8 @@ set_compiler_property(PROPERTY specs) # Compiler flag for defining preinclude files. set_compiler_property(PROPERTY include_file) + +# Compiler flag for trustzone +set_compiler_property(PROPERTY cmse) + +set_property(TARGET asm PROPERTY cmse) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index 830d479ee66..3ff29a4b30c 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -231,6 +231,9 @@ set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe # Required ASM flags when using gcc set_property(TARGET asm PROPERTY required "-xassembler-with-cpp") +# GCC compiler flags for imacros. The specific header must be appended by user. +set_property(TARGET asm PROPERTY imacros "-imacros") + # gcc flag for colourful diagnostic messages check_set_compiler_property(PROPERTY diagnostic -fdiagnostics-color=always) @@ -253,3 +256,7 @@ set_compiler_property(PROPERTY no_builtin_malloc -fno-builtin-malloc) set_compiler_property(PROPERTY specs -specs=) set_compiler_property(PROPERTY include_file -include) + +set_compiler_property(PROPERTY cmse -mcmse) + +set_property(TARGET asm PROPERTY cmse -mcmse)