Create an application using the Xilinx SDK

In the previous tutorial titled Creating a project using Base System Builder, we used Xilinx Platform Studio (EDK) to create a hardware design (bitstream) for the Zynq SoC. In this tutorial, we will complete the design by writing a software application to run on the ARM processor which is embedded in the Zynq SoC. Using the Xilinx SDK, we’ll create a simple application that will send the words “hello world” out of the serial port and into your PC serial console. In the next tutorials, we’ll write some applications that will interact with the peripherals we defined in the EDK project.


To perform this tutorial, you will need:

  • Xilinx ISE Design Suite 14.7
  • ZC706 evaluation board
  • Some kind of serial console program such as Putty or Miniterm

If you didn’t do the previous tutorial about creating an EDK hardware project, you’ll at least need to download the project files and build the project in EDK. The files are available on Github at the link below:

Export the EDK project to SDK

  1. Open EDK by selecting “Xilinx Design Tools->ISE Design Suite 14.7->EDK->Xilinx Platform Studio”.
  2. Open the zc706-bsb project.
  3. Click “Export Design”.sdk_app_basic_0006
  4. Click “Export and Launch SDK”.sdk_app_basic_0007
  5. If you didn’t generate the bitstream earlier, EDK will generate the bitstream before exporting the design to SDK.

Software Development Kit

  1. The SDK should automatically open after the design is exported.
  2. The Xilinx SDK is built on the Eclipse SDK so it also uses the concept of workspaces. When the SDK starts up, it will ask you which workspace to open.

What are SDK Workspaces?

An SDK workspace is a folder where you can manage multiple software application(s) for one or more EDK hardware designs. People have different ways of managing their software projects, but I generally like to have one SDK workspace for each EDK project. You can place the workspace anywhere on your machine, but I personally like to organize my projects in a folder structure as follows:

  • zc706-bsb: The high-level folder that uses the name of my project.
    • EDK: The sub-folder with my EDK project files.
    • SDK: The sub-folder with my SDK project files.

In the example above, my project name is “zc706-bsb”. So if you want to follow my way of doing things, create a folder named “SDK” within the “zc706-bsb” project folder (if you downloaded the project files from Github, the SDK folder should already be there). This folder will be your SDK workspace for this tutorial.

  1. Select the SDK sub-folder for your SDK workspace and click OK. As I generally have multiple projects and thus multiple SDK workspaces, I don’t tick the option “Use this as the default and do not ask again” because I want SDK to ask me which workspace to open every time.sdk_app_basic_0008
  2. SDK opens up with a welcome screen that should look like the following image. sdk_app_basic_0009
  3. Select “File->New->Application project”.sdk_app_basic_0010
  4. In the dialog box that appears, type the name of the project as hello_world and click “Next”. sdk_app_basic_0011
  5. We’re now asked if we would like to use a template for the application. Select the “hello world” template and click “Finish”.sdk_app_basic_0012
  6. The SDK will now build the hello_world application and the hello_world BSP (board support package). When it is finished, your Project Explorer should look like the image below.sdk_app_basic_0013

At this point, I suggest you have a poke around in the files that the SDK has created for you. For starters, open the helloworld.c file and have a look at the code we’ll be running. Have a look at the linker script file lscript.ld to see where your code, stack and heap memory will be placed. You can also checkout the files in the hello_world_bsp board support package which is basically a collection of libraries that you can use in your application to take advantage of various peripherals and features of the Zynq. Some of the libraries include USB, watchdog timer, I2C, GPIO, Ethernet MAC and XADC.

You’re now ready to run the application on the ZC706 evaluation board.

Load the FPGA with the bitstream

  1. Turn on your hardware platform (ZC706 or whatever you are using).
  2. Connect a USB cable from your board’s UART port (J21 on the ZC706) to your computer’s USB port.
  3. Open your terminal program (eg. Putty or Miniterm) and connect to the COM port that corresponds to your UART over USB device. Make sure the port settings are 115200 baud, 8-bits, no parity, 1 stop bit.
  4. From the SDK menu, select “Xilinx Tools->Program FPGA”.sdk_app_basic_0014
  5. In the “Program FPGA” dialog box, the defaults should already specify the correct bitstream for the hardware project. Make sure they correspond to the image below and click Program.sdk_app_basic_0015

The Zynq will then be programmed with the bitstream and the console window should give you the message: FPGA configured successfully with bitstream `E:/Github/fpgadeveloper/zc706-bsb/SDK/EDK_hw_platform/system.bit`

Run the Software Application

  1. First make sure that the hello world application is selected in the Project Explorer, then select “Run->Run” or click the icon with the green play symbol in the toolbar.sdk_app_basic_0016
  2. In the “Run As” dialog box, select “Launch on Hardware” and click OK.sdk_app_basic_0017
  3. SDK will then program the Zynq with the hello world application and run it. You should see the words “Hello World” written in your terminal window.sdk_app_basic_0018

What now?

Now you can try experimenting by modifying the code to do other things. Even though we didn’t place many peripherals in our EDK project, the Zynq is packed with a lot of fixed peripherals that the Base System Builder setup for us. If you want to try out some of these peripherals on your own, just checkout some of the example applications that Xilinx provides in the install folder. \Xilinx\14.7\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers In this folder you’ll find more examples than you’ll ever have time to try. Good luck!


See also