diff --git a/CMakeLists.txt b/CMakeLists.txt index f5132e8e40a..96d1807b37f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} ) diff --git a/cmake/compiler/gcc/target_baremetal.cmake b/cmake/compiler/gcc/target_baremetal.cmake index d2686044350..41e6ce877a6 100644 --- a/cmake/compiler/gcc/target_baremetal.cmake +++ b/cmake/compiler/gcc/target_baremetal.cmake @@ -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()