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

Segger Embedded Studio: Debug and Release build configurations

I created two build configurations a Debug and a Release in SES IDE.

Build > Build Configurations...

I wanted to select the  DEBUG_OPTIMIZATIONS level for the Debug build configuration and the SPEED_OPTIMIZATIONS for the Release one.

In Project Explorer, select the top Solution then select the 'Debug' build Configuration

Project > Configure nRF Connect Project... > DEBUG_OPTIMIZATIONS > Configure > Save solution (if prompted)

Then in Project Explorer, select the top Solution then select the 'Release' build Configuration

Project > Configure nRF Connect Project... > SIZE_OPTIMIZATIONS > Configure > Save solution (if prompted)

However, when I go back and select the 'Debug' build configuration to view its optimisation setting I find

Project > Configure nRF Connect Project... > SIZE_OPTIMIZATIONS   

NOT DEBUG_OPTIMIZATIONS as expected.

It looks like whichever build configuration is set last overwrites the other one.

Can you please tell me what I am doing wrong.

Thank you.

Mohamed Belaroussi

Parents
  • This seems like a bug in SES, I can report it, I assume you are using v4.52?

    In the meantime you can also control this in prj.conf by setting e.g. CONFIG_DEBUG_OPMTIMIZATIONS=y

  • Thank you Kenneth.

    I don't use the command line tools. I am using SES IDE and like any other IDE I used before I should be able to set debug and release configurations within SES Nordic Edition. I tried to get help from Segger but they directed me to Nordic because SES (Nordic Edition) is not supported by Segger. 

    I don't know how this can be done in SES, but

    If you don't know how it can be done maybe you can ask one of your colleagues or even Segger.

    I asked this question over six months ago, I was hoping by now someone somewhere would have figured out how to do this within SES. As I said earlier Segger were not willing to help me but if someone from Nordic approached them they might be be more accommodating.

    While waiting for a resolution to my ticket I am using two project configuration files prj-debug,conf and prj-release.conf, an extract from the two variants is shown below. My question is this,

    Do I need to remove the logging configurations (text in blue below) from the release project file prj-release.conf ?

    prj-debug.conf

    ---------------------

    ...

    ### COMPILER OPTIONS ###
    #
    CONFIG_DEBUG_OPTIMIZATIONS=y

    ### Logging ####
    #
    # For the PID 4 hardware we must set CONFIG_SERIAL=n because otherwise the SPI CS/BUSY
    # pins will be allocated to UART0 CTS/RTS pins.
    CONFIG_SERIAL=n
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    #CONFIG_UART_CONSOLE=n
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_PRINTK=y

    ...

    prj-release.conf

    ----------------------

    ...

    ### COMPILER OPTIONS ###
    #
    #CONFIG_CODING_GUIDELINE_CHECK is not set
    # CONFIG_NATIVE_APPLICATION is not set
    CONFIG_SIZE_OPTIMIZATIONS=y
    CONFIG_SPEED_OPTIMIZATIONS=y
    CONFIG_DEBUG_OPTIMIZATIONS=n
    # CONFIG_NO_OPTIMIZATIONS is not set
    CONFIG_COMPILER_OPT=""
    # end of Compiler Options

    ### Logging ####
    #
    # For the PID 4 hardware we must set CONFIG_SERIAL=n because otherwise the SPI CS/BUSY
    # pins will be allocated to UART0 CTS/RTS pins.
    CONFIG_SERIAL=n
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    #CONFIG_UART_CONSOLE=n
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_PRINTK=y

    ...

    Kind regards

    Mohamed

  • Hi Kenneth,

    Thank you for your answers.

    I am not sure why the documentation says not to choose clean build directory, unless there are some configurations you have set using menuconfig in SES that you may want to keep. 
    I am not aware of any configurations I have in SES that I would like to keep.
    How do I check whether I have configurations set in SES using menuconfig?

    > When I open the project after performing the actions in Q2/ above, I see in SES logs that prj_debug.conf is being merged instead of prj_release.conf as specified in -DCONF_FILE=prj_release.conf

    This is likely because you don't clean the build folder and/or CMake does not run.

    I have tried both with and without selecting the 'Clean Build folder' option and I still see prj_debug.conf instead of prj_release.conf being merged in .config. as reported in my previous post.

    Kind regards
    Mohamed

  • Have you tried the other option also? 
    - Run Cmake with Project > Run CMake. 

    Kenneth

  • Yes, I have but no success still.

    In SES I did 

    Tools > Options > nRF Connect then added -DCONF_FILE=prj_release.conf

    File > Open nRF Connect SDK Project... to re-open the project

    Then did a new build in a new empty build folder but the .config file is still not being updated with my config that is in prj_release.conf.

    For example I set CONFIG_LOG=n in prj_release.conf but in .config in the new build folder I see CONFIG_LOG=y.

    I then ran Cmake, as you suggested, 

    Project > Run CMake

    But nothing has changed in the .config file, see extract from the log trace below,

    Creating solution HomeBeacon_dev_sb.emProject
    -- Application: C:/Sandbox/HomeBeacon_dev_sb
    -- Zephyr version: 2.6.99 (C:/Zypher/v1.7.0/zephyr), build: v2.6.99-ncs1
    -- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
    -- Board: nrf52833dk_nrf52833
    -- Cache files will be written to: C:/Zypher/v1.7.0/zephyr/.cache
    -- Found dtc: C:/Zypher/v1.7.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (C:/Zypher/v1.7.0/toolchain/opt)
    -- Found BOARD.dts: C:/Zypher/v1.7.0/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833.dts
    -- Found devicetree overlay: C:/Sandbox/HomeBeacon_dev_sb/nrf52833dk_nrf52833.overlay
    -- Generated zephyr.dts: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/zephyr/dts.cmake
    Parsing C:/Sandbox/HomeBeacon_dev_sb/Kconfig
    Loaded configuration 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/zephyr/.config'
    No change to configuration in 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/zephyr/.config'
    No change to Kconfig header in 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/zephyr/include/generated/autoconf.h'
    -- Application: C:/Zypher/v1.7.0/bootloader/mcuboot/boot/zephyr
    -- Zephyr version: 2.6.99 (C:/Zypher/v1.7.0/zephyr), build: v2.6.99-ncs1
    -- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
    -- Board: nrf52833dk_nrf52833
    -- Cache files will be written to: C:/Zypher/v1.7.0/zephyr/.cache
    -- Found dtc: C:/Zypher/v1.7.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (C:/Zypher/v1.7.0/toolchain/opt)
    -- Found BOARD.dts: C:/Zypher/v1.7.0/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833.dts
    -- Found devicetree overlay: C:/Zypher/v1.7.0/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Found devicetree overlay: C:/Zypher/v1.7.0/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot/zephyr/dts.cmake
    Parsing C:/Zypher/v1.7.0/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot/zephyr/.config'
    No change to configuration in 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot/zephyr/.config'
    No change to Kconfig header in 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot/zephyr/include/generated/autoconf.h'
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake/mcuboot
    Partition 'mcuboot' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_pad' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary_app' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_secondary' is not included in the dynamic resolving since it is statically defined.
    Dropping partition 'nvs_storage' since its size is 0.
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1399_cmake
    Including boilerplate (Zephyr base (cached)): C:/Zypher/v1.7.0/zephyr/cmake/app/boilerplate.cmake
    -- Using NCS Toolchain 1.7.0 for building. (C:/Zypher/v1.7.0/toolchain/cmake)

    === child image mcuboot - begin ===
    Including boilerplate (Zephyr base (cached)): C:/Zypher/v1.7.0/zephyr/cmake/app/boilerplate.cmake
    -- Using NCS Toolchain 1.7.0 for building. (C:/Zypher/v1.7.0/toolchain/cmake)
    MCUBoot bootloader key file: C:/Zypher/v1.7.0/bootloader/mcuboot/root-rsa-2048.pem
    === child image mcuboot - end ===

    CMake Warning at C:/Zypher/v1.7.0/nrf/modules/mcuboot/CMakeLists.txt:204 (message):

    ---------------------------------------------------------
    --- WARNING: Using default MCUBoot key, it should not ---
    --- be used for production. ---
    ---------------------------------------------------------


    Loading solution HomeBeacon_dev_sb.emProject
    Loading solution build.emProject
    Mapping project information
    Mapping project zephyr/merged.hex
    Mapping project all

    ...

    ...

    Let me know if you would like to see the whole trace.
    Kind regards
    Mohamed

  • Have you tried (at least for testing) to compile your project from command line using west and/or visual studio code? That can at least provide information if the issue is related to SES or not.

    Kenneth

  • Hi Kenneth,

    Thank you for your on-going support. I do appreciate it.

    I have found the root cause of my problem. It is self-inflicted.

    I inherited a CMakelists.txt and in there I found these configuration lines,

    if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE debug)
    endif()

    # Set main PID4 configuration file
    set(CONF_FILE "${CMAKE_CURRENT_LIST_DIR}/prj_${CMAKE_BUILD_TYPE}.conf")

    So, it was always the prj_debug.conf that was used. It seems the content of the CMakelists.txt overrides whatever I specify in SES using -DCONF_FILE=....

    Tools > Options > nRF Connect then added -DCONF_FILE=prj_release.conf

    Now, I just change the line highlighted in yellow above to switch between debug and release configuration.
    However, I still cannot create debug and release configurations in SES. I asked the question over a year ago in this ticket but I still don't know how to do it. Can you hel?
    Kind regards
    Mohamed

Reply
  • Hi Kenneth,

    Thank you for your on-going support. I do appreciate it.

    I have found the root cause of my problem. It is self-inflicted.

    I inherited a CMakelists.txt and in there I found these configuration lines,

    if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE debug)
    endif()

    # Set main PID4 configuration file
    set(CONF_FILE "${CMAKE_CURRENT_LIST_DIR}/prj_${CMAKE_BUILD_TYPE}.conf")

    So, it was always the prj_debug.conf that was used. It seems the content of the CMakelists.txt overrides whatever I specify in SES using -DCONF_FILE=....

    Tools > Options > nRF Connect then added -DCONF_FILE=prj_release.conf

    Now, I just change the line highlighted in yellow above to switch between debug and release configuration.
    However, I still cannot create debug and release configurations in SES. I asked the question over a year ago in this ticket but I still don't know how to do it. Can you hel?
    Kind regards
    Mohamed

Children
Related