This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Differentiating compiler options between ZDebug and ZRelease build configs with NCS/SES

The following questions are in regards to the instructions at nRF_Connect_SDK-modifying-a-sample-application.

In the Windows environment, I am transitioning from using nRF5_SDK_16.0.0 to using

  • nRF Connect SDK v1.3.0, with
  • SES 4.52
  • board nrf52840dk_nrf52840.

1. In the section NRF_Connect_SDK-configuring-build-types, it's not clear to me as to how to set compiler options individually per build configs ZDebug vs ZRelease.

  • For example, if we want the ZDebug build to include compiler options like "-g -O0 -DDEBUG" but the ZRelease build to instead include compiler options like "-O3 -DNDEBUG", how do we do this?

The figure in maintaining-cmakelist-txt-in-ses shows how to set compiler defines and options, but those options would apply to both ZDebug and ZRelease, as far as I can tell.

Furthermore, when I built nrf_desktop for ZDebug and then ZRelease to see what happens, I saw in the build outputs that both builds had "-O2" and "-g" compiler options.

  • There were very few differences between those two build outputs other than things like ZDebug had an include path for rtt but ZRelease did not, as you would expect when you look at the diff between the debug/release .conf files.
  • I was hoping to see at least some optimization differences, or at least a "-DDEBUG" difference, between the two build outputs to help me figure out the answer to this question.

2. In my opinion, the section selecting-a-build-type-in-ses or the previous section should indicate that the SES menus "Build/Build Configuration" and "Build/Set Active Build Configuration" are not applicable with this SDK. I originally was looking for ZDebug and ZRelease options to show up in those menus after following the instructions in the previous section.

3. In the instruction on how to set the CONF_FILE variable for the build configs (see step 2 in Creating build type files), doesn't the path "${CMAKE_CURRENT_SOURCE_DIR}" need to be in the CONF_FILE setting, as in:

if (CMAKE_BUILD_TYPE)

  set(CONF_FILE "${CMAKE_CURRENT_SOURCE_DIR}/app_${CMAKE_BUILD_TYPE}.conf")

endif()

  • I found this path addition necessary. Without that path, the conf file was not found by cmake, as I learned when using assert_exists(CONF_FILE).

4. Is there something special with the names ZDebug and ZRelease vs traditional build config names Debug and Release?

  • I assume there is a link that describes these names, but I can't find one.  If you can provide a link and it's for Zephyr in general, is there any additional meaning here for nRF usage in the SDK not described in that link?

5. Is building with the command line, and perhaps just using SES for a debugger tool, the easier way to go with this SDK?

In general, I am pleased with Nordic documentation, but perhaps I am not finding the right places to look for the questions above.

Related