Download PetaLinux Board Support Package

Download the Starter Kit SOM BSP for the KV260 from the Xilinx Download Center:
https://www.xilinx.com/member/forms/download/xef.html?filename=xilinx-k26-starterkit-v2020.2.2-final.bsp

Building a KV260 PetaLinux Project based on the Board Support Package

This section describes all steps necessary to generate and build a BSP based, working Linux Image for the KV260 development platform using the Xilinx 2020.2.2 tool set. This was tested on systems running CentOS 7.9.2009 and Ubuntu 20.04.4 LTS.

1. Install PetaLinux

$ ./petalinux-v2020.2.2-final-installer.run --dir /opt/Xilinx_local/petalinux/2020.2.2/

2. Source the PetaLinux settings script

$ source /opt/Xilinx_local/petalinux/2020.2.2/settings.sh

(optional) 2.1. Remove the existing aarch64 folder

$ rm -rf /opt/Xilinx_local/petalinux/2020.2.2/components/yocto/source/aarch64

(optional) 2.2. Upgrade PetaLinux with the new eSDK

$ petalinux-upgrade -u 'http://petalinux.xilinx.com/sswreleases/rel-v2020.2.2/sdkupdate/update1/' -p 'aarch64'

(optional) 2.3. Source the PetaLinux settings script again

$ source /opt/Xilinx_local/petalinux/2020.2.2/settings.sh

3. Change to the directory in which the project is to be created

$ cd ~/your/dir/choice

4. Create the project

$ petalinux-create -t project -s ~/Downloads/xilinx-k26-starterkit-v2020.2.2-final.bsp

5. Enter the project directory

$ cd xilinx-k26-starterkit-2020.2.2/

6. To include KV260 starter kit specific packages on the rootfs at build time, set the BOARD_VARIANT variable in the config

$ echo 'BOARD_VARIANT = "kv"' >>  project-spec/meta-user/conf/petalinuxbsp.conf

7. Build the project

$ petalinux-build

8. Package the wic image

$ petalinux-package --wic --bootfiles "ramdisk.cpio.gz.u-boot boot.scr Image system.dtb"

9. Insert, identify and, if necessary, unmount the SD card

$ lsblk
$ umount /media/marvin/boot
$ umount /media/marvin/root

10. Write the wic image to the SD card. Important: Replace mmcblk0 with your SD-card-device

$ sudo dd bs=4M if=images/linux/petalinux-sdimage.wic of=/dev/mmcblk0 status=progress && sync

11. Insert the SD card in the KV260 board and boot it. Done!

For more information have a look at https://xilinx.github.io/kria-apps-docs/2020.2/build/html/docs/build_petalinux.html

Building a KV260 PetaLinux Project without a Board Support Package

This section describes all steps necessary to generate and build a working Linux Image for the KV260 development platform using the Xilinx 2020.2.2 tool set.

1. Create the project

$ petalinux-create -t project -n kria_kv260_without_bsp --template zynqMP

2. Enter the project directory

$ cd kria_kv260_without_bsp

3. Include hardware project (*.xsa-file) and configure the PetaLinux project

$ petalinux-config --get-hw-description ../../vivado_prj/kria_kv260_getting_started

4. Adapt the device tree according to the hardware project

5. Build the project

$ petalinux-build

6. Package the wic image

$ petalinux-package --wic --bootfiles "rootfs.cpio.gz.u-boot boot.scr Image system.dtb"

Booting the Kria on the KV260 platform directly from SD card or JTAG

The initial idea was to modify U-Boot in one boot image on the QSPI flash, to change the boot mode to sd card and trigger a soft reset. However, this didn't work, because after changing the boot mode using the command mw.w 0xff5e0200 0xe100 or mw.w 0xff5e0200 0x5100 and triggering a soft reset using mw.b 0xff5e0218 0x11, the Zynq was stuck in reset.

An alternative attempt that works is to use xsct. The following script can be executed on a PC, connected via Micro USB to the KV260, to boot the Kria directly from the SD Card or JTAG:

#######################################################################################
# This script will overwrite the hardwired boot mode on the KV260 and boot the Kria   #
# from eighter JTAG or the SD card.                                                   #
#                                                                                     #
# Usage:                                                                              #
# $ source /opt/Xilinx/Vivado/2020.2/settings64.sh                                    #
# $ xsct kria_bootmode.tcl sd                                                         #
#######################################################################################

# Check for arguments
if { $argc != 1 } {
    puts "The kria_bootmode.tcl script requires one argument."
    puts "$ xsct kria_bootmode.tcl sd"
    exit 2
}

# Assign list elements to variables
lassign $argv bootmode

connect
targets -set -filter {name =~ "PSU"}
stop

if {$bootmode == "jtag"} {
    puts "Switch to JTAG bootmode"
    targets -set -nocase -filter {name =~ "PSU"}
    stop
    # update multiboot to ZERO
    mwr 0xffca0010 0x0
    # change boot mode to JTAG
    mwr 0xff5e0200 0x0100
    # reset
    rst -system
} elseif {$bootmode == "sd"} {
    puts "Switch to SD1 bootmode"
    # update multiboot to ZERO
    mwr 0xffca0010 0x0
    # change boot mode to SD
    mwr 0xff5e0200 0x5100
    # reset
    rst -system

    #Sometimes A53 may be held in reset catch .. so start it with "con"
    after 2000
    con
} else {
    puts "Unsupported bootmode $bootmode"
}

puts "Done!!"
Source

To be able to boot from the SD Card, the following files must be present in the root directory of the FAT32 partition

  • BOOT.BIN
  • boot.scr
  • Image
  • rootfs.cpio.gz.u-boot
  • system.dtb

Enabling Ethernet in U-Boot on the KV260 platform

This section refers to the KV260 development platform and the TI DP83867 Ethernet PHY used on the base board.

  • In case it is not possible to communicate with the Ethernet PHY directly from U-Boot via MDIO (commands mdio and mii), the GEM can be used as a work around. This can be useful if there is a misconfiguration in the device tree.
    • The registers 0x0000000000 and 0x0000000034 of the respective PHY are of interest (0xff0e0000 and 0xff0e0034 in case of GEM3). The registers are described here

Example for reading register 0x00 of a PHY at address 0x05:

ZynqMP> mw 0xff0e0000 0x10
ZynqMP> mw 0xff0e0034 0x62820000
ZynqMP> md 0xff0e0034

  • On the KV260 board I have at hand the PHY responded to different addresses in U-Boot (0x05) and Linux (0x01). Accordingly to the hardware configuration (resistors R110 and R122 on the base board not in place) the address of the PHY should be 0x01
    • The switch of the address is a result of a hardware reset that is triggered in the boot process of the Linux Kernel, when the property reset-gpios is specified in the mdio node in the device tree
    • What exactly causes the PHY to read in a different address after the reset was not further investigated. However, the following observations were made
      • Triggering the hardware reset in U-Boot (command gpio) does not lead to a change in the address
      • Pulling the reset line low in U-Boot and releasing it in Linux causes the address to change
      • Triggering the hardware reset in Linux manually (GPIO driver) causes the address to change

  • A temporary solution is to use different device trees for building U-Boot and Linux:

U-Boot device tree entry for GEM3:

&gem3 { /* required by spec */
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gem3_default>;
	phy-handle = <&phy0>;
	phy-mode = "rgmii-id";

	mdio: mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		reset-gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
		reset-delay-us = <2>;

		phy0: ethernet-phy@5 {
			#phy-cells = <1>;
			reg = <5>;
			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
			ti,tx-internal-delay = <DP83867_RGMIIDCTL_2_75_NS>;
			ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
			ti,dp83867-rxctrl-strap-quirk;
		};
	};
};

Linux device tree entry for GEM3:

&gem3 { /* required by spec */
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gem3_default>;
	phy-handle = <&phy0>;
	phy-mode = "rgmii-id";

	mdio: mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		reset-gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
		reset-delay-us = <2>;

		phy0: ethernet-phy@1 {
			#phy-cells = <1>;
			reg = <1>;
			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
			ti,tx-internal-delay = <DP83867_RGMIIDCTL_2_75_NS>;
			ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
			ti,dp83867-rxctrl-strap-quirk;
		};
	};
};

General Findings

Firmware Update via Ethernet Recovery Tool

  • The hosted webserver is part of the PMU Firmware
    • Sources are located in pmu-firmware/lib/sw_apps/img_rcvry
  • The FWUEN button is polled in the PMU Firmware
    • The respective function GetGpioStatus can be found in pmu-firmware/lib/sw_apps/imgsel/xis_gpio.c
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r8 - 2022-04-07 - MarvinFuchs
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    SystemOnChip All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback