EDK Platform Studio Tutorial


Learning Objectives

  1. Learn the basics of the EDK.
  2. Learn how to create an EDK project.
  3. Learn how to add OPB peripherals to the project.
  4. Learn how to create a system.c.
  5. Learn how to build and download your project onto the FPGA.

Learning Resources

  1. Course lectures.
  2. EDK documentation (located in C:\EDK\Docs)

Tutorial Overview

    This tutorial will walk you through setting up an EDK/Platform Studio project and then downloading the resulting bit files onto the FPGA. Using the EDK, you will create a new project, add any IP cores, then add and configure busses. Any peripherals you included in your project will also need to be configured. You will then create the required files including your system.c which includes the C code which will be run on the Microblaze. If you are familiar with the tools, the quick steps should be sufficient to get you going. If you are new to the tools, you should follow the detailed steps.

The Tutorial Quick Steps

  1. Start the EDK.
  2. Create a new project.
  3. Add IP Cores.
  4. Configure components and peripherals
    1. Set base addresses for lmb.
    2. Set base addresses for opb.
    3. Add and configure busses.
    4. Create system.ucf.
    5. Create download.cmd.
    6. Configure ports.
    7. Set peripheral options.
    8. Configure STDIN and STDOUT.
    9. Configure debug options.
  5. Create System.c.
  6. Build and download your project.

The Tutorial Detailed Steps

  1. Start the EDK.
    On the desktop, double the EDK icon. When the EDK starts, a "Xilinx Platform Studio" Window will appear.

  2. To create a new EDK project:
    1. Select "Blank XPS Project", and click OK. A "Create New Project" window will appear.
    2. Click the "Browse" button next to "Project File" edit box and go to Z:
      Right click in the "XPS Project Files" window and select New -> Folder
      Rename the folder to EDKexample. Double click it and press open TWICE.
      (Once to open the folder, and once to dismiss the dialog box)
      The "Project File" edit box should now read Z:\EDKexample\system.xmp.
    3. In the Create New Project dialog box, make sure the target device is as follows:
    4. Click OK.
    5. Click Yes when prompted to start with an empty MHS file.
    6. Click OK when prompted to add IPs to your project.

  3. Configure the hardware for your design.
    1. On the menu bar go to Project -> "Add/Edit cores ... (dialog)"
      The "Add/Edit Hardware Platform Specifications" dialog box, will appear
    2. Add your peripherals.
      1. Select the "Peripherals" tab.
      2. Make sure the "Show All" radio button is selected.
      3. Add a bram block. (Click it in the right pane, then click "<< Add")
      4. Add two lmb_bram_if_cntrl components.
      5. Add a microblaze.
      6. Add an opb_mdm.
      7. Add an opb_uartlite.
      8. When finished, the "Peripherals" tab should appear as follows:
    3. Create your busses, and connect your peripherals to them.
      1. Select the "Bus Connectons" tab.
      2. Add two LMB busses (lmb_v10_v1_00_a).
      3. Add one OPB bus (opb_v20_v1_10_c).
      4. Attach each of the peripheral's ports to their appropriate uses as either a master or slave in the grid on the left hand side.
      5. Set up the BRAM ports and connectors on the right hand side.
      6. When finished, the Bus Connections tab should appear as follows:
    4. Set the addresses of the peripherals.
      1. Select the "Addresses" tab.
      2. Enter the base addresses, and sizes for each peripheral.
      3. When finished, the "Addresses" tab should appear as follows:
      4. Create a system.ucf file.
        1. Using the windows file explorer, go to your project directory.
        2. Open the Data directory.
        3. Right click anywhere in the Data directory.
        4. Select New->UCF File.
        5. Rename the new file to system.ucf
        6. Edit the file - uncomment following lines:
          1. NET "Clk50Mhz" LOC = "T9";
          2. NET "Clk50Mhz" PERIOD = 20ns; # 20ns = 50Mhz
          3. NET "BTN0" LOC = "M13";
          4. NET "RXD" LOC = "T13";
          5. NET "TXD" LOC = "R13";
        7. Save changes and exit the editor.
      5. Create a download.cmd file.
        1. Go up one level and down into the etc directory (in your project dir).
        2. Right click in the etc directory.
        3. Select New->Impact CMD file.
        4. Rename the new file to download.cmd
    5. Configure the ports.
      1. Switch back to platform studio.
      2. Select the "Ports" tab.
      3. For the obp_uartlite_0, do the following:
        1. Add RX
        2. Add TX
        3. Rename RX Net Name to RXD.
        4. Rename TX Net Name to TXD.
      4. For the lmb_v10_0, do the following:
        1. Add LMB_Clk
        2. Add SYS_Rst
        3. Rename LMB_Clk Net Name to Clk50Mhz.
        4. Rename SYS_Rst Net Name to BTN0.
      5. For the lmb_v10_1, do the following:
        1. Add LMB_Clk
        2. Add SYS_Rst
        3. Rename LMB_Clk Net Name to Clk50Mhz.
        4. Rename SYS_Rst Net Name to BTN0.
      6. For the opb_v20_0, do the following:
        1. Add OPB_Clk
        2. Add SYS_Rst
        3. Rename OPB_Clk Net Name to Clk50Mhz.
        4. Rename SYS_Rst Net Name to BTN0.
      7. Select the RXD Net and click "Make External".
      8. Select the TXD Net and click "Make External".
      9. Select one of the Clk50Mhz nets (any of the three) and click "Make External".
      10. Select one of the BTN0 nests and click "Make External".
      11. When finished, the ports tab should appear as follows:

    6. Set peripheral parameters.
      1. Select the "Parameters" tab.
      2. Select opb_uartlite_0 in the Choose IP Instance drop down box.
        1. Select C_CLK_FREQ then click add.
        2. Select C_USE_PARITY then click add.
        3. Change C_CLK_FREQ to 50_000_000.
        4. Change C_USE_PARITY to 0
      3. Select microblaze_0 in the Choose IP Instance drop down box.
        1. Select C_DEBUG_ENABLED then click add.
        2. Select C_NUMBER_OF_PC_BRK then click add.
        3. Change C_DEBUG_ENABLED to 1.
        4. Change C_NUMBER_OF_PC_BRK to 5.
    7. Click the OK button on bottom of the "Add/Edit Hardware Platform Specifications" dialog box.
  4. Create the Project Software
    1. Configure STDOUT and debug settings of the microblaze.
    2. In the left hand window pane of the XPS application, make sure the System tab is selected.
    3. Right click microblaze_0 and select "Software Platform Settings...".
      The "Software Platform Settings" will appear.
    4. Select "the Library/OS Parameters" tab.
    5. Set STDOUT to opb_uartlite_0.
    6. The Library/OS parameters tab should appear as follows:

    7. Click OK.
  5. Create System.c.
    1. In the windows explorer, go to the top level directory of your project, create a system.c file.
      Remember that:
      • You need to include the xparameters.h file
      • You shouldnt not use printf (it is too big)
        Instead, use the print() and putnum() functions.
    2. Add your system.c file to the project.
      1. Go back to project navigator.
      2. Select Project->Add Software Application Project
      3. In the Add SW Application window
      4. Set the Project Name to HelloWorld, and leave processor set to microblaze_0.
        (NOTE: You cannot have spaces in the project name)
      5. Click the OK button.
      6. In the left hand window pane of the XPS application, make sure the Applications tab is selected.
      7. Double click "Sources".
      8. Select your newly created system.c file.
      9. Click the open button.

  6. Build and download your project.
    1. On the desktop click the Board_UART.ht icon:
      This will open a HyperTerminal window.
    2. In platform studio click the download button on the toolbar:
    3. This will compile and download your project to the Xilinx board.
      Once downloaded, output should appear in the HyperTerminal window.
  7. Using the GDB debugger.
    1. In platform studio click the Run XMD icon
      Reply OK to debug settings
      Reply Save to select options.
    2. In platform studio click the debug icon
    3. This will create a gdb window.
      Click run icon, set breakpoints etc., click continue etc.
    4. On exit, close gdb and XMP windows

Created: June 10, 2004
Last modified: Oct 21, 2005