This is an old revision of the document!
The code for all the various pieces required to create testing SD cards can be found on Github. See the following list for links to the various parts:
U-Boot:
A version of U-Boot built from the test branch will run through the tests assuming a properly formatted SD card while the QSPI branch is for flashing to the device.
No-OS:
Xilinx SDK 2015.2 is currently required to build both of these projects.
In order to create an SD card for testing, the various test binaries, u-boot versions, and other files must be built and placed in the correct location in the boot partition of the standard SD card image. See the following hierarchy of test and flash related files on an SD card's boot partition mounted on /media/BOOT:
/media/BOOT ├── BOOT.BIN ├── devicetree.dtb ├── flash │ ├── BOOT.BIN │ ├── system.bit │ └── uramdisk.image.gz ├── ad9361.elf ├── loopback.elf └── uImage
Follow the instructions below to create the various files in the hierarchy seen above. Note that it is assumed the required Xilinx SDKs are installed and initialized properly for use in the current environment.
The bitstream is already available on the SD card in the bootgen_sysfiles.tgz file located in the related platform directory on the BOOT partition. This assumes the SD card's BOOT partition is already mounted at /media/BOOT.
mkdir -p ~/zynq-picozed-sdr2/bootgen cd /media/BOOT/zynq-picozed-sdr-bob tar -xvf bootgen_sysfiles.tgz -C ~/zynq-picozed-sdr2/bootgen mkdir -p /media/BOOT/flash cp ~/zynq-picozed-sdr2/bootgen/system.bit /media/BOOT/flash/
Now we have to build a different bitstream used for various test features:
cd ~/zynq-picozed-sdr2 git clone https://github.com/analogdevicesinc/hdl.git cd hdl/projects/pzsdr/ccbrk git checkout dev make pzsdr.ccbrk
Symlink the created bitstream into the unpacked bootgen directory for future use when building BOOT.BIN files.
cd ~/zynq-picozed-sdr2/bootgen ln -s ~/zynq-picozed-sdr2/hdl/projects/pzsdr/ccbrk/ccbrk_pzsdr.runs/impl_1/system_top.bit
The main U-Boot test ELF should be created using a process similar to the following:
cd ~/zynq-picozed-sdr2 git clone https://github.com/analogdevicesinc/u-boot-xlnx.git cd u-boot-xlnx git checkout pzsdr-test export CROSS_COMPILE=arm-xilinx-eabi- make zynq_picozed_sdr2_defconfig make -j$(nproc)
Next the BOOT.BIN file must be created. Note that the default bif file used for BOOT.BIN generation has a few file name mismatches in it. We've already corrected the bitstream name mismatch (since we symlinked our own version in) and to fix the FSBL so do the below (or change the name in the bif file):
cd ~/zynq-picozed-sdr2/bootgen mv zynq_fsbl_0.elf fsbl.elf
Copy in the U-Boot ELF file you just built:
cd ~/zynq-picozed-sdr2/bootgen cp ~/zynq-picozed-sdr2/u-boot-xlnx/u-boot ./u-boot-picozed.elf
Create the BOOT.BIN file:
cd ~/zynq-picozed-sdr2/bootgen bootgen -image zynq.bif -w -o BOOT.BIN
Copy the BOOT.BIN file to the root directory of the SD card's BOOT partition:
cp BOOT.BIN /media/BOOT/
This assumes you have already cloned the U-Boot repository in the previous step.
Build the U-Boot version targeting booting from QSPI flash:
cd ~/zynq-picozed-sdr2/u-boot-xlnx git clean -fxd git checkout qspiboot make zynq_picozed_sdr2_defconfig make -j$(nproc)
Copy it into the previously created folder of bootgen files:
cp u-boot ~/zynq-picozed-sdr2/bootgen/u-boot-picozed-qspi.elf
Create a new bif file in ~/zynq-picozed-sdr2/bootgen named zynq-qspi.bif with the following content:
the_ROM_image: { [bootloader]./fsbl.elf ./u-boot-picozed-qspi.elf }
This removes the FPGA bitstream from the generated BOOT.BIN (it'll be flashed separately) and points to our newly generated U-Boot ELF file.
Generate the new BOOT.BIN file:
cd ~/zynq-picozed-sdr2/bootgen bootgen -image zynq-qspi.bif -w -o BOOT.BIN
Copy the BOOT.BIN file to the flash directory of the SD card's BOOT partition:
cp BOOT.BIN /media/BOOT/flash/
cd ~/zynq-picozed-sdr2 git clone https://github.com/analogdevicesinc/no-OS.git cd no-OS/pzsdr/ccbrk/loopback ln -s ~/zynq-picozed-sdr2/hdl/projects/pzsdr/ccbrk/ccbrk_pzsdr.sdk/system_top.hdf make cp sdk/loopback/Release/loopback.elf /media/BOOT
TODO: ad9361
TODO
The code for all the various pieces required to create testing SD cards can be found on Github. See the following list for links to the various parts:
U-Boot:
No-OS:
Test script:
The remaining files used by the tests can be found in the parent directory: https://github.com/analogdevicesinc/board-tests/tree/master/picozed-sdr2-fmc
First, write the latest available SD card image found at https://wiki.analog.com/resources/tools-software/linux-software/zynq_images to a spare card and prepare the card to boot into Linux as detailed on that page.
When that is ready follow the instructions below the create the various files necessary to run the test suite.
Unpack the bootgen_sysfiles.tgz file located in the related platform directory on the BOOT partition of the SD card. The following commands assume the SD card's BOOT partition is already mounted at /media/BOOT.
mkdir -p ~/zynq-picozed-sdr2/bootgen cd /media/BOOT/zynq-picozed-sdr-bob tar -xvf bootgen_sysfiles.tgz -C ~/zynq-picozed-sdr2/bootgen
Build a loopback-enabled bitstream:
mkdir -p ~/zynq-picozed-sdr2 cd ~/zynq-picozed-sdr2 git clone https://github.com/analogdevicesinc/hdl.git cd hdl/projects/pzsdr/ccfmc git checkout dev make pzsdr.ccfmc
Symlink the created bitstream into the unpacked bootgen directory for future use when building BOOT.BIN files.
cd ~/zynq-picozed-sdr2/bootgen ln -s ~/zynq-picozed-sdr2/hdl/projects/pzsdr/ccbrk/ccbrk_pzsdr.runs/impl_1/system_top.bit
The main U-Boot test ELF should be created using a process similar to the following:
cd ~/zynq-picozed-sdr2 git clone https://github.com/analogdevicesinc/u-boot-xlnx.git cd u-boot-xlnx git checkout pzsdr-ccfmc-test export CROSS_COMPILE=arm-xilinx-eabi- make zynq_picozed_sdr2_defconfig make -j$(nproc)
Next the BOOT.BIN file must be created. Note that the default bif file used for BOOT.BIN generation has a few file name mismatches in it. We've already corrected the bitstream name mismatch (since we symlinked our own version in) and to fix the FSBL so do the below (or change the name in the bif file):
cd ~/zynq-picozed-sdr2/bootgen mv zynq_fsbl_0.elf fsbl.elf
Copy in the U-Boot ELF file you just built:
cd ~/zynq-picozed-sdr2/bootgen cp ~/zynq-picozed-sdr2/u-boot-xlnx/u-boot ./u-boot-picozed.elf
Create the BOOT.BIN file:
cd ~/zynq-picozed-sdr2/bootgen bootgen -image zynq.bif -w -o BOOT.BIN
Copy the BOOT.BIN file to the root directory of the SD card's BOOT partition:
cp BOOT.BIN /media/BOOT/
Next, create the no-OS loopback test ELF:
cd ~/zynq-picozed-sdr2 git clone https://github.com/analogdevicesinc/no-OS.git cd no-OS/pzsdr/ccfmc/loopback ln -s ~/zynq-picozed-sdr2/hdl/projects/pzsdr/ccbrk/ccbrk_pzsdr.sdk/system_top.hdf make cp sdk/loopback/Release/loopback.elf /media/BOOT
Finally the test script repository must cloned onto the rootfs of the card and the script must be set to be run automated on boot. This can either be done by mounting the SD card on another computer or running the SD card on a board connected to the Internet which we'll assume is the case here.
Once the board is booted up open a terminal and run the following commands:
First, clone the board testing git repo analog user's home directory:
git clone https://github.com/analogdevicesinc/board-tests.git
Then remove all applications that are currently set to run at boot:
rm -f /home/analog/.config/autostart/*
Next, create a desktop launcher to launch the tests on boot:
cat << EOF > /home/analog/.config/autostart/picozed-sdr2-fmc-tests.desktop [Desktop Entry] Exec=sudo /home/analog/board-tests/picozed-sdr2-fmc/runtests.sh Terminal=True Type=Application Name=PicoZed SDR2 FMC tests GenericName=PicoZed SDR2 FMC tests EOF
Finally, make the test script executable:
chmod +x /home/analog/.config/autostart/picozed-sdr2-fmc-tests.desktop
Now the SD card could be ready to automatically launch the test script in a terminal window on startup.