Enabling FPGA manager causes device tree related compilation error in Petalinux 2023.2 targeting Versal arch

377 views Asked by At

The compilation of my PetaLinux image with 2023.2 version of the tool is crashing at the compilation of the device tree when trying to enable the FPGA Manager for a Versal target.

I am currently updating one of my design from a ZynqMP architecture (SOM K26 on carrier board KR260) to Versal architecture (VPK120 evaluation board). The software stack of the initial design was either the Canonical Ubuntu and Petalinux and used the xmutil wrapper to load the bitstream and device tree overlay.

The interactions with the PS consist mostly in an AXI Lite and AXI DMA through the dma_proxy driver. To the best of my knowdledge from Reference guide(UG1144) and Versal Segmented Configuration Flow, what I want to use the dfx_dtg_versal_full configuration to both program with the PDI and load device tree overlay.

So I added the app (where pl-custom.dtsi is the dma_proxy driver node) with the command below with a project created from the bsp:

petalinux-create -t apps --template dfx_dtg_versal_full -n myplapp --enable --srcuri "../myplapp.xsa ../pl-custom.dtsi"

When building the project the following notes and warning appear:

INFO: Creating dfx_dtg_versal_full template apps required FPGA Manager to be enabled in petalinux-config

WARNING: myplapp-1.0-r0 do_configure: Using fpgamanager_base.bbclass requires fpga-overlay MACHINE_FEATURE to be enabled

So both messages implies to enable the FPGA manager in petalinux-config but this configuration causes the build to crash when compiling the device tree with the following logs.

NOTE: Executing Tasks
ERROR: device-tree-xilinx-v2023.2+gitAUTOINC+1a5881d004-r0 do_compile: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:devicetree_do_compile(d)
     0003:
File: '/home/ubuntu/sandbox/vpk120-plinux/components/yocto/layers/poky/meta/classes-recipe/devicetree.bbclass', lineno: 137, function: devicetree_do_compile
     0133:            if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)):
     0134:                continue # skip non-.dts files and non-overlay files
     0135:        except:
     0136:            continue # skip if can't determine if overlay
 *** 0137:        devicetree_compile(dtspath, includes, d)
     0138:}
     0139:
     0140:devicetree_do_install() {
     0141:    for DTB_FILE in `ls *.dtb *.dtbo`; do
File: '/home/ubuntu/sandbox/vpk120-plinux/components/yocto/layers/poky/meta/classes-recipe/devicetree.bbclass', lineno: 125, function: devicetree_compile
     0121:        dtcargs += ["-i", i]
     0122:    dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")]
     0123:    dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)]
     0124:    bb.note("Running {0}".format(" ".join(dtcargs)))
 *** 0125:    subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     0126:
     0127:python devicetree_do_compile() {
     0128:    includes = expand_includes("DT_INCLUDE", d)
     0129:    listpath = d.getVar("DT_FILES_PATH")
File: '/tools/Xilinx/PetaLinux/2023.2/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.10/subprocess.py', lineno: 524, function: run
     0520:            # We don't call process.wait() as .__exit__ does that for us.
     0521:            raise
     0522:        retcode = process.poll()
     0523:        if check and retcode:
 *** 0524:            raise CalledProcessError(retcode, process.args,
     0525:                                     output=stdout, stderr=stderr)
     0526:    return CompletedProcess(process.args, retcode, stdout, stderr)
     0527:
     0528:
Exception: subprocess.CalledProcessError: Command '['dtc', '-@', '-@', '-p', '0', '-@', '-H', 'epapr', '-i', '/home/ubuntu/sandbox/vpk120-plinux/build/tmp/work/xilinx_vpk120-xilinx-linux/device-tree/xilinx-v2023.2+gitAUTOINC+1a5881d004-r0/git/device_tree/data/kernel_dtsi/2023.2/BOARD/', '-i', '/home/ubuntu/sandbox/vpk120-plinux/components/plnx_workspace/device-tree/device-tree', '-i', '/home/ubuntu/sandbox/vpk120-plinux/build/tmp/work/xilinx_vpk120-xilinx-linux/device-tree/xilinx-v2023.2+gitAUTOINC+1a5881d004-r0/git/device_tree/data/kernel_dtsi/2023.2/include/', '-i', '/home/ubuntu/sandbox/vpk120-plinux/build/tmp/work/xilinx_vpk120-xilinx-linux/device-tree/xilinx-v2023.2+gitAUTOINC+1a5881d004-r0', '-o', 'pl.dtbo', '-I', 'dts', '-O', 'dtb', 'pl.dtsi.pp']' returned non-zero exit status 1.

Subprocess output:
Error: /home/ubuntu/sandbox/vpk120-plinux/components/plnx_workspace/device-tree/device-tree/pl.dtsi:9.10-10.1 syntax error
FATAL ERROR: Unable to parse input tree

ERROR: Logfile of failure stored in: /home/ubuntu/sandbox/vpk120-plinux/build/tmp/work/xilinx_vpk120-xilinx-linux/device-tree/xilinx-v2023.2+gitAUTOINC+1a5881d004-r0/temp/log.do_compile.656445
ERROR: Task (/home/ubuntu/sandbox/vpk120-plinux/components/yocto/layers/meta-xilinx/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 10501 tasks of which 10463 didn't need to be rerun and 1 failed.

I tried enabling the Device Tree Overlay in the DTG settings and checked that the device tree overlay support was enabled in the Kernel but the same error keeps happening. I quickly tried with the 2022.2 version of the tools and it also crashes when compiling the device tree.

The device tree file that can't be parsed is the pl.dtsi generated auto generated in the components that contains only

/dts-v1/;
/plugin/;

If I try adding the node for fpga overlay in pl.dtsi manually or any other node so as the file isn't empty, I can get the compilation working. But it doesn't work if I add the node in '''project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi''' nor '''project-spec/decoupling-dtsi/system-user.dtsi'''

    fragment@0 {
        target = <&fpga>;
        __overlay__ {
            #address-cells = <2>;
            #size-cells = <2>;
            firmware-name = "system.pdi";
        };
    };

My knowledge of device tree and the recent versal architecture are rather elementary so as I supposed I'm missing something but I can't find out what from the error logs. I'll try different parameters for the app creation as the error (WARNING: myplapp-1.0-r0 do_install: A xsa doesn't contain PL IP, hence /lib/firmware/xilinx/myplapp/myplapp.dtbo is not needed) appears but I doubt it would fix the issue.

Would anyone know how to solve this issue ?

1

There are 1 answers

1
KRISHNA SHARMA On

if you have a fixed string that doesn't change often, using string is suitable. If you need to perform many operations that involve modifying strings, especially within loops or complex algorithms, then using StringBuilder can be more efficient.