Device tree files
A device tree is a hierarchical data structure primarily used to describe hardware.
CLion recognizes .dts/.dtsi files and provides them with сode assistance and code analysis features.
If you are working with Zephyr, make sure to select the board you are using in the settings:
Go to Settings | Languages & Frameworks | Devicetree.
Use one of the options:
Derive Zephyr settings from CMake
The Sync with CMake option is enabled by default. Note that the
find_package(Zephyr)
command is required to fetch the board name.Specify the Zephyr installation path and select the board
Clear the Sync with CMake checkbox. Provide the path to Zephyr installation if it was not detected automatically and select the board from the list:
tip
Learn more about device trees in Zephyr.
Find below a few examples of coding assistance features available for the device tree files.
Syntax highlighting and code formatting:
tip
You can configure the color scheme in Settings | Editor | Color Scheme | Devicetree and code style in Settings | Editor | Code Style | Devicetree.
Code folding for nodes:
tip
Press CtrlShiftNumPad - to collapse and CtrlShiftNumPad + to expand all code fragments.
Refer to Code folding for more information.
Quick documentation for the device tree elements:
tip
When showing documentation, CLion loads additional information from Zephyr bindings.
By default, quick doc is displayed on mouse hover. Refer to Quick documentation for instructions on how to change this, as well as general information about this feature.
Structure view for the device tree files:
To open the Structure view, go to View | Tool Windows | Structure in the main menu or press Alt07.
Code completion for standard properties,
/commands/
, labels, and code elements:A line marker to indicate overwritten properties. You can also use it to navigate to the original property:
Automatic insertion of missing semicolons, matching braces, and quotation marks while you type.
CLion provides a set of checks for your device tree code.
You can explore and adjust the list of inspections in Settings | Editor | Inspections:
For example, CLion validates the names in your code:
Thanks for your feedback!