From e0569ac2dc9162834485f1f95f59919b7511ea3a Mon Sep 17 00:00:00 2001 From: Danny Oerndrup Date: Tue, 23 Jul 2019 09:00:55 +0200 Subject: [PATCH] cmake: Toolchain abstraction: Abstract compiler flag for add debug info The macro, toolchain_cc_produce_debug_info, adds the compiler specific flag for enabling the production of debugging information in the toolchain native format. 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 --- CMakeLists.txt | 4 +++- cmake/compiler/gcc/target_base.cmake | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db642e9fc367..a145738a6c33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,8 +226,10 @@ toolchain_cc_freestanding() # @Intent: Set compiler specific flag for tentative definitions, no-common toolchain_cc_nocommon() +# @Intent: Set compiler specific flag for production of debug information +toolchain_cc_produce_debug_info() + zephyr_compile_options( - -g # TODO: build configuration enough? ${TOOLCHAIN_C_FLAGS} ) diff --git a/cmake/compiler/gcc/target_base.cmake b/cmake/compiler/gcc/target_base.cmake index b8f834ce4919..a180962697b1 100644 --- a/cmake/compiler/gcc/target_base.cmake +++ b/cmake/compiler/gcc/target_base.cmake @@ -7,6 +7,12 @@ # # See root CMakeLists.txt for description and expectations of this macro +macro(toolchain_cc_produce_debug_info) + + zephyr_compile_options(-g) # TODO: build configuration enough? + +endmacro() + macro(toolchain_cc_nocommon) zephyr_compile_options(-fno-common)