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) 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) project(pinetime VERSION 1.9.0 LANGUAGES C CXX ASM)
set(CMAKE_C_STANDARD 99) 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("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS})
message("")
message("BUILD CONFIGURATION") message("BUILD CONFIGURATION")
message("-------------------") message("-------------------")
message(" * Mode : " ${CMAKE_BUILD_TYPE})
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH}) message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH}) 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__STACK_SIZE=1024)
add_definitions(-D__HEAP_SIZE=4096) add_definitions(-D__HEAP_SIZE=4096)
# NOTE : Add the following defines to enable debug mode of the NRF SDK: # Debug configuration
#add_definitions(-DDEBUG) if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
#add_definitions(-DDEBUG_NRF_USER) add_definitions(-DDEBUG)
add_definitions(-DDEBUG_NRF_USER)
if (NOT CMAKE_BUILD_TYPE) # NRF SDK Logging
set(CMAKE_BUILD_TYPE "Release") 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() endif()
add_subdirectory(displayapp/fonts) add_subdirectory(displayapp/fonts)