This is not a well-written article. It is a log of the errors I met. Documented in the hope that someone may find it helpful afterward.
Problem 1: Device tree does not compile, @cpu0 and @cpu1 not defined
Exception: subprocess.CalledProcessError: Command '['dtc', '-@', '-p', '0x1000', '-@', '-i', '/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2022.2+gitAUTOINC+24d29888d0-r0', '-i', '/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work-shared/zynq-generic/kernel-source/scripts/dtc/include-prefixes', '-i', '/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work-shared/zynq-generic/kernel-source/arch/arm/boot/dts', '-i', '/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree', '-i', '/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2022.2+gitAUTOINC+24d29888d0-r0/git/device_tree/data/kernel_dtsi/2022.2/BOARD/', '-o', 'system-top.dtb', '-I', 'dts', '-O', 'dtb', 'system-top.dts.pp']' returned non-zero exit status 2. Subprocess output: /home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree/zynq-7000.dtsi:536.16-549.5: ERROR (phandle_references): /axi/ptm@f889c000: Reference to non-existent node or label "cpu0" /home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree/zynq-7000.dtsi:551.16-564.5: ERROR (phandle_references): /axi/ptm@f889d000: Reference to non-existent node or label "cpu1" ERROR: Input tree has errors, aborting (use -f to force output)
The error seems to indicate that cpu0
and cpu1
are not found in the device tree. But in fact, they are defined right at the beginning of zynq-7000.dtsi
. This file is autogenerated, so any edits to that file will be overwritten when compiling.
For some reason, system-top.dts
included these lines:
cpus {
/delete-node/ cpu@0 ;
/delete-node/ cpu@1 ;
};
ANSIAnd they were probably causing the CPU node to be removed. I'm not sure why they need to be removed. This file is also auto-generated, and edits to it will not be preserved.
Since the component being affected is the debugger, and we may not need the debugger, we may remove the debugger in system-user.dtsi
. This is certainly not a good solution! It may cause other problems in the future.
/include/ "system-conf.dtsi"
/ {
aliases {
/delete-property/ funnel0_in_port0;
/delete-property/ funnel0_in_port1;
};
};
&amba{
/delete-node/ ptm@f889c000;
/delete-node/ ptm@f889d000;
};
&funnel0_in_port0{
/delete-property/ remote-endpoint;
};
&funnel0_in_port1{
/delete-property/ remote-endpoint;
};
ANSIUpdate: The root cause of this problem is that I included both the Zynq processing system and an ARM core IP in the top-level hierarchy, probably confusing the toolkit. Removing the ARM core solved this issue, but if my application requires an ARM core, what should I do?
Problem 2: elfutils failing to compile
| Making all in src | gcc -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work/x86_64-linux/elfutils-native/0.185-r1/recipe-sysroot-native/usr/share/locale"' -DDEBUGPRED=0 -DSRCDIR=\"/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work/x86_64-linux/elfutils-native/0.185-r1/elfutils-0.185/src\" -DOBJDIR=\"/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work/x86_64-linux/elfutils-native/0.185-r1/build/src\" -I. -I../../elfutils-0.185/src -I.. -I. -I../../elfutils-0.185/src -I../../elfutils-0.185/lib -I.. -I../../elfutils-0.185/src/../libelf -I../../elfutils-0.185/src/../libebl -I../../elfutils-0.185/src/../libdw -I../../elfutils-0.185/src/../libdwelf -I../../elfutils-0.185/src/../libdwfl -I../../elfutils-0.185/src/../libasm -isystem/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work/x86_64-linux/elfutils-native/0.185-r1/recipe-sysroot-native/usr/include -std=gnu99 -Wall -Wshadow -Wformat=2 -Wold-style-definition -Wstrict-prototypes -Wtrampolines -Wlogical-op -Wduplicated-cond -Wnull-dereference -Wimplicit-fallthrough=5 -Werror -Wunused -Wextra -D_FORTIFY_SOURCE=2 -isystem/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/build/tmp/work/x86_64-linux/elfutils-native/0.185-r1/recipe-sysroot-native/usr/include -O2 -pipe -c -o elflint.o ../../elfutils-0.185/src/elflint.c | ../../elfutils-0.185/src/elflint.c: In function ‘check_sections’: | ../../elfutils-0.185/src/elflint.c:4105:48: error: null pointer dereference [-Werror=null-dereference] | 4105 | idx < databits->d_size && ! bad; | | ~~~~~~~~^~~~~~~~ | cc1: all warnings being treated as errors | make[2]: *** [Makefile:801: elflint.o] Error 1 | make[1]: *** [Makefile:525: all-recursive] Error 1 | make: *** [Makefile:441: all] Error 2 | ERROR: oe_runmake failed | WARNING: exit code 1 from a shell command. ERROR: Task (virtual:native:/home/allen/Codes/Xilinx/project_1/peta/artyZ7_os/components/yocto/layers/core/meta/recipes-devtools/elfutils/elfutils_0.185.bb:do_compile) failed with exit code '1'
This problem was once observed by the community, and a fix was attempted. However, since it happened on an EOL branch. The change was never merged. https://lists.yoctoproject.org/g/poky/topic/91722855#12815
Anuj, you are a d**k.
A quick fix is to use an older version of GCC. GCC-9 worked. I used Ubuntu's update-alternatives
utility to point GCC to gcc-9. You may find your own method.
Comments NOTHING