Differnt buold configurations

Hi!

We would like to build two different sw variants from same source code and mostly the same config options, probably only needing a single "define"-difference in code.

I can't find any relevant information on how to setup a project for this kind of scenario.

Came across information regarding different build type-s and using different build configurations, but that would not help to keep all the common options in one single file.
Is there any way to have mutiple prj.conf-like files and merge them? Or "include-like" functionality for the .conf files?

BR,
Mårten

Parents
  • Hi,

    You can create multiple software variants by generating a new build with a different folder name. The default name chosen when using either the command line with "west build -b <board>" or with the VSCode extension is "build". So depending on if you're working with command line or if you're working with the VSCode extension on nRF Connect SDK you can do one of the following:

    In command line you can create multiple build configurations with "west build -b <board_type> -d <build_folder_name", for instance "west build -b nrf52840dk_nrf52840 -d build_1", which will create a new build configuration. Remember to also select which build configuration you want to flash with "west flash -d build_1" if you want to flash the non-default build configuration.

    In the VSCode extension, you can press "Add build configuration" under your project after you've done the modifications you wanted to do.

    This will open the build configuration page where you can create a new build. Select a different name than "build", press "Build Configuration" and see the new build show up under your applications-list in the extension:

    A third option is of course to create a copy of your project and keep the two software variations separated by folders to make it easier to see and remember the changes between the projects.

    Kind regards,
    Andreas

  • Hi!

    Thanks for the answer, but how would I then go about to have basically one setting be different between the two build configurations and all the rest in a common file?

    BR,
    Mårten

Reply Children
Related