This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[nRF9160] Override DTS File Used for S/NS Build

I have created an out of tree board folder following the same pattern as the Nordic PCA10090 and that is working as expected. What I would like to do now is have 2 versions of my dts. For the purpose of this let's say one would be a debug version where the UART logs are written to the USB port and one is a release version where UART is output to some other pins.

The current structure in the boards folder is:

board_name
└── board_name_common.dts └── board_name_common_debug.dts └── board_name_ns.dts
└── board_name.dts

And according to the Zephyr documentation:

The Zephyr build system begins creation of a devicetree by running the C preprocessor on a file which includes the following:

    The board’s devicetree source file, which by default is the Zephyr file boards/<ARCHITECTURE>/<BOARD>/<BOARD>.dts. (This location can be overridden by setting the DTS_SOURCE CMake variable.)

    Any file or files given by the DTC_OVERLAY_FILE CMake variable.

However, I'm not sure how/if the DTS_SOURCE flag is able to work with the NCS build system since I know there is some renaming of the board throughout the build process to facilitate the building of the two images.

Is this possible? If so, how do I do it?

Related