msperl
Posts: 344
Joined: Thu Sep 20, 2012 3:40 pm

newer version of dtc that allows for 4.2 style #include

Thu Jul 09, 2015 4:06 am

Hi!

Seems as if the upstream 4.2-rc kernels start to use "#include" instead of "/include/" in their device tree definitions.
See: https://github.com/torvalds/linux/blob/ ... b-plus.dts

These are neither supported in dtc 1.3 nor 1.4 - kernel 4.2 seems to ship with 1.4.1 (but without -@ support)

Any ideas if there is a newer version available which supports all the features?
I am have used https://raw.githubusercontent.com/Rober ... kgs/dtc.sh

Thanks, Martin

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2223
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: newer version of dtc that allows for 4.2 style #include

Thu Jul 09, 2015 8:13 am

The version of DTC has been updated, as you say, but the support for #include is provided by CPP courtesy of the makefile:
https://github.com/torvalds/linux/blob/ ... e.lib#L286

It looks as though this has been in there for a while, but they are making use of it now to get symbolic names for the pin functions. This commit (https://github.com/torvalds/linux/commi ... c4c65f1586) causes CPP to pull in definitions from this file (https://github.com/torvalds/linux/blob/ ... /bcm2835.h), allowing you to write things like this:

Code: Select all

    alt3: alt3 {
        brcm,pins = <48 49 50 51 52 53>;
        brcm,function = <BCM2835_FSEL_ALT3>;
    };		

msperl
Posts: 344
Joined: Thu Sep 20, 2012 3:40 pm

Re: newer version of dtc that allows for 4.2 style #include

Fri Jul 10, 2015 1:28 am

That is all right on its own, but if you want to compile a dt-overlay outside of the kernel, then you will start to have an issue eventually.

The foundation still can use their own dts that does not make use of that, but it may become an issue in the future...

So maybe you should put a warning somewhere about that in the device-tree page commenting on that.

Also it may become of interest to start shipping those include/dt-bindings with your kernels as well, as they may make things simpler.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2223
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: newer version of dtc that allows for 4.2 style #include

Fri Jul 10, 2015 8:04 am

Don't you think that
That is all right on its own, but if you want to compile a dt-overlay outside of the kernel, then you will start to have an issue eventually.
and
Also it may become of interest to start shipping those include/dt-bindings with your kernels as well, as they may make things simpler.
are somewhat contradictory?

I don't think that the ability to write "<BCM28035_FSEL_ALT5>" instead of "<2> /* Alt 5 */" is a large enough benefit to justify the pain for people working outside the kernel tree, but I reserve the right to change my opinion.

Return to “Device Tree”