12-25-2019 01:11 PM
vitis (or xsdk) integration with petalinux is all over the place.
A couple of questions:
12-29-2019 01:18 AM
12-29-2019 10:10 AM
I believe you are referring to accelerated applications development.
I'm asking about cross-compiling applications from a windows machine to the cortex-a9 running linux.
Mostly, I want to know if there is a convenient way to setup a vitis linux application project with all the gcc/g++ flags on a windows machine?
04-16-2020 01:35 PM
I am trying to do the same thing. Did you manage to find a solution ?
I tried doing it with Ext1-2-3-4 reader programs, but they don't really make it possible to mount/use the sysroot of an usb.
04-16-2020 01:48 PM
Yes, but not in the most elegant way.
My VM was in Virtualbox. I created a shared folder between the host and the VM and copied the entire sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi folder to it (making sure to de-reference symbolic links -L). It is then available for you in Windows. In theory, you don't need the entire thing, just the include and bin folders. A small number of files failed to copy (I forget how many) which probably happened since there was a different file in the directory with the same name but different casing (allowed in Linux, but not in Windows). If you happen to require to include any of these files in your application, you can probably rename them (making sure that any other headers using them take that into account).
04-19-2020 10:11 PM
The following summary describes the tool setup and use process (based on my experience). It applies to MPSOC/RFSOC and the ZCU111 target, however I believe that it may be useful with other targets as well.
Xilinx supports several software development flows for the MPSOC/RFSOC, as follows:
- Linux running on the A53 cores (in SMP mode)
- Free RTOS or "bare metal" software running on the A53 and/or R5 cores (it is
possible that different cores run different types of software).
In addition to Linux kernel and application software also need several software
packages for the system to start, as follows:
- PMU firmware
- ATF (ARM trusted firmware)
- FSBL (first-stage boot loader)
- SSBL (second-stage boot loader) - usually U-Boot
Xilinx provides two software development environments, as follows:
a) PetaLinux tools - this environment is necessary for preparing a bootable Linux
image. Specifically, it allows preparing an image containing the various
bootloaders, the Linux image and (optionally) application code.
It follows that any custom drivers that are linked to the kernel must be added to
the system using this flow.
PetaLinux tools are only supported on Linux.
b) Vitis development environment - this environment supports development of all
design flows mentioned above except for bootable Linux kernel preparation (which
necessitates PetaLinux tools).
Vitis can run on Windows or on Linux.
Application software running under Linux (on the A53 cores in SMP mode) can be
developed in two ways:
a) Using PetaLinux tools - the application is added to the bootable image.
b) Using Vitis - creating a separate executable (ELF) which can be downloaded to the
target and run separately (once Linux is up).
In the latter case, need to export target libraries, BSP data, device tree, etc.
from the PetaLinux environment to the Vitis environment. This data is known as the
In general, software development under PetaLinux is quite user-unfriendly. In
particular, there is no GUI-based IDE for building and debugging. Vitis does provide
a graphical IDE (based on Eclipse) which facilitates a reasonably convenient build
and debug flow.
Both the PetaLinux environment and the Vitis environment use custom design
details exported from Vivado (these are files with .xsa extension).
II) PetaLinux environment setup (for PetaLinux 2019.2)
1. Setting up the Linux virtual machine
a) PetaLinux development tools need to run under Linux. Per UG1144 I installed
Ubuntu 18.04.02 (64-bit). It subsequently updated itself to 18.04.4.
b) I am running Ubuntu in a VirtualBox VM. Specifically, I am using VirtualBox 6.1
(had some problems with 6.1.2).
c) Specified 200 GB disk size for the VM (the PetaLinux tools are extremely disk-
d) Needed to enable 3D acceleration, or else the display did not function very well.
Note: even now occasionally there are transient problems with rendering which are
worked around by minimizing and maximizing the VM.
e) Specified a shared folder with all permissions. Also enabled clipboard sharing.
2, Changes in Linux setup after installation
a) Changed the shell from dash to bash (sudo dpkg-reconfigure dash and select the
option not to use /bin/dash as the default shell).
b) sudo apt-get update
c) Per UG1144 installed various packages:
- Used the list provided in 2019.2_PetaLinux_Package_List.xlsx (found at
- Afterwards went over the list using sudo apt-get install commands and almost
everything was installed correctly except for pyhton-pip.
- Used the sudo apt-get install sequence from here:
- sudo apt-get install tftpd-hpa and configured it to allow client uploads as
well (this is all probably unnecessary).
d) Installed PetaLinux 2019.2 per UG1144.
Note: before doing that, issued the following command:
sudo chown beni-falk:beni-falk /opt/
Note: had to chmod the installer (.run file) to 755, or else it would not run
(UG1144 specifically says not to do that, but I had no choice).
e) After installing PetaLinux:
- Added the following to ~/.bashrc:
source /opt/pkg/petalinux/2019.2/settings.sh > /dev/null
(this last one was necessary since otherwise it wouldn't find bootgen)
- petalinux-util --webtalk off
3. Additional changes to Linux setup for the sake of compatibility, convenience, etc.
a) Using the Tweaks application (from the dock):
a1) Enabled Ubuntu app indicators.
a2) Enabled Windows-like behavior for numeric keypad keys:
Keyboard and Mouse->Additional Layout Options->
Miscellaneous compatibility options->Num Lock on: digits; Shift for arrow
keys. NumLock off: arrow keys (as in Windows)
b) Disabled screen saver (Settings->Power) since it caused the VM to misbehave.
III) Using the PetaLinux development environment (in conjunction with ZCU111 EVB)
1. ZCU111 BSP can be downloaded from here:
Another option which also comprises rftool source code is here:
2. Following the tutorial provided here:
a) petalinux-create -t project -s rfsoc_petalinux_bsp.bsp
b) Applying the modifications as provided on that page (some of them were
unnecessary - they were already there in the 2019.2 BSP; I wasn't able to
perform the step calling for adding an entry to
c) For each of nonmts, mts, ssr:
./dtc -O dtb -o pl.dtbo -b 0 -@ pl_<design type>.dtsi
bootgen -image bitstream.bif -arch zynqmp -o zcu111_rfsoc_trd_wrapper.bit.bin -w
<copy pl.dtbo and zcu111_rfsoc_trd_wrapper.bit.bin to appropriate esdcard directory>
petalinux-package --force --boot --fsbl zynqmp_fsbl.elf --pmufw pmufw.elf --u-boot u-boot.elf
<copy BOOT.BIN and image.ub to sdcard directory>
3. Prepare a FAT-formatted SD card containing BOOT.bin and image.ub in the root
directory (along with optional autostart.sh). It should also contain three
subdirectories containing nonmts, mts and ssr data, respectively. This SD card
should be able to boot the ZCU111. If autostart.sh is provided - it can be used
to automatically set IP address (ifconfig) and start the rftool application.
Note: autostart.sh should be placed at the root of the SD card.
ifconfig -a | grep eth0
if [ $RESULT -eq 0 ]; then
ifconfig eth0 192.168.1.3
4. Exporting sysroot data in order to allow building and debugging the rftool
application as a standalone application (under Linux) using Vitis is done per the
The above build takes a very long time (~45 minutes).
The outputs from this process that need to be conveyed to Vitis reside in the
following folder: <plnx-project>/images/linux/sdk/sysroots/aarch64-xilinx-linux
IV) (Optional) project tweaks in the PetaLinux environment
1, Addition of Midnight Commander to target image -
2. Adding auto-login (user root, password root) - this is taken from UG1144:
a) Change to the root directory of your PetaLinux project -
b) Run petalinux-config
c) Select Yocto-settings and enable debug-tweaks
d) Save the configuration and exit
e) Run petalinux-build
V) Vitis environment setup and use (for Vitis 2019.2.1)
The following assumes that Vitis (installed on Windows) is used for developing
applications that will run on the target under Linux on the A53 cores (in SMP mode).
1. Copy sysroot data from the Linux VM - it turns out that many of the files
comprised by the sysroot are actually links to other files. When copying this
file structure to Windows need to convert each such link to the actual file.
This is done as follows (on the Linux machine):
cp -R -L <plnx-project>images/linux/sdk/sysroots/aarch64-xilinx-linux <shared_folder>
The contents of <shared_folder> can now be used under Windows.
2. Copy the images directory from the Linux machine
(<plnx-project>/images/linux - not including the sdk subdirectory).
3. Define a platform project in Vitis:
a) File->New->Platform Project->Create from hardware specification (XSA)
Browse to the appropriate .xsa file (it needs to be copied from the Linux
machine - these files are located under the pl directory, e.g.
Set Operating system to linux and Processor to psu_cortexa53
b) In the platform editor view left-click the top-most item. On the right uncheck
'Generate boot components'.
c) In the platform editor view left-click 'linux on psu_cortexa53'. Specify
additional details as follows:
- Bif File: path to BIF file (see below)
- Boot Components Directory: path to where have copied the images directory
- Linux Image Directory: ditto
- Sysroot Directory: path to where have copied sysroot data
QEMU-related fields can be left blank
d) Create a BIF (boot image format) file similar to the following:
/* linux */
[destination_cpu=a53-0, exception_level=el-3, trustzone] <bl31.elf>
[destination_cpu=a53-0, exception_level=el-2] <u-boot.elf>
This assumes that the BIF file resides in the images directory.
4. Build the platform project - in the Assistant view right-click the newly created
platform project and then click 'Build'.
5. Create and build an application project in Vitis:
a) File->New->Application Project
Set System project to Create New...
Select the platform, provide sysroot path
Select Linux Hello World Application
b) In the Assistant view right-click the application (the relevant
configuration - Debug or Release) and then click 'Build'.
The above generates an .elf file that can be downloaded to the target and
6. Application (cross-)debugging using Vitis:
a) Create a target connection - on the toolbar click 'Launch Target Connections'.
Open 'Linux TCF Agent' and click 'Add new target connection'. Specify the
target's IP address (under Host). Leave the default port number (1534). Click
'Test Connection' to test the connection.
b) In the Assistant view right-click the application (the relevant
configuration) and then click Debug-> Launch on Hardware (Single Application
Debug). This starts the debug session.
c) To edit the debug configuration - in the Assistant view right-click the
application (the relevant configuration) and then click Debug->
In the Main tab select the proper connection.
In the Application tab make sure that 'Disconnect when last debug context
exits' is checked.
Note: when debugging applications in this manner the application's standard I/O
is redirected to a console window in the debugger (TCF Debug Process
Note: It is --mandatory-- that the symbols on the host match the code running on
the embedded target (inclding user-level code, e.g. XRFDC driver and other
library code). If not, application ELF that the debugger attempts to run on
the target can terminate abnormally during execution (not necessarily
immediately). Symptoms include a message to the TCF console indicating a
failure to resolve a symbol.
Note: the debugger has trouble stepping into library code (in assembly mode, of
course). To work around this problem, can manually enter the address of the
library routine in the text box at the top of the Disassembly window and
set a breakpoint there. Then click F8 (resume).
04-20-2020 09:09 AM
It is unclear if you are using Vitis for an acceleration project or just to create linux apps.
If you are just creating linux apps, then you can do the following:
Now you can use a Vitis debug configuration to download your app via ethernet and run/debug the app. Or, you can copy the Vitis Debug\your_app.elf to SD to run the app.
04-25-2020 08:59 AM - edited 04-25-2020 09:01 AM
Hello @johnmcd ,
Thank you for this post because I am facing this problem.
I have vitis on windows 10
I have a Petalinux 2019.2 on VM ubuntu 18.04
I copied the sdk sysroot into a shared folder when vitis is linked as you described but
How can I know which library to use ? I want to include
I have a A53 standalone app that I would like to move on custom Linux generated by petalinux 2019.2.
But maybe It is not possible....
Again thank you
06-12-2020 12:48 AM
I have the same problem. We want to develop Apps with Vitis in Windows, so developers don't have to install a virtual machine.
I use the command suggested by @beni.falk “cp -R -L <plnx-project>images/linux/sdk/sysroots/aarch64-xilinx-linux <shared_folder>”, to copy the files to the windows shared folder, but I get several errors of duplicate files.
I try to copy only the files suggested by @johnmcd (lib, usr/include, usr/lib) but I get the same errors.
There isn’t a easy way to develop Apps in Vitis without a Linux Virtual Machine?
02-04-2021 10:15 AM
I wrote a pretty extensive blog post on this using WSL and Git https://doayee.co.uk/petalinux-on-windows-via-wsl-and-git/ which you can find here. It has specific instructions for allowing the Vitis IDE on Windows access to the Petalinux build from WSL.
02-04-2021 11:50 AM
Glad you enjoyed, I spent a good while banging my head on the wall trying to get this all set up... ironic additions were the more PG way of expressing myself