# Device tree compiler in base: is it ready to use?



## aragats (Dec 13, 2018)

I didn't know that FreeBSD 12.0 has device tree compiler in the base.
However, it segfaults on regular .dts files I build for embedded systems.
The one I always used before is sysutils/dtc, and it still works fine when installed and called explicitly.
Previously I reported the issue in this thread. 
Maybe somebody can provide more info on this, or should I just file a bug report?
Thanks!


----------



## obsigna (Dec 13, 2018)

I maintain a FreeBSD CURRENT installation on my BeagleBone Black - for the most time it was on 12 CURRENT, now it is on 13 CURRENT. I wrote DT overlay files in order to enable the ADC, I2C and PRU devices on the BBB. I just checked it, and the dtc(1) in the base system of my freshly upgraded FreeBSD 12.0-RELEASE r341666 GENERIC amd64 system does compile the .dtso files for my BBB fine.

I know there are major differences in the DT between 11 and 12, and perhaps your .dts files are destined to FreeBSD 11 and contain some syntax which the new compiler does not understand anymore. Anyhow, it should show a meaningful error message instead of crashing. I guess, simply for this reason, it would be good to file a bug report. You might want to attach the .dts file which provokes the crash.


----------



## aragats (Dec 14, 2018)

There are no many overlays in the svn now...
So, I compared the source files and found the syntax is slightly different now, and you're right, I should file a bug report, it makes no sense to crash because of "bad" syntax.
That syntax was perfectly handled by dtc in 11.x.

That brings another question: is the "new" syntax is something widely accepted, or we want to have it specific to FreeBSD? The latter makes no sense to me, the device tree description is a *description* of hardware, why should it be OS specific?


----------



## obsigna (Dec 14, 2018)

aragats said:


> There are no many overlays in the svn now...



That’s because the FreeBSD developers switched to the same DTS upstream sources which Linux uses. And the location in our source tree changed. to here: https://svnweb.freebsd.org/base/head/sys/gnu/dts/



aragats said:


> So, I compared the source files and found the syntax is slightly different now, and you're right, I should file a bug report, it makes no sense to crash because of "bad" syntax.
> That syntax was perfectly handled by dtc in 11.x.
> 
> That brings another question: is the "new" syntax is something widely accepted, or we want to have it specific to FreeBSD? The latter makes no sense to me, the device tree description is a *description* of hardware, why should it be OS specific?



AFAIK, the FreeBSDS 12.0 dts syntax should be very similar to the Linux syntax. I guess, the idea was to make life more easier for the developers (no need to invent every single wheel again), and the users, who would experience a better milage with Linux tutorials used for FreeBSD.


----------



## aragats (Dec 14, 2018)

obsigna said:


> And the location in our source tree changed. to here: https://svnweb.freebsd.org/base/head/sys/gnu/dts/


Thanks!



obsigna said:


> the idea was to make life more easier for the developers (no need to invent every single wheel again)


Yeah, that what I thought!
I guess, you know this good collection of BBB overlays by Robert Nelson. Now I can build them only with sysutils/dtc.


----------

