Skip to content

Latest commit

 

History

History
173 lines (124 loc) · 5.23 KB

README.md

File metadata and controls

173 lines (124 loc) · 5.23 KB

Symibiflow xc7z based automatic test system

Description

The system is designed for automatic biststream testing on xc7z devices. The system can be used with a CI system deploying the test bitstreams to the device and running the tests. System overview is presented in the picture bellow.

Test system overview

Currently the system can be run the Zybo-Z7. The following sections describe how to prepare test setup and run the tests.

Test setup

In general the tests can be run on any xc7z device. The tests are run from Linux running on the processing system of the xc7z device. The following guide assume the system boots from SD Card. Linux distribution used in the system is Arch Linux.

Prerequisites

Get all the sources:

git clone https://github.com/SymbiFlow/symbiflow-xc7z-automatic-tester.git
cd symbiflow-xc7z-automatic-tester
git submodule update --init --recursive

Get ARM toolchain:

wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
tar -xf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
export PATH=${PWD}/gcc-arm-none-eabi-9-2019-q4-major/bin:$PATH

SD card preparation

Follow the official guide to prepare SD card.

Getting Arch rootfs

Download Arch rootfs with:

wget http://de5.mirror.archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz

Unpack the file package onto the rootfs partition of the SD card:

sudo tar -xf ArchLinuxARM-armv7-latest.tar.gz -C /path/to/mountpoint/rootfs

Building U-Boot bootloader

U-Boot sources are fetched as a submodule in the main repo Building the software:

cd u-boot-xlnx
export ARCH=arm
export CROSS_COMPILE=arm-none-eabi-
make zynq_zybo_z7_defconfig
make -j`nproc`

Copy the resulting files to the boot partition of the SD card:

cp spl/boot.bin /path/to/mountpoint/boot
cp u-boot.img /path/to/mountpoint/boot

Building Linux kernel

Kernel sources are fetched as a submodule in the main repo Building the kernel:

cd linux-xlnx
git apply ../linux/0001-Add-symbiflow-tester-driver.patch
export ARCH=arm
export CROSS_COMPILE=arm-none-eabi-
export LOADADDR=0x8000
make xilinx_zynq_defconfig
make -j`nproc` uImage
make -j`nproc` dtbs
make -j`nproc` modules

Copy the required files to the SD card:

cp arch/arm/boot/uImage /path/to/mountpoint/boot
cp arch/arm/boot/dts/zynq-zybo-z7.dtb /path/to/mountpoint/boot/devicetree.dtb
sudo cp drivers/misc/symbiflow-tester.ko /path/to/mountpoint/rootfs/root

Adding required files to rootfs

Copy the required files to the SD card:

sudo cp python/symbiflow_test.py /path/to/mountpoint/rootfs/root
sudo cp -a devmemX /path/to/mountpoint/rootfs/root
sudo cp -a zynq_bootloader /path/to/mountpoint/rootfs/root

Running the tests

Booting the device for the first time

Connect Zybo-Z7's USB serial console to the PC. Insert prepared SD card into the board, set boot mode to SD and power up the board. Stop U-Boot autoboot by pressing any key during countdown. In U-Boot's console run the following commands:

setenv bootargs "root=/dev/mmcblk0p2 rw rootwait"
setenv bootcmd "load mmc 0 0x1000000 uImage && load mmc 0 0x2000000 devicetree.dtb && bootm 0x1000000 - 0x2000000"
saveenv

Reset the device and let it boot. Log into Arch Linux with the following credentials:

user: root
pass: root

On the first boot it is required to install some additional packages in the system. To do so, connect the board to Internet and run the following commands:

pacman -Syy
pacman -S python make gcc python-pip
pip install fnctl

Build and install additional tools:

cd /root/devmemX
make && make install
cd /root/zynq_bootloader/bit2bitbin
gcc bit2bitbin.c -o bit2bitbin
cp bit2bitbin /usr/bin

Running the test script

The test scripts should be run by the automatic CI system. The tests can be run manually with the following command:

python symbiflow_test.py --module symbiflow-tester.ko --module_name symbiflow_tester --bitstream top.bit --dev /dev/symbiflow-tester0 --driver_name symbiflow-tester

The test will program the FPGA fabric and run two tests:

  • Register access test
  • PS -> PL interrupts test

The PL fabric implements AXI Lite accessible registers. The registers can be written and read from the PS7. The registers are accessible at 0x40000000 address.

The first one writes random registers with random data, then reads it back and compare the values.

The second one uses the PL peripheral to generate random number of PS interrupts. PS Linux driver counts them and report back to the test script (via IOCTL).

The above mentioned tests are designed to be run against the bistream generated from the AXI Lite Minitest.