Skip to content
Permalink
Browse files

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>
  • Loading branch information...
daor-oti authored and aescolar committed Jun 11, 2019
1 parent a946b2c commit faa72b7015ef9cf44a1c91b9af0810063ca6003f
Showing with 10 additions and 1 deletion.
  1. +3 −1 CMakeLists.txt
  2. +7 −0 cmake/compiler/gcc/target_baremetal.cmake
@@ -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()

0 comments on commit faa72b7

Please sign in to comment.
You can’t perform that action at this time.