User Tools

Site Tools


Generate Linux and bitstream using Vivado and PetaLinux

The V2 of this VNA is based on a Zynq. Starting with that arch can be painful !

Setup PetaLinux

First install PetaLinux and then download This file is a base system for the uZed.

	source ~/Xilinx/petalinux/
	cd mz7010_fmccc_2017_4/

You're now in a base project for the uZed board. One of the most important directory for end-user is the “hardware” directory. It contains the Vivado Hardware project. You can do your own design here. Once done you have to generate the SDK data:

  • Run Synthesis, Implementation and Generate bitstream
  • File → Export → Export Hardware (include bitstream)

After that you can generate the Linux image:

	petalinux-config --get-hw-description hardware/MZ7010_FMCCC/mz_petalinux.sdk/
	petalinux-config -c kernel
	petalinux-config -c rootfs

These tree commands allows to generate configuration files used to create the Linux image. Once you have the wanted parameters you can build the image.


This last command can run for few minutes ! There should be a new directory named “image”. This one contains the “binary” and “configuration” files !

	cd images/linux/
	petalinux-package --boot --fsbl zynq_fsbl.elf --fpga mz_petalinux_wrapper.bit --uboot --force

This command is the last one, it generates the necessary files to boot from SD-Card (or other if configured in the petalinux-config). So you can copy:

  • BOOT.bin
  • image.ub
  • mz_petalinux_wrapper.bit

to the SD-Card.

Useful parameters


If you need to relaunch the general configuration without change in the hardware you can simply run:


TCF Agent

The TCF Agent (Target Communications Framework) is use for debugging from the Xilinx SDK (the application are executed remotely on the Zynq target). This application is enabled in the rootfs config

	petalinux-config -c rootfs

In the config activate “tcf-agent” in “Filesystem Packages → misc → tcf-agent” and activate “peekpoke” in “apps”.

Testing new bitstream [This method is deprecated since Petalinux 2018.x]

If the new bitstream is similar to the previous one (no change in the interface to the PS) you can flash the bitstream directly in the Zynq.

	scp mz_petalinux_wrapper.bit root@AD.DR.IP:/home/root/
	cat mz_petalinux_wrapper.bit > /dev/xdevcfg
        cat /sys/class/xdevcfg/xdevcfg/device/prog_done

SPI Problems

Configuring SPI Interfaces

While i2c is pretty straight forward (instantiate in Vivado and few kernel/rootfs configurations) the SPI interfaces need some configuration in the DTS.

We need to add the different devices linked to different #CS signals.


We will add something like that:

&spi0 {
	status = "okay";
	num-cs = <3>;
	is-decoded-cs = <0>;
	spidev@0x00 {
		compatible = "spidev";
		spi-max-frequency = <25000000>;
		reg = <0>;
	spidev@0x01 {
		compatible = "spidev";
		spi-max-frequency = <25000000>;
		reg = <1>;

The two device will be used for ADC (maybe later a third will be used to drive the shift registers).

Testing MicroZED user led

Get the GPIO base address

cat /sys/class/gpio/gpiochip906/base/

Then export the GPIO Interface and write the output value. In the MicroZED, D3 is connected to the MIO = 47 (906+47 = 953).

echo 953 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio953/direction
echo 1 > /sys/class/gpio/gpio953/value
echo 0 > /sys/class/gpio/gpio953/value

Testing AXI Lite device quickly

You cas use the devmem tool in command line to write and read address

wiki/projects/vnarefit/zynq_config.txt · Last modified: 2020/05/22 05:18 by f4ihx