Get Started¶
Set-up development machine¶
The TLD is based on Xilinx’ Petalinux. Therefore, first of all Petalinux 2021.1 must be installed on the development PC. For guidance on installing Petalinux, we refer to chapter 2 of the Petalinux user guide ug1144. Please note we only support 2021.1.
Note
The development PC must be installed with Ubuntu 18.04 or 20.04 LTS.
Note
Make sure you have at least 50 GB free disk space.
Note
Don’t forget to configure the terminal to not use dash by running: sudo dpkg-reconfigure dash
. Choose ‘No’ when asked for.
The TLD comes with several .bsp files. These are the Board Support Package files that can be loaded into Petalinux to have a kick-start for creating an image for this board. These BSP files can be downloaded from downloads.topic.nl
Now Petalinux is installed and the right BSP file(s) are downloaded, the development PC is correctly configured and ready to use.
Setup static state cache (optional)¶
Static state cache holds results from previous compile jobs. This way it prevents the need to rebuild everthing, everytime. By default some static state cache is provide by Xilinx. But you can setup your own.
The build will look for ${HOME}/.bitbake-site.conf
. You will need to create this file.
A content example is given below. Configuring at least SSTATE_DIR
and DL_DIR
already saves a lot of time.
SSTATE_DIR
is path to your local static state cache.DL_DIR
is path to your local download cache.
# Re-use the build server's hard labour
SSTATE_MIRRORS = "\
file://.* http://static-state-cache-server.local/share/sstate/PATH \n \
"
SOURCE_MIRROR_URL = "http://static-state-cache-server.local/sources/"
## Cache on local machine
SSTATE_DIR = "${HOME}/workspace/bitbake_cache/sstate-cache"
DL_DIR = "${HOME}/workspace/bitbake_cache/downloads"
For more info on static state cache check yocto manual.
Build an image¶
The following steps describe how to build an image for one of the TOPIC development kits.
Note
The assumption is that the PC is configured correctly during the Set-up development machine step.
- Source petalinux:
source /tools/petalinux/2021.1/settings.sh
- Create petalinux project/workspace from BSP (.bsp file):
petalinux-create -t project -s BSP_FILE -n PROJECTNAME
- Build the image:
petalinux-build -c "petalinux-image-minimal-swu-sd"
This can take upto a couple of hours to build. Having a machine with many cores speeds up the build a lot. For your reference an AMD Ryzen 9 3900X with 100 MBps internet connection takes about 30 minutes.
When the build is finished the build results will be available in
build/tmp/deploy/images/${TDK}
where ${TDK} is the development kit name (ex: tdkzu)Note
Setup a static state cache can speed up the build a lot. See Setup static state cache (optional)
Note
Sometimes the build fails on a failed download. This can be fixed/worked around by re-running the petalinux-build command.
Create a bootable SD card¶
There are several ways to copy the build results to an SD card. Below, 2 ways are described
Using a wic image¶
The easiest way to create a bootable SD card is to take a WIC image and
write it to the SD card using the dd
command. A tool like bmap-tool or balena-etcher can also be used.
For dd
, first find out what the cardreader device is (plugin the device and run dmesg
command).
Then run the following command, replacing /dev/sdX with the actual device name and TDK with the development kit name (ex: tdkzu):
sudo dd if=build/tmp/deploy/images/${TDK}/petalinux-image-minimal-${TDK}.wic of=/dev/sdX bs=1M
Note
The SD card needs not be formatted for this. When the board boots, it will automatically resize and create the partitions.
Manually partitioning¶
Alternatively, you can manually partition the SD card. For example you could use
a graphical tool like gnome-disks
.
Partition and format the SD card as follows:
boot
: 128 MB FATsd-rootfs-a
: 40% ext4sd-rootfs-b
: 40% ext4data
: remaning ext4
Also mark sd-rootfs-a as bootable
From the results directory, copy
boot.bin
to theboot
partition- Extract the rootfs archive to the
sd-rootfs-a
partition by running: tar -xf petalinux-image-minimal-${TDK}.tar.gz --directory=/media/${USER}/sd-rootfs-a/
- Extract the rootfs archive to the
Safely unmount the SD card (using the umount command or via the filemanager) to make sure everthing is written to the SD card before removing it.
Boot an image¶
The several boards can boot from different sources. Supported boot media (per board) are:
SD (all boards)
QSPI (all boards)
eMMC (not present on Zynq-7000 devices)
Boot switches on the board select the boot source. See section Appendix A - Topic boards. for the right boot switch setings. That page also describes where the UART interface can be found.
Open a serial connection to the board at baudrate 115200, no parity, no flow control. For example using picocom
:
picocom -b 115200 /dev/ttyUSB0
Power the board, the serial output will look like this:
Xilinx Zynq MP First Stage Boot Loader
Release 2021.1 Jun 6 2021 - 07:07:32
PMU Firmware 2021.1 Jun 6 2021 07:07:32
PMU_ROM Version: xpbr-v8.1.0-0
NOTICE: ATF running on XCZU9EG/silicon v4/RTL5.1 at 0xfffea000
NOTICE: BL31: v2.4(release):xlnx_rebase_v2.4_2021.1
NOTICE: BL31: Built : 08:27:07, Apr 28 2021
U-Boot 2021.01 (Jun 01 2021 - 11:54:06 +0000)Topic Miami MPSoC Plus
Within a few seconds the terminal should give a prompt (hostname varies based on ${TDK}):
Connected to SWUpdate via /run/swupdateprog
random: crng init done
random: 4 urandom warning(s) missed due to ratelimiting
OK
root@tld-peta-tdpzu9:~#
To check that the board is operational type a command like uptime
:
root@tld-peta-tdpzu9:~# uptime
12:51:24 up 2 min, load average: 0.00, 0.00, 0.00