Zynq-7000 AP SoC Low Power Techniques part 7 - Ubuntu Application Control of Processing System - Frequency Scaling & More Tech Tip
This page is deprecated and is no longer being updated. The content is being retained for reference. For more information about running Ubuntu on Zynq UltraScale+ MPSoC, please refer to Canonical Ubuntu
|Date||Version||Author||Description of Revisions|
|06-April-2014||1.0||chandramohan pujari||Initial Revision|
1. IntroductionThis tech tip is an extension to the Zynq-7000 AP SoC Low Power Techniques part 1 - Installing and Running the Power Demo Tech Tip.The Zynq Power Demo is capable of running Ubuntu and performs power measurements while running different applications. The Zynq Power Demo can switch its operation from normal mode to Ubuntu mode from the Host GUI Application.
This tech tip provides a brief introduction to the process involved in bringing up the Ubuntu Desktop and measuring power while running Mandelbrot set and Free Doom Ubuntu applications on Zynq-7000 AP SoC.
|Design Type||PS + PL|
|CPUs||2 ARM Cortex-A9|
|Xilinx Tools Version||Vivado 2013.4|
|Board||ZC702 Rev 1.0|
|Zynq7000AP_SOC_UbuntuApplicationforPS.zip||See Appendix B for the descriptions of the files|
3. Building Ubuntu Desktop and Operational details:
3.1 Building Ubuntu Desktop:Detailed procedure and pre-requisites for building and running Ubuntu desktop on Zynq-7000 AP SoC is explained in the “Zynq-7000 AP SoC Ubuntu Desktop on Peta Linux Tech Tip”. To briefly summarize the process involved in Building Ubuntu desktop, user needs to go through the following steps.
- Generating Hardware design
In order to support HDMI Display for Ubuntu Gnome (unity), the hardware design reference was leveraged from Zynq Base TRD (Target Reference Design) which implements a Xylon graphics Controller IP for HDMI display.The process of generating the RTL and other parts hardware design can be found at http://www.wiki.xilinx.com/Zynq+Base+TRD+2013.2
- Generating Linux Images
The software to support the generated hardware design was based on the Zynq Base TRD with few minor changes. The software customization for Linux kernel images and device tree are explained in the Ubuntu Desktop referred in the above tech tip.
- Porting Ubuntu root file system.
In order use Ubuntu root file system, The SD card needs to be partitioned, in to two. First, a FAT Partition to hold linux kernel,PL bit-stream, device tree and other user data, second an ext3 partition to hold contents of Ubuntu root file system. The step by step of partitioning SD card and writing the contents of root file system to ext3 partition is explained in the “Zynq-7000 AP SoC Ubuntu Desktop on Peta Linux Tech Tip”.
User is free to install any application which he/she wishes to run on the desktop however in our design example we have chosen “Mandelbrot set” a fractal viewer, an application rich in graphics and a simple dos based Game “free doom” as loads to be run loading the PL logic and the CPU.
3.2 Operational details:
The UI of the power demo is shown below in Figure 1.0.
- Figure 1.0: C# based Power Demo UI.
In order to operate in Ubuntu Mode user should select the Ubuntu check box as present under configuration pane on left side of the UI. The selection from UI would inform the application running in the back end using a specified protocol to boot the system in Ubuntu mode. Based on the configuration action selection by user, the application running in the back end issues a reboot signal to the device, restarting the whole system to boot in Ubuntu mode. Further technical details on protocol implementation and rest of the process involved to boot Ubuntu desktop is explained in “Zynq Power: How to reboot to a second boot image and bit-stream from Linux” tech tip. Here are few quick steps to be followed to boot the zynq device in Ubuntu mode.
- Click on the Ubuntu check box in GUI, to run the Ubuntu desktop.
- Wait for the system to reboot and to display Ubuntu Desktop on the connected Display.
- Upon successful boot, “Apply” button on the extreme right corner in Demo configuration pane gets highlighted.
- To start with, select CPU idle as an initial CPU load and Click on “Apply” button.
- This process will initiate the application running in the background on the target Zynq device to read the power rails and power consumed by different sections such as DDR, PS, and PL and updates it to UI for display. The protocol used to communicate between the Linux application and UI is explained in “Zynq Power: Communication between Host machine and Target board” Tech Tip.
- The values captured are processed and represented graphically in Demo status window.
- The same process can be continued by selecting different CPU load options.
- If user prefers to switch back to normal mode, he/she is supposed to unchecked the Ubuntu check box.
- Upon booting in Ubuntu Mode, a standard Ubuntu desktop display with few application icons on the desktop are displayed.Further user is free to launch the applications either manually or through UI to measure the power consumed during these operations.
- In this Ubuntu desktop application, by default screen saver power saving feature during idle condition is enabled. So after every 10 minutes of idle period, screen gets locks automatically. To unlock it, provide password as “root”.
- To disable the screen saver power saving feature, open terminal in Ubuntu desktop and execute following command.
- “gsettings set org.gnome.desktop.lockdown disable-lock-screen ‘true’ ”
3.3 Impact of running various Ubuntu applications on PowerUpon booting in Ubuntu Mode, a standard Ubuntu desktop display with few application icons on the desktop are displayed. Further user is free to launch the applications either manually or through UI to measure the power consumed during these operations. This section intends to brief about the impact on power consumption when applications such as Mandelbrot set turned on. In order to understand the power consumed by any application it is suggested to understand and characterize the application. Here a small overview of Mandelbrot set and its impact on CPU power.
The Mandelbrot set is a mathematical set of points whose boundary is a distinctive and easily recognizable two-dimensional fractal shape. Mandelbrot set images are made by sampling complex numbers and determining for each whether the result tends towards infinity when a particular mathematical operation is iterated on it.Treating the real and imaginary parts of each number as image coordinates, pixels are colored according to how rapidly the sequence diverges, if at all. A repeating calculation is performed for each x, y point in the plot area and based on the behavior of that calculation, a color is chosen for that pixel.
As explained above, this application has large number of computations involved which leverages the power of CPU to complete the computation thus utilizing the CPU to the maximum extent. This is to say in the current context that whenever Mandelbrot set application is launched, the CPU utilization would be at peak. Since we have two CPU’s we can see that at least one of the CPU is utilized 100% and the same would be graphically represented in status pane. Similarly every time a calculation is done by the application, colored pixels are rendered on to the display, utilizing the I/O transfers, frame buffer IP present in the PL logic thus driving the total power consumed to a big number. As can be understood by this example the total power consumed by a device is directly dependent on the kind of application being executed and logic involved such as CPU calculations, I/O transfers, PL logic etc.
Appendix A: Building power demo Linux application work-space
Design files are provided along with this tech tip which contains SDK work-space for power demo Linux application for ubuntu demo. One can import the provided work space to Xilinx SDK and can modify the Linux application according to ones requirements. For importing work space to SDK tool, refer section “Building the first stage boot loader (FSBL)” in the following link http://www.wiki.xilinx.com/Zynq+Base+TRD+2013.4.
Appendix B: File Descriptions in Ubuntu_Demo_Application directory
Directory Structure is
- contains Zynq Power demo Linux workspace for ubuntu demo