dts with #include ".dtsi" will not compile

6,919 views
Skip to first unread message

Nic Cyn

unread,
Oct 10, 2014, 12:41:48 PM10/10/14
to beagl...@googlegroups.com
Hi All

I have a flat dts file taken from the dtb file and it will re-compile just fine with a command like

dtc -I dts -O dtb bb.dts > test.dtb

however if I edit the bb.dts file to use an include line like

#include "foo.dtsi"

I get an error "FATAL ERROR: Unable to parse input tree". This happens no matter where I put the include line or whatever is in the .dtsi file (including only comments). The dtc version is Version: DTC 1.4.0-gf345d9e4

My understanding is that this include should work. Is there a special version of dtc for this or something else I am missing?
Message has been deleted

Nic Cyn

unread,
Oct 14, 2014, 11:40:34 AM10/14/14
to beagl...@googlegroups.com
Bump

I am still struggling with this. If you can compile a dts file with a #include tag (for example the 3.14 kernel dts files) can you please tell me the dtc compiler version you are using (dtc -version) and the command line that works.

All I ever get is a "FATAL ERROR: Unable to parse input tree" error and I am really struggling with this.

Your assistance is much appreciated.

Robert Nelson

unread,
Oct 14, 2014, 11:46:26 AM10/14/14
to Beagle Board
On Tue, Oct 14, 2014 at 10:40 AM, Nic Cyn <ofits...@gmail.com> wrote:
> Bump
>
> I am still struggling with this. If you can compile a dts file with a
> #include tag (for example the 3.14 kernel dts files) can you please tell me
> the dtc compiler version you are using (dtc -version) and the command line
> that works.
>
> All I ever get is a "FATAL ERROR: Unable to parse input tree" error and I am
> really struggling with this.
>
> Your assistance is much appreciated.

DTC src/arm/am335x-boneblack-base.dtb
DTC src/arm/am335x-bone-4dcape-70t.dtb
DTC src/arm/am437x-gp-evm.dtb
DTC src/arm/am335x-bone-lcd7-01-00a3.dtb
DTC src/arm/am335x-bone-can1.dtb
DTC src/arm/am335x-bone-lcd4-01-00a1.dtb
DTC src/arm/omap3-overo-storm-tobi.dtb
DTC src/arm/am437x-sk-evm.dtb
DTC src/arm/am335x-boneblack-audio-reva.dtb
DTC src/arm/am335x-boneblack-ttyO2.dtb
DTC src/arm/am335x-bone-audio-revb.dtb
DTC src/arm/dra72-evm.dtb
DTC src/arm/omap3-evm.dtb
DTC src/arm/am335x-boneblack-rtc-01-00a1.dtb
DTC src/arm/am3517-evm.dtb
DTC src/arm/omap4-panda-es.dtb
DTC src/arm/am335x-boneblack-bbb-exp-c.dtb
DTC src/arm/dra7-evm.dtb
voodoo@hades:/opt/github/dtb-rebuilder$ cat
src/arm/am335x-boneblack-base.dts | grep include
#include "am33xx.dtsi"
#include "am335x-bone-common.dtsi"
#include "am335x-bone-common-pinmux.dtsi"
#include "am335x-boneblack-emmc.dtsi"
#include "am335x-boneblack-nxp-hdmi-audio.dtsi"
voodoo@hades:/opt/github/dtb-rebuilder$ dtc --version
Version: DTC 1.4.0-gf345d9e4

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

Nic Cyn

unread,
Oct 14, 2014, 12:10:21 PM10/14/14
to beagl...@googlegroups.com
Thank you.

My dtc compiler version is exactly the same - not surprising since I am using your version installed as described on https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-Upgradedistro%22device-tree-compiler%22package

So it must be the command line. What is in the DTC script. Can you please "cat DTC" for me.

No doubt I am missing something simple.

Much appreciated.

Robert Nelson

unread,
Oct 14, 2014, 12:23:00 PM10/14/14
to Beagle Board
On Tue, Oct 14, 2014 at 11:10 AM, Nic Cyn <ofits...@gmail.com> wrote:
> Thank you.
>
> My dtc compiler version is exactly the same - not surprising since I am
> using your version installed as described on
> https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-Upgradedistro%22device-tree-compiler%22package
>
> So it must be the command line. What is in the DTC script. Can you please
> "cat DTC" for me.
>
> No doubt I am missing something simple.

https://github.com/RobertCNelson/dtb-rebuilder/tree/3.14-ti

https://github.com/RobertCNelson/dtb-rebuilder/blob/3.14-ti/Makefile#L120

Nic Cyn

unread,
Oct 15, 2014, 7:35:54 AM10/15/14
to beagl...@googlegroups.com
Thanks. I think I now have a pretty good idea on what happens when a device tree .dts file with .dtsi includes is compiled. I am posting a summary here so others (if any) searching on this error message may find it.

The Makefile is basically running three commands - not one. To compile the dts file src/arm/am335x-boneblack.dts the following commands are generated:

cpp -Wp,-MD,src/arm/.am335x-boneblack.dtb.d.pre.tmp -nostdinc -Iinclude -Isrc/arm -Itestcase-data -undef -D__DTS__ -x assembler-with-cpp -o src/arm/.am335x-boneblack.dtb.dts.tmp src/arm/am335x-boneblack.dts ;

dtc
-O dtb -o src/arm/am335x-boneblack.dtb -b 0 -i src/arm  -d src/arm/.am335x-boneblack.dtb.d.dtc.tmp src/arm/.am335x-boneblack.dtb.dts.tmp ;

cat src
/arm/.am335x-boneblack.dtb.d.pre.tmp src/arm/.am335x-boneblack.dtb.d.dtc.tmp > src/arm/.am335x-boneblack.dtb.d


It seems the device tree compiler has no native ability to cope with includes and so cpp is pressed into service to resolve the chains of included .dtsi files. The upshot is that the first command (cpp...) ultimately outputs a file named src/arm/.am335x-boneblack.dtb.dts.tmp which is essentially the original src/arm/am335x-boneblack.dts with all the includes recursively resolved. It also outputs a dependency file.

The second line calls dtc on the now flattened .dts source in src/arm/.am335x-boneblack.dtb.dts.tmp file and creates the src/arm/am335x-boneblack.dtb  device tree binary and another dependency file. The third line concatenates the dependency files from the first two steps - why it does this I do not know. Maybe just documentation. There is also a .am335x-bone-base.dtb.cmd file output by the makefile which contains the above commands and some of the dependencies.
Reply all
Reply to author
Forward
0 new messages