How can I provide child image configuration fragments for a specific build (e.g. Extra CMake arguments) ?

I am using NRF Connect SDK 2.3.0  with corresponding toolchain and VS Code with latest extensions.

I have created applications outside of the NCS hierarchy and would like to avoid modifying files in NCS.

In my project I have multiple build configurations.  Each build configuration has different combination of configuration overlay files. 

I need to also provide various configuration overlay files to the child images especially MCUBOOT.

I have been able to do this with Extra CMake arguments -Dmcuboot_OVERLAY_CONFIG="/absolute_path/that/is/specific/to/my/git/clone" however I want to avoid using absolute paths since they won't work correctly if i git clone into a different location.

Is there anyway I can pass build configuration specific child image configuration files from the project without using an absolute path?

Actually on additional inspection, I also noticed that the generated CmakeCache.txt is full of absolute paths... so its completely unsuitable for sharing with another developer via git.

What is the best approach for constructing a project with multiple builds that I can share with other collaborators?   Should I edit the generated file and replace the absolute paths ?

After I change CMakeCache.txt is there a step to regenerate things?

Parents Reply Children
  • Please also help me with this additional question..

    What is the best approach for constructing a project with multiple builds that I can share with other collaborators?   Should I edit the generated file and replace the absolute paths ?

    Which files would I add to git and how do I make it not have absolute paths that would break if not installed in the exact same location?

  • Also the build type approach forces me to maintain multiple copies of prj.conf and child_image/mcuboot.conf. 

    The mulitple prj_<buildtype>.conf is easier to deal with, I can move all of the common settings into a top level overlay_common.conf  .

    Unfortunately, the child_image/mcuboot.conf must be duplicated for every build type, so this really makes maintaining multiple builds difficult.   It really seems there is no way to achieve an overlay behavior  for child image while keeping other files common.

  • Anthony Ambuehl said:
    What is the best approach for constructing a project with multiple builds that I can share with other collaborators?   Should I edit the generated file and replace the absolute paths ?

    There are some recommended method described in this page:
    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/developing/adding_code.html.

    For your case where the build configuration is important, I think the methods are best combined with the build type feature. This is where I address your next concern:

    Anthony Ambuehl said:

    Also the build type approach forces me to maintain multiple copies of prj.conf and child_image/mcuboot.conf. 

    The mulitple prj_<buildtype>.conf is easier to deal with, I can move all of the common settings into a top level overlay_common.conf  .

    Please review this documentation that I have previously linked. Having built type .conf files for child images are possible.

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/app_dev/multi_image/index.html#image-specific-variables

    Those methods are not really designed to keep build configuration folders around though. They are designed to work with build types. Please see if you can adopt this approach.


    If you must keep build configurations in your git project, below I can share how I personally do it for my non-version-control backup.

    I use the VS Code Extension in my work, and what I observe is that there are two options to reduce the size of the build folder.

    1. The first one is recreating it, and stop at the generating step, not build.
    2. The second is to run west build -t clean.

    I have seen that the recreating is significantly smaller with significantly fewer file. So, I often try to go with this.

  • Based on your feedback, I have taken the approach of putting a build script into the folder which calls west with appropriate parameters to generate the build folder. 

    I have also found in certain cases it helps to add child image overlays into the CMakeLists.txt for example

    SET(hci_rpmsg_OVERLAY_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/overlay_hci_rpmsg.conf")

Related