Jump to content

Compile Device Tree Overlay


kampi
Go to solution Solved by kampi,

Recommended Posts

Hi,

 

I use kernel version 4.19.62-sunxi on my Orange Pi One and I want compile the following devide tree overlay:

 

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

	fragment@0 {
		target = <&pio>;
		__overlay__ {
			gpio_button_0: gpio_button_0 {
				pins = "PA20";
				function = "gpio_in";
				bias-pull-up;
			};
		};
	};

	fragment@1 {
		target-path = "/";
		__overlay__ {
			gpio-keys-user {
				compatible = "gpio-keys";
				pinctrl-names = "default";
				pinctrl-0 = <&gpio_button_0>;

				power_button {
					label = "GPIO Key Power";
					linux,code = <KEY_POWER>;
					gpios = <&pio 0 20 GPIO_ACTIVE_LOW>;
				};
			};
		};
	};
};

 

dtc -I dts -O dtb -o overlay-user/test.dtbo overlay-user/gpio-poweroff.dts

 

But the DTC outputs the following error:

 

Error: overlay-user/gpio-poweroff.dts:2.2-8 syntax error
FATAL ERROR: Unable to parse input tree

 

What is wrong with this overlay?

Link to comment
Share on other sites

linux,code = <KEY_POWER>;
gpios = <&pio 0 20 GPIO_ACTIVE_LOW>;

 

These two lines. When compiling outside of the kernel source, constants like GPIO_ACTIVE_LOW don't get resolved because they don't have the kernel headers included in the compilation path.

 

If you have the linux kernel sources downloaded, a simple grep will tell you what they're supposed to be.

 

tparys@wander:linux/include/dt-bindings$ grep -r GPIO_ACTIVE_LOW .
./gpio/gpio.h:#define GPIO_ACTIVE_LOW 1

 

I'd also check that KEY_POWER is correct. That's not part of the 5.10 mainline, as far as I see.

 

In the future, just comment out parts of your dtc overlay until it compiles, and add parts back in until it breaks. Should narrow your problems down pretty quick.

Link to comment
Share on other sites

Hi,

 

sorry, but this doesn´t solve the problem. I reduce the overlay to 

 

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

	fragment@0 {
		target = <&pio>;
		__overlay__ {
			gpio_button_0: gpio_button_0 {
				pins = "PA20";
				function = "gpio_in";
				bias-pull-up;
			};
		};
	};
};

 

and I still have the same problem.

Link to comment
Share on other sites

I can compile the fragment on my Raspberry Pi with DT 1.4.7, so there is definitely an issue with the version. How can I update the DTC on my OrangePi? Using apt doesn´t work, because I have the current version already.

Link to comment
Share on other sites

vor 2 Stunden schrieb tparys:

1.5.1-1 is current as of Ubuntu Focal. Perhaps a version difference in Debian, or an outdated install?

 

The output of "armbianmonitor -u" might help.

mmh the command doesn´t output an URL.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines