cmake: Toolchain abstraction: Introducing toolchain_cc_freestanding
The macro is intended to abstract the -ffreestanding compiler option which tells the compiler that this is a bare metal env. The option is compiler and thus toolchain specific, but this macro leaves it up to the toolchain to decide the value of the option. The intent here is to abstract Zephyr's dependence on toolchains, thus allowing for easier porting to other, perhaps commercial, toolchains and/or usecases. No functional change expected. Signed-off-by: Danny Oerndrup <daor@demant.com>
This commit is contained in:
parent
a946b2cc7a
commit
faa72b7015
|
@ -214,10 +214,12 @@ endif()
|
|||
# @Intent: Set compiler specific flags for standard C includes
|
||||
toolchain_cc_nostdinc()
|
||||
|
||||
# @Intent: Set compiler specific flag for bare metal freestanding option
|
||||
toolchain_cc_freestanding()
|
||||
|
||||
zephyr_compile_options(
|
||||
-g # TODO: build configuration enough?
|
||||
-imacros ${AUTOCONF_H}
|
||||
-ffreestanding
|
||||
-fno-common
|
||||
${TOOLCHAIN_C_FLAGS}
|
||||
)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# See root CMakeLists.txt for description and expectations of these macros
|
||||
|
||||
macro(toolchain_cc_nostdinc)
|
||||
|
||||
|
@ -11,3 +12,9 @@ macro(toolchain_cc_nostdinc)
|
|||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(toolchain_cc_freestanding)
|
||||
|
||||
zephyr_compile_options(-ffreestanding)
|
||||
|
||||
endmacro()
|
||||
|
|
Loading…
Reference in a new issue