Beagley-AI Devicetree syntax error

What am I missing, keep getting a syntax error on this:

#include <dt-bindings/gpio/gpio.h>
#include "k3-j722s.dtsi"
#include "k3-am67a-beagley-ai-pinmux.dtsi"
#include "k3-pinctrl.h"

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,am67xx";

    fragment@0 {
        target = <&main_pmx0>;
        __overlay__ {
            pinctrl-names = "default";
            pinctrl-0 = <&hat_40_gpio &hat_38_gpio>;

            hat_40_gpio: pinmux_hat_40_gpio {
                pinctrl-single,pins = <
                    J722S_IOPAD(0x19C, PIN_INPUT_PULLUP, MUX_MODE7) /* (B25) MCASP0_AXR1.GPIO1_9 */
                >;
            };

            hat_38_gpio: pinmux_hat_38_gpio {
                pinctrl-single,pins = <
                    J722S_IOPAD(0x1A0, PIN_INPUT_PULLUP, MUX_MODE7) /* (F23) MCASP0_AXR0.GPIO1_10 */
                >;
            };
        };
    };

    fragment@1 {
        target = <&main_gpio1>;
        __overlay__ {
            pin40 {
                gpios = <&main_gpio1 9 GPIO_ACTIVE_HIGH>;
                line-name = "Pin40";
            };

            pin38 {
                gpios = <&main_gpio1 10 GPIO_ACTIVE_HIGH>;
                line-name = "Pin38";
            };
        };
    };
};

Hi Fox,

Would you mind sharing the syntax error you’re getting?

It’s the bland “syntax error”. They don’t have messages for all the cases. When you are lucky, to get a message it is usually a broken path to the includes.

Had to use brute force to get it to compile, load then actually toggle in userspace. Problem I have now is looks like I applied to the wrong gpiochip. I now have header pins 38,40,36 on gpiochip2 lines 1,2,3. That does not look right at all.

Have found several issues so I will try work around that, I really don’t want to open my mouth too much until I have the signal on the header. Been hoping it was me causing all the problems with bad code and a simple tweak would get it up.

For devicetree syntax errors I have found the best method if to start with a minimal dts and then gradually add bits until you find the error.

For example in your case start with

#include "k3-j722s.dtsi"
#include "k3-am67a-beagley-ai-pinmux.dtsi"
#include "k3-pinctrl.h"

/dts-v1/;
/plugin/;

/ {
};

Make sure you have no errors. Then add the first fragment. If you get an error remove the stuff inside the fragment and put it back 1 line at a time until you get the error. Repeat for the second fragment.

1 Like

Yes, that is the best way.
I do have a trivial example running however it is just trivial. My problem is compounded by another issue.
Created a cmake file to use cpp then dtc and intergrate that into CLion, when starting out it was assumed the am67x stuff was 100% functional and my cmake was breaking it. Have cmake running cli, next it will be integated into CLion after I get a handle on the am67x dtbo.