Xilinx / meta-xilinx-tools

Yocto Project layer enables AMD Xilinx tools related metadata for MicroBlaze, Zynq, ZynqMP and Versal devices.
MIT License
53 stars 51 forks source link

PetaLinux 2018.3: device tree build for Ultra96 fails #12

Closed matejk closed 5 years ago

matejk commented 5 years ago

As described in Xilinx forums device tree build for board Avnet Ultra96 fails with the following error:

| Error: /opt/devel/git/1ghz-8bit-1gddr/petalinux-2018.3-ultra96/build/../components/plnx_workspace/device-tree/device-tree/mipi-support-ultra96.dtsi:9.1-17 Label or path axi_uart16550_0 not found
| Error: /opt/devel/git/1ghz-8bit-1gddr/petalinux-2018.3-ultra96/build/../components/plnx_workspace/device-tree/device-tree/mipi-support-ultra96.dtsi:121.2-10 Label or path i2csw_2 not found
| FATAL ERROR: Syntax error parsing input tree

After some investigation I discovered a difference between device tree files in /components/../device-tree from 2018.2 and 2018.3.

In 2018.2, system-top.dts is:

/dts-v1/;
/include/ "zynqmp.dtsi"
/include/ "zynqmp-clk-ccf.dtsi"
/include/ "zcu100-revc.dtsi"
/include/ "pl.dtsi"
/include/ "pcw.dtsi"
/ {
    chosen {
        bootargs = "earlycon clk_ignore_unused";
        stdout-path = "serial0:115200n8";
    };
    aliases {
        i2c0 = &i2c0;
        i2c1 = &i2c1;
        serial0 = &uart1;
        serial1 = &uart0;
        spi0 = &spi0;
        spi1 = &spi1;
    };
    memory {
        device_type = "memory";
        reg = <0x0 0x0 0x0 0x7ff00000>;
    };
};
#include "system-user.dtsi"

In 2018.3 the file is different:

/dts-v1/;
#include "zynqmp.dtsi"
#include "zynqmp-clk-ccf.dtsi"
#include "pl.dtsi"
#include "pcw.dtsi"
/ {
    chosen {
        bootargs = "earlycon clk_ignore_unused";
        stdout-path = "serial0:115200n8";
    };
    aliases {
        i2c0 = &i2c0;
        i2c1 = &i2c1;
        serial0 = &uart1;
        serial1 = &uart0;
        spi0 = &spi0;
        spi1 = &spi1;
    };
    memory {
        device_type = "memory";
        reg = <0x0 0x0 0x0 0x7ff00000>;
    };
};
/include/ "mipi-support-ultra96.dtsi"
#include "system-user.dtsi"

In PL 2018.3 zcu100-revc.dtsi was replaced with avnet-ultra96-rev1.dtsi, however the new file is not included in system-top.dts and is not present in components/.../device-tree/.

After I manually edited system-top.dtsi to include avnet-ultra96-rev1.dtsi compilation of device tree succeeded.

I seems that new platform file is skipped while preparing system-top.dts for board ultra96.

mharth commented 5 years ago

https://github.com/Xilinx/meta-xilinx-tools/blob/rel-v2018.3/recipes-bsp/device-tree/device-tree.bbappend#L35

This line is supposed to enable the required #include "avnet-ultra96-rev1.dtsi" Are you missing the above bbappend?

matejk commented 5 years ago

The bbappend file in PetaLinux 2018.3 that I have on my computer is exactly the same as the one on the link.

As you can see, the part that includes "mipi-support-ultra96.dtsi" is present in generated system-top.dts.

There has to to be something different in the bitbake recipes compared to 2018.2 that causes the include to be skipped.

mharth commented 5 years ago

You are building for ultra96-zynqmp machine? because the line suggested adds the include in system-top.dts from DTG. This works as we have seen? Can you provide the steps to replicate your issue

matejk commented 5 years ago

Yes, I am building for ultra96-zynqmp. When I compared the recipes between 2018.2 and 2018.3 I also expected the include in system-top.dts.

I'll provide steps ASAP.

Are there some logs that are particularly interesting for investigation?

matejk commented 5 years ago

Create new project:

petalinux-create -t project -n ultra96-2018.3 --template zynqMP

Import HDF (custom made by my colleague).

cd ultra96-2018.3/
petalinux-config 
petalinux-config --get-hw-description ../staging/ultra96/

The only parameter that was changed in configuration is:

CONFIG_YOCTO_MACHINE_NAME="ultra96-zynqmp"

Kernel config: no changes, use defaults:

petalinux-config -c kernel

Rootfs config: no changes, use defaults:

petalinux-config -c rootfs

Then build:

petalinux-build 
matejk commented 5 years ago

Build fails with the error above.

Complete project spec after build: ultra96-project-spec.zip

Project's components directory: ultra96-components.zip

Device tree build files (excluding recipe-sysroot-native) from build/tmp/work/ultra96_zynqmp-xilinx-linux:

ultra96-device-tree-build.zip

matejk commented 5 years ago

If I manually edit system-top.dts to add missing include, build still fails with less errors:

Log data follows:
| DEBUG: Executing shell function do_compile
| Error: /opt/devel/git/1ghz-8bit-1gddr/petalinux-2018.3-ultra96/build/../components/plnx_workspace/device-tree/device-tree/mipi-support-ultra96.dtsi:9.1-17 Label or path axi_uart16550_0 not found
| FATAL ERROR: Syntax error parsing input tree
matejk commented 5 years ago

As a workaround I wanted to include avnet-ultra96-rev1.dtsi with /include/in system-user-dtsi but it did not work.

matejk commented 5 years ago

Does configuration for Ultra96 require some specific Xilinx FPGA cores to resolve the symbol axi_uart16550_0?

matejk commented 5 years ago

The next thing that I tried was to build with Ultra96 sample HDF.

Build still failed with error:

Log data follows:
| DEBUG: Executing shell function do_compile
| Error: /opt/devel/git/1ghz-8bit-1gddr/ultra96-2018.3/build/../components/plnx_workspace/device-tree/device-tree/mipi-support-ultra96.dtsi:121.2-10 Label or path i2csw_2 not found
| FATAL ERROR: Syntax error parsing input tree
ghost commented 5 years ago

Hello @matejk , The petalinux bsp for Ultra96 ships with a HDF that enables mipi video pipeline within the design.To support this pipeline in the device-tree, mipi-support-ultra96.dtsi overrides some of the DTG generated pl dt nodes and replaces it with the ones contained in that file. The mipi-support-ultra96.dtsi also looks for camera node under i2c-2. I see that you are trying to use your own custom HDF file. When you build with your design, the mipi-support-ultra96.dtsi is unable to find the camera node under i2c-2 because its not part of your design. Thats why you are seeing this error: _

Label or path i2csw_2 not found Label or path axi_uart16550_0 not found

To build with your custom HDF, do not include the mipi-support-ultra96.dtsi file in the final dts. You can disable it by including the following in your local.conf file: MACHINE_FEATURES_remove = "mipi"

Let me know if that works.

Thanks, Chandana

matejk commented 5 years ago

Hi @ckalluri ,

Yes, I tried that already. Build passes then, however it is not correct.

File avnet-ultra96-rev1.dtsi is not included and that file contains crucial settings to be able to boot properly from the SD card, for example.

As you can see above, file zcu100-revc.dtsi was included in PL 2018.2 and that file contains those device tree entries.

FredKellerman commented 5 years ago

Hi, Please see https://github.com/Avnet/Ultra96-PYNQ

Toward the bottom (of README.md) you will see a documented work around for the issue of the bsp requiring a certain MIPI PL hardware design. Basically you unset the mipi "feature" and then you can import your own hw design.

All of the proper BSP string/feature settings are also shown there.

matejk commented 5 years ago

Hi @ckalluri and @FredKellerman,

Information from both of you helped me to resolve the problem. Thank you.

I am closing the issue.