Build zephyr.elf versus Build solution

I can see in Segger Embedded Studio v4.52 under the Build Tab, there are two methods to build the project.

1- Build > Build zephyr/zephyr.elf

2- Build > Build solution

What is the difference between the two methods?

Kind regards

  • Hi!

    The answer to your question has to do with the difference between "Solutions" and "Projects". Here is the SES documentation for this. 

    • A project contains and organizes everything you need to create a single application or a library.
    • A solution is a collection of projects and configurations.

    So "Build zephyr/<file>" builds a single project. Note that when building an application with a single image you will see this option ("build zephyr/zephyr.elf") while if you try with a multi-image application you will see "build zephyr/merged.hex". )

    "Build solution" builds all the projects in the current solution, as it's possible to have several independent projects in one solution. 

    You can also read about Zephyr's build overview in Build Overview

    Let me know if this answered your question!

    Best regards,


  • Thank you Heidi.

    I tend to build under Segger Embedded Studio, so, all the steps are hidden away. But it is good to be aware of what is going on in the background just things go wrong.

    Looking at the example 'light controller' solution I can see many projects but the build shows only Build zephyr/zephyr.elf. There is no mention of the zephyr/merged.hex.

    Which file in the build process tells SES that we are building a single or multiple images?

    Kind regards


  • There's not always a straight forward way to see if a project is a single-image or a multi-image build. 

    With regard to projects made for the nRF9160 SiP, all projects that require you to build for the non-secure board (nrf9160dk_nrf9160ns) are multi-image, as they all include the Secure Partition Manager as the child-image. This is usually mentioned in the documentation, and you can also check after the project has been built if there is a directory called "spm" in the build folder.

    When you say "light controller" example, do you mean the Bluetooth Mesh Light Controller? This is a single-image application, which you can check from the build log where the linker was only run once. 

    See when and why to use multiple images, specifically this sentence:

    Therefore, if you want to determine if you have zero, one, or more images, count the number of times the linker has been run. 

    The page "Building and configuring multiple images" explains a bit more on this topic. 

    Best regards,


  • Thank you Heidi for your comprehensive answer.Relaxed

    The light intensity controller project I am using is part of this tutorial

    nRF Connect SDK Tutorial - Part 2 | NCS v1.3.0

    For some obscure reason the project has stopped working. I am getting this error when I try to open it in SES.

  • Here is the log,

    Loading solution light_controller.emProject
    Executing load commands
    cmake -GNinja -DBOARD=nrf5340pdk_nrf5340_cpuapp -DBOARD_DIR=C:/Zypher/v1.3.0/zephyr/boards/arm/nrf5340pdk_nrf5340 -DZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb -DGNUARMEMB_TOOLCHAIN_PATH=C:/Zypher/v1.3.0/toolchain/opt -BC:/Dev/NCS_projects/light_controller/build_nrf5340pdk_nrf5340_cpuapp -HC:/Dev/NCS_projects/light_controller -DDTC_OVERLAY_FILE=C:/Dev/NCS_projects/light_controller/nrf5340pdk_nrf5340_cpuapp.overlay -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=C:/Zypher/v1.3.0/toolchain/segger_embedded_studio/html/
    Including boilerplate (Zephyr base (cached)): C:/Zypher/v1.3.0/zephyr/cmake/app/boilerplate.cmake
    -- Application: C:/Dev/NCS_projects/light_controller
    -- Using NCS Toolchain 1.3.0 for building. (C:/Zypher/v1.3.0/toolchain/cmake)
    -- Zephyr version: 2.3.0-rc1 (C:/Zypher/v1.3.0/zephyr)
    -- Board: nrf5340pdk_nrf5340_cpuapp
    -- Found west: C:/Zypher/v1.3.0/toolchain/opt/bin/Scripts/west.exe (found suitable version "0.7.2", minimum required is "0.7.1")
    -- Found dtc: C:/Zypher/v1.3.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (C:/Zypher/v1.3.0/toolchain/opt)
    -- Found BOARD.dts: C:/Zypher/v1.3.0/zephyr/boards/arm/nrf5340pdk_nrf5340/nrf5340pdk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: C:/Dev/NCS_projects/light_controller/nrf5340pdk_nrf5340_cpuapp.overlay
    Error: nrf5340pdk_nrf5340_cpuapp.dts.pre.tmp:670.7-19 syntax error
    FATAL ERROR: Unable to parse input tree
    CMake Error at C:/Zypher/v1.3.0/zephyr/cmake/dts.cmake:195 (message):
    command failed with return code: 1
    Call Stack (most recent call first):
    C:/Zypher/v1.3.0/zephyr/cmake/app/boilerplate.cmake:505 (include)
    C:/Zypher/v1.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    C:/Zypher/v1.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:3 (find_package)

    -- Configuring incomplete, errors occurred!
    Project load failed
    Reported error: solution load command failed (1)