FAQ & Tips

Collection of FAQ and tips.

Running DTSh

Failed to open devicetree, lacks bindings

DTSh will most often rely on the CMake cache content to retrieve the bindings search path:

build/
├── CMakeCache.txt
└── zephyr/
    └── zephyr.dts

When DTSh can’t find this cache file, and ZEPHYR_BASE is not set, the devicetree model initialization will fail:

$ dtsh foobar.dts
Failed to initialize devicetree:
DTS error: interrupt controller <Node /soc/interrupt-controller@e000e100 in '/path/to/foobar.dts'> for <Node /soc/clock@40000000 in '/path/to/foobar.dts'> lacks binding

Tip

Setting ZEPHYR_BASE will likely fix the initialization error:

$ export ZEPHYR_BASE=/path/to/zephyr
$ dtsh /path/to/foobar.dts

For more complex use cases, refer to Other Uses in the Getting Started Guide.

User interface

I’d prefer the traditional $ prompt

The default prompt is based on a Unicode symbol (U+276D):

  • it may not render properly

  • you may prefer a more traditional shell prompt like $

Tip

Create a user preferences file (see User Preferences), and change the prompt string to your convenience:

# Traditional user prompt: "$ ",
# using $$ to escape the dollar sign:
prompt.wchar = $$

# Or to prevent confusion with the OS shell prompt,
# e.g. "(dtsh)$ ":
prompt.wchar = (dtsh)$$

See also the other preferences that configure the prompt.

I’d prefer something a little more sober

DTSh use themes to consistently represent the different types of information: e.g. by default compatible strings are always green, and things that behave like symbolic links (e.g. aliases) are all italics

However, the default colors and styles:

  • are heavily subjective, and may not be to your linking

  • may not play well with desktop or terminal theme

  • you can end up finding these garish colors tiring (we do)

Tip

The /etc/preferences and /etc/themes directories contain sober preferences and theme files.

$ dtsh --preferences etc/preferences/sober.ini --theme etc/themes/sober.ini
Something a little more sober

Something a little more sober

Command output redirection

Mismatched HTML backgrounds

Default styles are intended for reading the commands output on the terminal, and my not play well when redirecting to HTML, e.g. producing disturbing mix of backgrounds:

Default HTML rendering

pref.html.theme

html (light background)

pref.yaml.theme

monokai (dark background)

pref.dts.theme

monokai (dark background)

Mismatched HTML backgrounds

Mismatched HTML backgrounds

Tip

Create a user preferences file (see User Preferences), and try to adjust involved themes to get a better backgrounds match, e.g. for an HTML file with light CSS styles:

pref.html.theme = html
pref.yaml.theme = bw
pref.dts.theme = bw

The /etc/preferences directory contains example preference files.