toolchain: move some hardcoded flags to properties

Some basic flags that were hardcoded needed
to be moved to properties to be able to implement
alternative toolchains.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
This commit is contained in:
Robin Kastberg 2025-02-05 21:24:47 +00:00 committed by Fabio Baltieri
commit e9a0d146cf
3 changed files with 19 additions and 1 deletions

View file

@ -2,7 +2,10 @@
# '-mcmse' enables the generation of code for the Secure state of the ARMv8-M # '-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. # 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 $<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,cmse>>)
zephyr_compile_options_ifdef(CONFIG_ARM_SECURE_FIRMWARE $<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler,cmse>>)
zephyr_compile_options_ifdef(CONFIG_ARM_SECURE_FIRMWARE $<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:asm,cmse>>)
if(CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS) if(CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS)

View file

@ -125,6 +125,9 @@ set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics)
# Required ASM flags when compiling # Required ASM flags when compiling
set_property(TARGET asm PROPERTY required) 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 # Compiler flag for disabling pointer arithmetic warnings
set_compiler_property(PROPERTY warning_no_pointer_arithmetic) set_compiler_property(PROPERTY warning_no_pointer_arithmetic)
@ -149,3 +152,8 @@ set_compiler_property(PROPERTY specs)
# Compiler flag for defining preinclude files. # Compiler flag for defining preinclude files.
set_compiler_property(PROPERTY include_file) set_compiler_property(PROPERTY include_file)
# Compiler flag for trustzone
set_compiler_property(PROPERTY cmse)
set_property(TARGET asm PROPERTY cmse)

View file

@ -231,6 +231,9 @@ set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe
# Required ASM flags when using gcc # Required ASM flags when using gcc
set_property(TARGET asm PROPERTY required "-xassembler-with-cpp") 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 # gcc flag for colourful diagnostic messages
check_set_compiler_property(PROPERTY diagnostic -fdiagnostics-color=always) 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 specs -specs=)
set_compiler_property(PROPERTY include_file -include) set_compiler_property(PROPERTY include_file -include)
set_compiler_property(PROPERTY cmse -mcmse)
set_property(TARGET asm PROPERTY cmse -mcmse)