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,

    Is it possible to specify more than one prj.conf file via the 'Extended Settings' in the field 'Extra CMake Build Options'. If yes, then what is the syntax?

    -DCONF_FILE=prj_1.conf prj_2.conf prj_3.conf

    or

    -DCONF_FILE=prj_1.conf -DCONF_FILE=prj_2.conf -DCONF_FILE=prj_3.conf

    Thank you.
    Kind regards
    Mohamed

  • Not tried it myself, but you can try -DCONF_FILE="prj_1.conf prj_2.conf prj_3.conf"

  • How can I check if my project configurations have been applied?
    Also, are the quotation marks " " necessary?
    I built a debug version of my project using prj_debug.conf and a release version using prj_release.conf in two different build folders but when I compare the debug and release .config files I find they are identical. I disabled logs in the release build CONFIG_LOG=n but in it is set to 'y' in .config. 
    This is not what I was expecting. What am I doing wrong?
    Kind regards
    Mohamed
  • I suggest to use Visual Studio Code instead of SES, I know that SES may "cache" some of the configuration unless you re-open the project in SES after doing modifications to prj conf files.

    Kenneth

  • Hi Kenneth,

    Thank you for your response but that is not the answer I was hoping for.

    Switching IDE at this critical time in the development phase of the project is not an option.

    I am aware of the "cache" problem SES suffers from so, I do reload the project after each mod to prj.conf.

    Can you please try to find out how I can build a debug and a release version of my project under SES. I would like to be able to achieve this using two project configuration files, prj_debug.conf and prj_release.conf.  Note, since I initially submitted this ticket I have moved to a new SES version,

    SEGGER Embedded Studio for ARM
    Release 5.60  Build 2021081102.47262
    Nordic Edition
    Windows x64

    © 2014-2021 SEGGER Microcontroller GmbH
    © 1997-2021 Rowley Associates Ltd.

    segger-as: version 2.11
    segger-cc: version 12.2.1
    segger-cc-ng: version 12.91.6
    segger-ld: version 4.12.1
    segger-rtl: version 2.22.0

    Thank you for your support.

    Kind regards
    Mohamed
Reply
  • Hi Kenneth,

    Thank you for your response but that is not the answer I was hoping for.

    Switching IDE at this critical time in the development phase of the project is not an option.

    I am aware of the "cache" problem SES suffers from so, I do reload the project after each mod to prj.conf.

    Can you please try to find out how I can build a debug and a release version of my project under SES. I would like to be able to achieve this using two project configuration files, prj_debug.conf and prj_release.conf.  Note, since I initially submitted this ticket I have moved to a new SES version,

    SEGGER Embedded Studio for ARM
    Release 5.60  Build 2021081102.47262
    Nordic Edition
    Windows x64

    © 2014-2021 SEGGER Microcontroller GmbH
    © 1997-2021 Rowley Associates Ltd.

    segger-as: version 2.11
    segger-cc: version 12.2.1
    segger-cc-ng: version 12.91.6
    segger-ld: version 4.12.1
    segger-rtl: version 2.22.0

    Thank you for your support.

    Kind regards
    Mohamed
Children
  • Migrating is very easy:
    https://www.youtube.com/watch?v=ptJBEAOIm5w&list=PLx_tBuQ_KSqEt7NK-H7Lu78lT2OijwIMl&index=6 

    That said, the description for SES should be as stated here (seems there are two different ways it can be done in SES if you see the Note also below the first suggestion): https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html?highlight=dconf_file#selecting-a-build-type-in-ses 

    Best regards,
    Kenneth

  • Thank you Kenneth.

    "You can also specify the build type in the Additional CMake Options field in Tools > Options > nRF Connect. However, the changes will only be applied after re-opening the project. Reloading the project is not sufficient."

    I am not sure what the difference is between re-opening and re-loading a project.

    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.

    Looking closely at the logs when opening the project and creating the solution I can see that it is the content of prj_debug.conf that is merged in the configuration NOT prj_release.conf as expected. This is despite the fact that the cmake.exe command line includes -DCONF_FILE=prj_release.conf.
    Creating solution HomeBeacon_dev_sb.emProject
    C:/Zypher/v1.7.0/toolchain/opt/bin/cmake.exe -GNinja -DBOARD=nrf52833dk_nrf52833 -DBOARD_DIR=C:\Zypher\v1.7.0\zephyr\boards\arm\nrf52833dk_nrf52833 -BC:\Sandbox\HomeBeacon_dev_sb\build_nrf52833dk_nrf52833_release -SC:\Sandbox\HomeBeacon_dev_sb -DNCS_TOOLCHAIN_VERSION=1.7.0 -DCONF_FILE=prj_release.conf -DDTC_OVERLAY_FILE=C:/Sandbox/HomeBeacon_dev_sb/nrf52833dk_nrf52833.overlay -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=C:\Zypher\v1.7.0\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py
    -- Application: C:/Sandbox/HomeBeacon_dev_sb
    -- Zephyr version: 2.6.99 (C:/Zypher/v1.7.0/zephyr), build: v2.6.99-ncs1
    -- Found Python3: C:/Zypher/v1.7.0/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
    -- 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_release/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_release/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_release/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_release/zephyr/dts.cmake
    Parsing C:/Sandbox/HomeBeacon_dev_sb/Kconfig
    Loaded configuration 'C:/Zypher/v1.7.0/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833_defconfig'
    Merged configuration 'C:/Sandbox/HomeBeacon_dev_sb/prj_debug.conf'
    Configuration saved to 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_release/zephyr/.config'
    Kconfig header saved to 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_release/zephyr/include/generated/autoconf.h'
    
    Please explain what is going on here and help sort this problem out.
    Thank you.
    Kind regards
    Mohamed
  • Hi Kenneth,

    That said, the description for SES should be as stated here (seems there are two different ways it can be done in SES if you see the Note also below the first suggestion): https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html?highlight=dconf_file#selecting-a-build-type-in-ses 
    From the link you sent me, it is stated in step 4 Do not select Clean Build Directory.
    Why is this the case?
    I thought starting with a clean build folder is often if not always good practice.
    Please clarify.
    Thank you.
    Kind regards
    Mohamed
  • Can you please try building from command line using west and/or transition to Visual Studio code? 

    Best regards,
    Kenneth

  • Good morning Kenneth,

    I appreciate you are trying to get me to migrate to VS Code but unfortunately, the team and management are reluctant to make the switch right now. So, we need to get this sorted as soon as possible. If you cannot solve this problem maybe you can consult with other members in your team.

    These are the outstanding questions I would like help with.

    Q1/ 

    From the link you sent me, it is stated in step 4 Do not select Clean Build Directory.
    Why is this the case?

    Q2/ 

    That said, the description for SES should be as stated here (seems there are two different ways it can be done in SES if you see the Note also below the first suggestion): https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_modifying.html?highlight=dconf_file#selecting-a-build-type-in-ses 

    If I choose to select the project conf file using the second method as shown below

    Tools > Options > nRF Connect > Additional CMake Options -DCONF_FILE=prj_release.conf

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

    Can I select to do a 'Clean Build Directory'?

    Q3/ 
    What is the difference between re-opening and re-loading a project?

    Q4/ 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. See logs below.

    Creating solution HomeBeacon_dev_sb.emProject                                    C:/Zypher/v1.7.0/toolchain/opt/bin/cmake.exe -GNinja -DBOARD=nrf52833dk_nrf52833 -DBOARD_DIR=C:\Zypher\v1.7.0\zephyr\boards\arm\nrf52833dk_nrf52833 -BC:\Sandbox\HomeBeacon_dev_sb\build_nrf52833dk_nrf52833_rel_v1_3_99 -SC:\Sandbox\HomeBeacon_dev_sb -DNCS_TOOLCHAIN_VERSION=1.7.0 -DCONF_FILE=prj_release.conf -DDTC_OVERLAY_FILE=C:/Sandbox/HomeBeacon_dev_sb/nrf52833dk_nrf52833.overlay -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=C:\Zypher\v1.7.0\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py
    -- Application: C:/Sandbox/HomeBeacon_dev_sb
    -- Zephyr version: 2.6.99 (C:/Zypher/v1.7.0/zephyr), build: v2.6.99-ncs1
    -- Found Python3: C:/Zypher/v1.7.0/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- 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_v1_3_99/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1_3_99/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1_3_99/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1_3_99/zephyr/dts.cmake
    Parsing C:/Sandbox/HomeBeacon_dev_sb/Kconfig
    Loaded configuration 'C:/Zypher/v1.7.0/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833_defconfig'
    Merged configuration 'C:/Sandbox/HomeBeacon_dev_sb/prj_debug.conf'
    Configuration saved to 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1_3_99/zephyr/.config'
    Kconfig header saved to 'C:/Sandbox/HomeBeacon_dev_sb/build_nrf52833dk_nrf52833_rel_v1_3_99/zephyr/include/generated/autoconf.h'

    ...

    Kind regards

    Mohamed

Related