From e247afaa81a6011b61ea4a7cfdbd84fadbe29b4b Mon Sep 17 00:00:00 2001 From: Christoph Honal Date: Tue, 10 May 2022 22:11:08 +0200 Subject: [PATCH] CMake: Extend debug configuration Enable debug output for InfiniTime, Nimble and the NRF SDK via SEGGER RTT on debug builds. --- CMakeLists.txt | 5 +++++ src/CMakeLists.txt | 26 ++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6aaf62a..acd48698 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required(VERSION 3.10) + +set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release") + project(pinetime VERSION 1.9.0 LANGUAGES C CXX ASM) set(CMAKE_C_STANDARD 99) @@ -70,8 +73,10 @@ string(STRIP "${PROJECT_GIT_COMMIT_HASH}" PROJECT_GIT_COMMIT_HASH) message("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS}) +message("") message("BUILD CONFIGURATION") message("-------------------") +message(" * Mode : " ${CMAKE_BUILD_TYPE}) message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH}) message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index df4ca7f9..0080db13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -779,13 +779,27 @@ add_definitions(-DFREERTOS) add_definitions(-D__STACK_SIZE=1024) add_definitions(-D__HEAP_SIZE=4096) -# NOTE : Add the following defines to enable debug mode of the NRF SDK: -#add_definitions(-DDEBUG) -#add_definitions(-DDEBUG_NRF_USER) +# Debug configuration +if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") + add_definitions(-DDEBUG) + add_definitions(-DDEBUG_NRF_USER) -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif () + # NRF SDK Logging + add_definitions(-DNRF_LOG_ENABLED=1) + # add_definitions(-DNRF_LOG_BACKEND_RTT_ENABLED=1) + # add_definitions(-DNRF_LOG_BACKEND_SERIAL_USES_RTT=1) + + # NRF SDK individual modules logging + # add_definitions(-DCLOCK_CONFIG_LOG_ENABLED=1) + # add_definitions(-DCLOCK_CONFIG_LOG_LEVEL=4) + # add_definitions(-DRTC_CONFIG_LOG_ENABLED=1) + # add_definitions(-DRTC_CONFIG_LOG_LEVEL=4) + + # Nimble Logging + add_definitions(-DMYNEWT_VAL_NEWT_FEATURE_LOGCFG=1) + # add_definitions(-DMYNEWT_VAL_LOG_LEVEL=0) + # add_definitions(-DMYNEWT_VAL_BLE_HS_LOG_LVL=0) +endif() add_subdirectory(displayapp/fonts) target_compile_options(infinitime_fonts PUBLIC