CMake: Extend debug configuration

Enable debug output for InfiniTime, Nimble and the NRF SDK
via SEGGER RTT on debug builds.
This commit is contained in:
Christoph Honal 2022-05-10 22:11:08 +02:00 committed by JF
parent 61c2d8dbc7
commit e247afaa81
2 changed files with 25 additions and 6 deletions

View File

@ -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})

View File

@ -779,12 +779,26 @@ 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")
# 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)