Best practice advice for Zephyr debug and release configurations.

I am mid-way through development with the nRF52840 DK and Zephyr using the VSCode extension. I'm using v1.8.0 of the SDK.  

I am looking for advice on setting my configuration up for both debug and release builds. 

Right now, when I do a build, I get this problem reported in VSCode: 

The CMake build type was set to 'Debug', but the optimization flag was set to '-Og'.

I've searched around the web and Devzone for advice, but most of the advice has to do with SES, not VSCode and the Nordic extension. 

When I created the project, I did check the checkbox to Enable Debug Options.  

  • How does one best set up a project to have both release and debug builds for Zephyr in VSCode? 
  • I suspect it involves creating a prj_release.conf and prj_debug.conf, and then creating a build configuration using one of each. Is this right?  Do you usually add a Kconfig fragment or Extra CMake arguments?
  • What CMake or Kconfig commands set up for optimization and debug? 
  • Is there a sample app showing both debug and release configurations? 

Thanks,

Steve

P.S. My current prj.conf is listed here: 

CONFIG_PRINTK=y
CONFIG_ASSERT=y
CONFIG_SPI=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y

CONFIG_NO_OPTIMIZATIONS=y

# Debugging configuration
CONFIG_THREAD_NAME=y
CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_ANALYZER_AUTO=y
CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
CONFIG_THREAD_ANALYZER_USE_PRINTK=y
CONFIG_CONSOLE=y

# add asserts
CONFIG_ASSERT=y
CONFIG_ASSERT_VERBOSE=y
CONFIG_ASSERT_NO_COND_INFO=n
CONFIG_ASSERT_NO_MSG_INFO=n
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_THREAD_NAME=y

CONFIG_LOG=y

CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_SMP=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_BAS=y

CONFIG_BT_DIS=y
CONFIG_BT_DIS_PNP=n
CONFIG_BT_DIS_MODEL="My Model"
CONFIG_BT_DIS_MANUF="My Manufacturer"
CONFIG_BT_DIS_SERIAL_NUMBER=y
CONFIG_BT_DIS_FW_REV=y
CONFIG_BT_DIS_HW_REV=y
CONFIG_BT_DIS_SERIAL_NUMBER_STR="ABCDEF"
CONFIG_BT_DIS_FW_REV_STR="1.0.1"
CONFIG_BT_DIS_HW_REV_STR="1"

CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n

CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

CONFIG_BT_DEVICE_NAME="My Device"

Related