How to create devicetree files - nRF Connect for VS Code
Skip to content

How to create devicetree files

Devicetree source files, which include *.dts, *.dtsi, and *.overlay files, are used by Zephyr and the nRF Connect SDK to describe hardware, provide hardware initial configuration, and modify the hardware-related configuration of an application.

Important

Make sure you edit a .dts or an .overlay file that you created. Directly editing .dts or .overlay files that come with the nRF Connect SDK installation may have unintended consequences to other boards or to applications that use the same board.

Complete the following steps to create an overlay file:

  1. In the application's Details View, click on the Config files to expand the directory.
    A line saying "No overlay files. Click to create one" appears.

  2. Click on Click to create one.

    Create an overlay file

    When the creation process is complete, a notification appears in the bottom right corner of the screen asking you whether to run a pristine build.

  3. Click the Run Pristine Build button in the notification or press Ctrl-Shift-Alt-B.
    When creating or removing an overlay file, a pristine build must be run for CMake to include the overlay file in the configuration. For more information about how pristine builds work in the nRF Connect SDK, see the Actions View page in the UI reference.

The .overlay file appears in the Devicetree directory under the application's Config files in the Details View and is selected as the devicetree context file in the Devicetree View, as in the following example.

Overlay file in the Sidebar views

With the overlay file created, it is automatically added to your current configuration and you can start editing it. Use one of the following methods: