prj.conf overlay file for each build configuration?

Hello,

Is it possible to create an overlay file for prj.conf for each build configuration? I see that each build config can optionally have its own separate config file, but is it possible to have a base file that then gets overlaid with only the settings that are different per-board?

My initial use case is to enable UART logging on the dev kit but switch automatically to RTT on our production hardware during dev.

Going forward it will also be useful as we will be supporting a number of different products with this codebase.

Thank you.

  • Hi,

    Yes, you can add configuration overlay files using OVERLAY_CONFIG. In VS Code you add the overlay file by adding -DOVERLAY_CONFIG=my_overlay_file.conf in the "Extra CMake arguments" field, or you can add it to the build command if you build on command line:

    west build -b nrf52840dk_nrf52833 -- -DOVERLAY_CONFIG=my_overlay_file.conf

    If you want to create overlay files for specific boards then you can create a boards directory in your project directory and name the overlay file <board_name>.conf, for example nrf52840dk_nrf52840.conf. With this, the overlay file will automatically be added to the project without having to specify OVERLAY_CONFIG, as long as the name before .conf is exactly the same as the board name.

    Best regards.

    Marte

Related