<div dir="ltr"><div><div><div><div><div>Update! This is about Mathworks buildroot for Neptune. Some progress, new blocker. <br><br>The missing header files (dt-bindings for the device tree) for the zcu102-adrv9002 build go here:<br><br>abraxas3d@chococat:~/neptune/buildroot/output/zcu102_linux_linaro/build/linux-mathworks_zynq_R21.2.0/include/dt-bindings$ ls<br>arm clock dma gpio iio interrupt-controller media mfd phy power regulator soc spmi<br>clk display drm i2c input leds memory net pinctrl pwm reset sound thermal<br><br>The above directory is the directory that is pointed to by this symbolic link below:<br><br>abraxas3d@chococat:~/neptune/buildroot/output/zcu102_linux_linaro/build/linux-mathworks_zynq_R21.2.0/arch/arm64/boot/dts/include$ ls -l<br>total 0<br>lrwxrwxrwx 1 abraxas3d abraxas3d 34 Jul 1 2021 dt-bindings -> ../../../../../include/dt-bindings<br><br></div>So, this is where the additional header files, that are included in the radio card device tree source files, need to go. <br><br></div>So, I downloaded all these header files from Analog Devices, hand copied them over, and ran the build script build.py. The symbolic link is already in there. <br><br></div>However, the build script overwrites that source directory. The radio card header files go away. The directory contents after running the build script are only the Xilinx dev board header files. <br><br></div>I read through the build script and the other helper scripts, looked at the .mk files, looked at the defconfigs, <a href="http://config.in">config.in</a> files, and grepped for anything relating to setting up this directory to see where it was setting up this directory and where it was cleaning it up. <br><br></div><div>Analog Devices said they could not help figure it out, since it's not their codebase. They were helpful with some other things relating to transceiver configuration, but we can't quite get there yet if we can't talk to the card. <br><br></div><div>The Kuiper build from Analog Devices does things differently. You download a pre-built card, and then move radio-centric files to particular directories, including the compiled .dtb. For that version of embedded linux, there's no building or compiling of anything at all. <br><br>Petalinux has a menu-config process. You put the .dts file in a particular directory, point to it with a config file, and then it compiles the radio card devices into the device tree. <br><br></div><div>I asked Mathworks for help. The build process is handled by a python script that comes directly from the repository. The symbolic link and the populating of the dt-bindings directory from source are handled somewhere in all the build mechanisms. <br><br></div><div>Anyone have any clever way around this problem?<br></div><div><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">-Michelle Thompson<br><br><br></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 24, 2023 at 7:43 PM Michelle Thompson <<a href="mailto:mountain.michelle@gmail.com">mountain.michelle@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Greetings all!<br><br>We can produce an SD card image for the zcu102 (our FPGA development station in Remote Labs that serves Neptune, etc,) in several ways. <br><br>1) We have a
working Analog Devices Kuiper build. <br>2) We know how to make a petalinux
build (haven't produced one yet, but would follow the same process as we
did for the zcu706+ADRV9371). <br>3) We are trying to produce a mathworks
buildroot build so we can use HDL Coder (MATLAB/Simulink).<br><br><span aria-label=""></span>Getting
to the point where a zcu102 SD image was produced required installing
some missing packages on Chococat and applying some patches. One patch we found on the internet and the other we created from the commit number.
We had to add in a symbolic link so that /opt/Xilinx could be found
(for the Vivado SDK) because we have our tools in /tools/Xilinx at Remote Labs. <span aria-label=""></span><br><br>We're
at the point where we are trying to compile the device tree for the
zcu102-adrv9002. In other words, we want to add the SDR device tree to the embedded linux image in order to be
able to connect to the radio with IIO from MATLAB and use HDL Coder with
minimum friction.<br><br><span aria-label=""></span>We
have the .dts (Device Tree Source) file from Analog Devices github for the ADRV9002. This
file includes several other .dts files. We copied all of those to the
dts directory successfully.<span aria-label=""></span><br><br>We
exported a new psu_init_gpl.c and psu_init_gpl.h from Vivado, using the
reference design from Analog Devices of the zcu102-adrv9002
combination, as laid out in the "handoff files" part of the directions
here:<span aria-label=""></span><a href="https://www.mathworks.com/help/hdlcoder/ug/xilinx-zynq-linux-image-for-custom-boards.html" rel="noopener noreferrer" target="_blank">https://www.mathworks.com/help/hdlcoder/ug/xilinx-zynq-linux-image-for-custom-boards.html</a><span aria-label=""></span><br><br>The
instructions in the link above are for adding a completely new custom
FPGA dev board to buildroot, and not for the (easier? maybe?) case of
adding a supported radio card to a supported dev board. <br><br>Adding a radio
card to a supported dev board is what we're trying to do. <br><br>I am hoping
the workflow of adding a new development board and adding a supported
radio card to a supported development board is the same or similar
process. <br><br>If you are reading this and can help, please speak up.<span aria-label=""></span>I have not found a walkthrough or explanation or video on this yet. When we get it to work, we'll write one up.<span aria-label=""></span><br><br>The
exported .c and .h files were different from the ones that were already
there in buildroot in /boards/zcu102/boot/handoff, and this isn't
surprising. The ones already there only know about the zcu102. The new
ones are from the export of the reference design that has both the
zcu102 and the adrv9002 designs in it.<br><br><span aria-label=""></span>We
think that to include a new .dts file, we need to add values - shown
below - to the defconfig file at this level. Note that the zcu102
defconfig does have a copy and paste typo in the comment header - it
says ZC706 (which is a different board), but the commands in the file before we added ours were
correct. They all (correctly) referred to the zcu102. The top two
commands were in the file when we found it. The bottom three commands
are what we added. <br><br>The file below is definitely defconfig from
~/neptune/buildroot/board/mathworks/zynqmp/boards/zcu102/defconfig.<br><br><span aria-label=""></span><span aria-label=""></span>###########################################<br># ZC706 Options<br>###########################################<br>BR2_TARGET_UBOOT_BOARD_DEFCONFIG="xilinx_zynqmp_zcu102_rev1_0"<br>BR2_PACKAGE_XILINX_BOOTLOADER_UBOOT_TARGET_DIR="board/xilinx/zynqmp/zynqmp-zcu102-rev1.0"<span aria-label=""></span><br><br>BR2_LINUX_KERNEL_DTS_SUPPORT=y<br>BR2_LINUX_KERNEL_USE_CUSTOM_DTS=y<br>BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="/home/abraxas3d/neptune/buildro.... (multiple .dts files)<span aria-label=""></span><span aria-label=""></span><span aria-label=""></span><br><br>This moved things forward quite a bit!<br><br><span aria-label=""></span>But the build script errors out with a failure to find dt-bindings.<span aria-label=""></span><br><br>Failing
to find dt-bindings can be solved with a symbolic link, according to a
couple of posts here and there from people having similar problems with
trying to add custom .dts files to an existing device tree setup in a
linux build, but I do not know where it was looking for dt-bindings in
the first place, or where the "right" dt-bindings include files are. I'm
not sure what to link to what.<span aria-label=""></span><br><br>Here is the error message snippet and the build log attached:<span aria-label=""></span><br><br>In file included from arch/arm64/boot/dts/zynqmp-zcu102-revA.dts:12:0,<br> from arch/arm64/boot/dts/zynqmp-zcu102-revB.dts:10,<br> from arch/arm64/boot/dts/zynqmp-zcu102-rev1.0.dts:10,<br> from arch/arm64/boot/dts/zynqmp-zcu102-rev10-adrv9002.dts:10:<br>arch/arm64/boot/dts/zynqmp.dtsi:15:47: fatal error: dt-bindings/dma/xlnx-zynqmp-dpdma.h: No such file or directory<br> #include <dt-bindings/dma/xlnx-zynqmp-dpdma.h><br> ^<br>compilation terminated.<br>scripts/Makefile.lib:313: recipe for target 'arch/arm64/boot/dts/zynqmp-zcu102-rev10-adrv9002.dtb' failed<br>make[3]: *** [arch/arm64/boot/dts/zynqmp-zcu102-rev10-adrv9002.dtb] Error 1<br>arch/arm64/Makefile:114: recipe for target 'zynqmp-zcu102-rev10-adrv9002.dtb' failed<br>make[2]: *** [zynqmp-zcu102-rev10-adrv9002.dtb] Error 2<br>package/<a href="http://pkg-generic.mk:227" rel="noopener noreferrer" target="_blank">pkg-generic.mk:227</a>:
recipe for target
'/home/abraxas3d/neptune/buildroot/output/zcu102_linux_linaro/build/linux-mathworks_zynq_R21.2.0/.stamp_built'
failed<br><br><span aria-label=""></span>We
can look at the .dtb file produced by mathworks buildroot (before
trying to add the ADRV9002 device files) with fdtdump and see all sorts
of things that we expect - just no radio devices yet.<span aria-label=""></span><br><br>Optimistic that it's close to working. If you can take a look at this build on Chococat and explain where the symbolic link needs to go, that would be a big help. <br><br></div>Thanks everyone! We're also setting things up in Simulink for golden tests and some doppler experiments, so you should see some initial waveforms and test results shortly. <br><br></div>If you want to join the team or just observe the engineering firsthand, please find #Neptune channel on our Slack. <br><div><div><br><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">-Michelle Thompson<br><br><br></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>