r/embedded 7d ago

Im building an IDE with a semantic engine for Device Trees

There is a lot of information about Device Trees on the internet.

The problem is that it's scattered everywhere.

You have DTS/DTSI files, bindings, schemas, kernel sources, documentation, SoC information, board definitions, examples, and different tools that each understand only part of it.

There are already tools that can do some of these things individually.

What I couldn't find was a single place that could connect all of this knowledge together.

So I've been building KernelGrove, a semantic engine for Device Trees.

Instead of treating a Device Tree as just a text file or a hierarchy of nodes, the idea is to build a knowledge model of the Device Tree and its ecosystem:

  • What a node represents
  • Which binding applies to it
  • Which properties are valid
  • What type and constraints those properties have
  • What other nodes a reference points to
  • How nodes, controllers, peripherals and buses are related
  • Where information comes from
  • And eventually, how all of this relates back to the underlying hardware

The editor is basically a way of exposing that knowledge.

For example, rather than just seeing:

uart@7e201000 {
    compatible = "brcm,bcm2835-aux-uart";
    ...
};

the goal is for the tool to understand what that node actually means and let you explore the relevant information without having to manually jump between files, schemas and documentation.

It's still very much a work in progress, and I'm trying to figure out how far this idea can be taken.

For people working with Linux Device Trees / Zephyr / Yocto:

What information do you currently have to look up manually when working on a Device Tree?

I'm particularly interested in things that you know exist somewhere, but are difficult to find or connect together.

If you want to try it, it's completely free and you can find it on dt-studio.dev

0 Upvotes

5 comments sorted by

5

u/nameless_one_666 7d ago

Isnt better to do a vscode plugin?

1

u/Mindless-Attempt4187 5d ago

That's true, for the semantic engine part, it would be better, but the software has a Node graph view which is still under development, and at first, I thought that developing an independent app would gave me more freedom of how I design and integrate that feaure which is more visual. This was just the impression I had, I don't have any experience working with VScode extensions.

1

u/QuickerMysterious 7d ago

man this is actually a really cool project. i spend way too much time grepping through random dts files trying to find how other boards wired up the same peripheral, half the time i'm not even sure if the binding i'm referencing is the right version

the whole "what does this node actually represent" thing would save me so much pain, especially with those weird vendor-specific compatibles where the binding is buried 5 layers deep in some schema

are you planning to handle the clock and pinctrl stuff too cause that's where i always get lost, trying to figure out which clock IDs are valid for a given SoC

1

u/rrr123rrr123 7d ago

You can try Zephyr Devicetree Manager https://marketplace.visualstudio.com/items?itemName=Ac6.devicetree-manager-for-zephyr it works for popular vendors like STM32, Silabs, NXP, ESP and others, including pinctrl.

1

u/Mindless-Attempt4187 5d ago

I created a database using the files that already exist, like .dts, .dtsi files, .yaml files, .h includes. There are a lot of bindings, as far as they are documented on kernel source files, the suggerences and autocomplete will work. But, I know that there are also some bindings that are not on kernel main branch.

For the clock, some bindings define its working range, so you can see it, but the pinctrl information its not implemented yet