Typical Power States for 2020.2 (ZU+ and Versal)

This tutorial explains procedure to measure transition times and respected power values when either PS or PL suspends or wake up. By following below procedure, user can see/measure the suspend/wake-up time and power. These procedures are for 2020.2 and later releases.

Table of Contents

Different power states and measure transition time

Workloads on each domain

  • PLD: Petalinux prebuilt design which does not contain any specific logic

  • FPD: APU is running Linux script which controls PLD on/off and handshakes RPU for self suspend/off/resume

  • LPD: RPU is running baremetal application which controls FPD domain on/off

Prebuilt binaries for reference

For ZynqMP

For Versal

To generate binaries on your own please refer below steps for generating required images/binaries.

Generating required images/binaries

Steps to build Linux images

Create petalinux project

  • Run below commands from bash terminal to create petalinux project.

    1 2 source <petalinux-install-dir>/settings.sh petalinux-create -t project -s <xilinx zcu102/vck190 BSP location>

Build petalinux

  • Add apu_script.sh in rootfs of petalinux

    • Use below command to create and enable custom petalinux application

      1 2 petalinux-config --silentconfig petalinux-create -t apps --template install --name myapp --enable
    • Copy apu_script.sh (Use versal_apu_script.sh for versal and zynqmp_apu_script.sh for zyqmp and rename it to apu_script.sh) to myapp folder

      1 cp <dow_dir>/apu_script.sh <petalinux_proj_dir>/project-spec/meta-user/recipes-apps/myapp/files/
    • Update myapp.bb (located at project-spec/meta-user/recipes-apps/myapp/) as shown below

      1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 # # This file is the myapp recipe. # SUMMARY = "Simple myapp application" SECTION = "PETALINUX/apps" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI = "file://myapp \ file://apu_script.sh \ " S = "${WORKDIR}" CFLAGS_prepend = "-I ${S}/include" do_install() { echo "D: ${D}" echo "S: ${S}" install -d ${D}${bindir} install -m 0755 ${S}/myapp ${D}${bindir} install -m 0755 ${S}/apu_script.sh ${D}${bindir} }
  • Enable ECC  in FSBL code (applicable only for ZynqMP):

    • Create directory <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/files/ (if not present)

    • Copy patch file to <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/files/ (Patch attached here: ecc_fsbl.patch)

    • Open file <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/fsbl_%.bbappend (create if not present)

    • Add below lines in file:

      1 2 FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += " file://ecc_fsbl.patch"
  • Now build petalinux using below command

    1 petalinux-build

Steps to build RPU baremetal

  • Open Vitis and start with empty application as shown below

  • Select “create a new hardware platform“ and select petalinux prebuilt XSA file as shown below (uncheck generate boot components option in case of ZynqMP)

  • Select target processor as "psu_cortexr5_0" and give the application name (ex. rpu_app)

  • Click next and leave all options unchanged

  • Click next and select "Empty Application" from the template list

  • Click finish which will show the project window as shown below

  • Now click on "Navigate to BSP" settings and click "Modify BSP settings"

  • Now select the "xilpm" library option as shown below.

  • Select psu_cortexr5_0 and add “-DDEBUG_MODE“ in extra_compiler_flags as shown below and click ok.

  • Right click on "rpu_app" from explorer and select "import sources" option

  • Download rpu_src.tar and extract it to local folder

  • Select the source and target path as shown below and click ok

  • Right click on "rpu_app" from explorer and select "build project"

Steps to build BOOT.BIN

For ZynqMP

  • Create a new folder and copy pmufw.elf, zynqmp_fsbl.elf, bl31.elf, u-boot.elf and system.bit from petalinux generated images (present at <plnx-proj-root>/images/linux/).

  • Create RPU_0 application rpu_app.elf from Vitis as described in above section and copy rpu_app.elf into same new folder.

  • Create boot.bif file in same folder as shown below.

    1 2 3 4 5 6 7 8 9 the_ROM_image: { [bootloader, destination_cpu=a53-0] zynqmp_fsbl.elf [pmufw_image] pmufw.elf [destination_device = pl] system.bit [destination_cpu=r5-0] rpu_app.elf [destination_cpu=a53-0,exception_level=el-3,trustzone] bl31.elf [destination_cpu=a53-0,exception_level=el-2] u-boot.elf }
  • Create BOOT.BIN file using following command.

    1 bootgen -arch zynqmp -image boot.bif -w -o BOOT.BIN

For Versal

  • Create a new folder and copy plm.elf, psmfw.elf, bl31.elf, u-boot.elf and system.dtb from petalinux generated images (present at <plnx-proj-root>/images/linux/).

  • Copy CDO files (fpd_data.cdo, lpd_data.cdo, project_1.rcdo and project_1.rnpi) present in <plnx-proj-root>/hardware to same new folder.

  • Also copy pmc_data.cdo and topology_xcvc1902.v2.cdo CDOs to same new folder.

  • Create RPU_0 application rpu_app.elf from Vitis as described in above section and copy rpu_app.elf into same new folder.

  • Copy boot.bif (use boot_vck190_es1.bif for vck190 es1, boot_vck190_prod.bif for vck190 prod, boot_vmk180_prod.bif for vmk180 prod and boot_vmk180_es1.bif for vmk180 es1) to same folder and use below command to create BOOT.BIN

    1 bootgen -arch versal -image boot.bif -w -o BOOT.BIN

Steps to run the images

Boot Linux with RPU

  • Create a boot partition in SD card and copy BOOT.BIN, boot.scr and image.ub file (present at <plnx-proj-root>/images/linux/) to boot partition.

  • Boot the board (ZCU102 in case of ZynqMP and VCK190 in case of Versal) in SD boot mode.

  • Uboot will automatically take the image.ub from SD partition and boot the linux

  • Give username and password as “root”

Measure the power and transition times

  • Use Power Advantage tool for measuring power values.

Start the demo

  • Copy apu_script.sh file from /usr/bin/ and run the script as shown below

    1 2 root@xilinx-zcu102-2020_2:~# cp /usr/bin/apu_script.sh . root@xilinx-zcu102-2020_2:~# ./apu_script.sh

    Note: User can open the script and edit the below parameters as per his convenient before running script
    DelayVal : Amount of delay between 2 power modes (should be between 10 to 255 seconds)
    IterationCnt: Total looping count to measure different APU power states latency (should be between 0 to 5

  • Triggering the script starts the demo and it will switch the transition from one state to next dimer state after specific amount of time (default 30 seconds)

  • User can measure the power readings using power advantage tool between intervals

  • Latency measurement values is shown as per below window

    1 2 3 4 5 6 Request Suspend Latency of Linux in micro seconds: Min: 225031, Max: 225031, Avg: 225031 FPD OFF Latency in micro seconds: Min: 2799, Max: 2799, Avg: 2799 FPD ON Latency in micro seconds: Min: 123980, Max: 123980, Avg: 123980 Wakeup Latency of APU0 in micro seconds: Min: 4204, Max: 4204, Avg: 4204 Wakeup Latency of Linux in micro seconds: Min: 2442820, Max: 2442820, Avg: 2442820 Latency Measurement Done
  • Once system reaches to lowest power state, it will starts reverting back to original (normal) power state as shown below

    1 2 3 4 5 6 7 8 9 10 11 12 ******************* RPU Suspended, APU suspended with FPD OFF ******************* (1 seconds delay) XPm_ReleaseNode(21, 0, 0, 0, 0, 0) XPm_ClientSuspendFinalize: Disabling RPU L▒RPU0: Running in Split mode XPm_RequestNode(21, 1, 0, 2, 0, 0) RESUMED RtcIrqHandler RTC interrupt received Alarm generated. *********************** RPU ON, APU suspended with FPD OFF ********************** XPm_RequestNode(1C, 1, 0, 2, 0, 0) XPm_NotifyCb (10, 1, 1) *********************** RPU ON, APU suspended with FPD ON ***********************
  • At the end, it will show below completion message (Full log is attached to pre-built images section)

    1 2 3 4 5 6 7 8 9 10 11 *********************** APU, RPU full load, PL is OFF ********************** Delay 30 seconds Latency to Power ON PL domain Powering up PL XPm_RequestNode(45, 1, 0, 2, 0, 0) *********************** APU, RPU and PL in high power *************************** Delay 30 seconds PL ON Latency in micro seconds: 58751 Demo application is completed successfully!
  • User can re-trigger the apu_script.sh to re-run the demo again.

Related Links