Write a software application with SDK


In the previous tutorial titled Creating a project using Base System Builder, we used the Embedded Development Kit (EDK) to create a hardware design composed of IP cores and a Microblaze soft processor. In this tutorial, we will complete the design by writing a software application to run on the Microblaze processor. In version 13.1, this is done using the Software Development Kit (SDK) and it is no longer “doable” in the EDK. To keep things simple, we’ll start off with a “hello world” application and then move onto one that will communicate with our peripherals. Specifically, we will read the DIP switch settings and display them on the terminal screen using printfs.

Requirements

To perform this tutorial, you will need:

  • Xilinx ISE Design Suite 13.1
  • ML50x or XUPV5 development board
  • Serial to USB converter

If you didn’t do the previous tutorial about creating an EDK hardware project, you will at least need to download the project files for your specific board and build the project in EDK. Find the project files at the end of the tutorial here.

Export the EDK project to SDK

  1. If it is not already the case, you will need to copy the EDK project files into the C:\ML509\Projects\base-system-v13-1\edk folder and build the bitstream as done in the tutorial. Note, it doesn’t have to be in C-drive and it doesn’t have to be in the ML509/Projects folder, but above this, try to use the same folder structure as we do here.
  2. Open EDK by selecting “Xilinx ISE Design Suite 13.1->EDK->Xilinx Platform Studio”.
  3. Open the base-system-v13-1 project.
  4. From the EDK menu, select “Project->Export hardware design to SDK”.
  5. In the dialog box that appears, make sure that “Include Bitstream and BMM file” is ticked and click “Export Only”.
  6. If you didn’t build the EDK project earlier, it will begin to build the bitstream which may take some time (maybe half an hour depending on your machine). After that, the project will have been exported to SDK and you can continue.

Start SDK

  1. Open SDK by selecting “Xilinx ISE Design Suite 13.1->EDK->Xilinx Software Development Kit”.
  2. The first thing you will be asked by SDK is what workspace to open.

What are SDK Workspaces?

Think of the SDK workspace as a folder where you will manage the software application(s) for one particular EDK hardware design. You can place the workspace anywhere on your machine, but I personally like to organize my projects in a folder structure as follows:

  • base-system-v13-1: 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 “base-system-v13-1” which tells me its the base system project that I made using version 13.1 of the Xilinx suite.

  1. Select C:\ML509\Projects\base-system-v13-1\sdk for your SDK workspace and click OK.
  2. SDK opens up with a welcome screen. Select “File->New->Xilinx C project”.
  3. You will then be asked to specify a hardware platform. Click “Specify”.
  4. In the dialog box that appears, type the name of the project as “base-system-v13-1” and use the browse button to navigate to the base-system-v13-1/edk/SDK/SDK_Export/hw/system.xml file. This file was created by EDK when we exported the project to SDK. If you cannot find this file, close SDK, open EDK and re-perform the “Export to SDK” step.
  5. Click Finish.
  6. The wizard that follows will allow us to create a template software application for our project. The default is the “hello world” example and we want to start with this one. Click Next to accept the defaults as shown in the image below.
  7. Click Finish to accept the defaults of the second page.
  8. If you did everything correctly, you should have the SDK window looking like the image below.

Load the FPGA with the bitstream

  1. Turn on your hardware platform (ML50x or XUPV5 or whatever you have).
  2. Connect the Serial to USB device to your board’s RS232 port and your computer’s USB port.
  3. Open your terminal program (eg. Hyperterminal or Putty) and connect to the COM port that corresponds to your Serial to USB device.
  4. From the SDK menu, select “Xilinx Tools->Program FPGA”.
  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 above and click Program.

Run the Software Application

  1. From the SDK menu, select “Run->Run”.
  2. In the “Run As” dialog box, select “Launch on Hardware”.
  3. SDK will build the software application, load it into the memory on the FPGA and trigger the Microblaze to run the code. You should see the words “Hello World” written in your terminal window.

In the following tutorial, we will modify the template software application so that it reads from the DIP switch IP core to obtain the switch values and display them in the terminal window using printfs.