你的位置:EETOP 赛灵思(Xilinx) 社区 >> >> 全部 >> 详细内容

Adam Taylor玩转MicroZed系列第86部分: SDSoC之二:让 SDSoC 转起来

发布者:jackzhang 时间:2015-06-24 16:47:43

 

By Adam Taylor

 

 

Having looked introduced SDSoC in the last column, it’s now time to start working on how we get SDSoC up and running with a first example. We are going to be using the ZedBoard for this. As always, we will go more or less step by step with description as we do.

 

The first thing we need to do is create a new project. We can do this from either the welcome screen, shown below, or by selecting File -> New -> SDSoC project from the menu.

 

 

Image1.jpg

 

 

Selecting this will open a dialog box that allows us to name the project, and select the board, and select the operating system as seen below.

 

One great thing about SDSoC is that unlike the traditional SDK approach—where we need to define a BSP, HW description and FSBL—with SDSoC we do not need to do this because SDSoC already knows what these are for the selected target. (We will address bespoke SW platforms later.)

 

 

Image2.jpg

 

 

Selection of the ZedBoard

 

 

 

Image3.jpg

 

 

Selection of the operating system

 

 

 

For this example, we will be using the Linux operating system. However on the journey through the SDSoC tools, we will of course be examining the standalone and FreeRTOS options as well.

 

The next tab allows us to select the demo application. Initially, we are going to run within the PS (processor system) side of the Zynq SoC. We’ll characterize the code and then move it to the PL (programmable logic). In this case, select the Matrix Multiplier and Addition template as shown below:

 

 

Image4.jpg

 

 

 

This will create a project under the Project Explorer on the left-hand side of the SDSoC GUI. Under this project you will see the following:

 

  • SDSoC hardware functions –this is where you will see the functions we have moved into the hardware. We have not done so at this point so you will see nothing underneath this, yet.
  • Includes – Expanding this will show all of the C/C++ header files used in the build. We will be looking at this in a lot of detail in future blogs on this topic.
  • Src – The source code for the demonstration.

 

The next step to ensure we have everything correctly configured with not only our SDSoC installation and environment but also our development board is to build the demo so that it will run on the PS side of the device.

 

 

Before we do this we must set the correct build configuration. With the project selected in the project explorer, right click and select Build Configurations -> Set Active -> SDRelease. Then, with the project still selected on the menu, select Project -> Build Project. The build should not take too long. When it completes, you will see the following appear under the Project within the project Explorer:

 

 

 Image5.jpg

 

 

 

  • Binaries – Under here you will find the Extensible Linker File (ELF) files created from the software compilation process.
  • Archives – Under here you will find the object files, which are linked to create the binaries.
  • SDRRelease – This contains your boot files and will not be present until do a build.

 

Now we’ve built the first demo, which runs only on the Zynq PS. At this point I need to explain how we know it’s working. If you remember in the first blog, I told you that SDSoC worked by profiling the application and then using profiled information to determine which functions to move.

 

How we achieve this at the basic level is by using a provided library called sds_lib.h. This library provides a basic time-stamp API that enables us to measure how long functions take based on a 64-bit global counter. This API enables us to easily determine the execution time taken by a function. We simply record the start and stop time and the difference is the process execution time.

 

There are two versions of an algorithm in this demo, which performs a matrix multiply and addition. The first version is called the golden version and is not intended for offloading to the PL. The second version is.

 

Building and running these applications just within the PS allows us to ensure that we are comparing eggs with eggs and that both processes take roughly the same time to execute. Otherwise it’s an unfair comparison.

 

With the build complete, we copy all of the files under the SDRelease -> sd_card folder under the project explorer onto an SD card and insert it into the ZedBoard. With a terminal program connected to the ZedBoard and the boot sequence completed, you need to run the program. You do this by typing in:

 

/mnt/mult_add.elf

(where mult_add is the name of the project you created)

 

When I ran this on my Zed board I obtained the following result, which shows that both functions take roughly the same amount of time to execute:

 

 

Image6.jpg

 

 

Execution time for both functions running in the Zynq SoC’s PS

 

 

In the next blog we will look at how we can reduce the function’s execution time by more than 70%. You will be amazed by how easily we will do this.

 

 

 

 MicroZed Chronicles.jpg

 

 

 

Now, you can have convenient, low-cost Kindle access to the first year of Adam Taylor’s MicroZed Chronicles for a mere $7.50. Click here.

 

最新课程

  • 深入浅出玩儿转FPGA

    本视频基于Xilinx公司的Artix-7FPGA器件以及各种丰富的入门和进阶外设,提供了一些典型的工程实例,帮助读者从FPGA基础知识、逻辑设计概念

  • 从零开始大战FPGA基础篇

    本课程为“从零开始大战FPGA”系列课程的基础篇。课程通俗易懂、逻辑性强、示例丰富,课程中尤其强调在设计过程中对“时序”和“逻辑”的把控,以及硬件描述语言与硬件电路相对应的“

  • Verilog基础及典型数字

    课程中首先会给大家讲解在企业中一般数字电路从算法到流片这整个过程中会涉及到哪些流程,都分别使用什么工具,以及其中每个流程都分别做了