create a project using the base system builder in edk10

Upload: nharsoor0488509

Post on 07-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    1/17

    Search

    Create a Project Using the BaseSystem Builder in EDK10-1Tutorial Overview

    In this example, we will develop a simple FPGA project using the Base System Builder that includes three

    peripherals: the RS232 UART and two GPIOs. One GPIO will be used for the DIP switches and the other for

    the LEDs. We will then use a C program to read data from the switches and write it to the LEDs. The result is

    that the LEDs will display the DIP switch settings.

    This tutorial contains screenshots to guide you through the entire implementation process. Click on the images

    to view a higher resolution.

    What you will learn

    By following this example, you will learn:

    1. How to create an EDK project with the Base System Builder

    2. How to add a software application to an EDK project

    3. How to implement and test your design

    Requirements

    Before following this tutorial, you will need to do the following:

    Buy an ML505/ML506/ML507 or XUPV5 board if you don't already have one. Xilinx supplies the

    ML50x boards, but the best deal is the XUPV5 from Digilent. Click the Digilent link for more

    information.

    Create the Basic Project

    Follow these steps to create the basic project:

    1. Open XPS. From the dialog box, select "Base System Builder wizard" and OK.

    http://www.fpgadeveloper.com/2008/10/create-project-using-base-system.htmlhttp://www.fpgadeveloper.com/2008/10/create-project-using-base-system.htmlhttp://www.fpgadeveloper.com/2008/10/create-project-using-base-system.htmlhttp://www.fpgadeveloper.com/2008/10/create-project-using-base-system.html
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    2/17

    2. You will be asked to specify which folder to place the project. Click "Browse" and create a new folder

    for the project. Click "OK".

    3. We are given the choice to create a new project or to create one using the template of another project.

    Tick "I would like to create a new design" and click "Next".

    4. On the "Select Board" page, select "Xilinx" as the board vendor. Then select the board you are using

    (eg. "Virtex 5 ML505 Evaluation Platform"). Select "1" as the board revision. Click "Next". (Note: If you

    are using the XUPV5 (ML509) board, you might find that it is not listed. Select "Virtex 5 ML505

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb1.JPGhttp://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb1.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    3/17

    Evaluation Platform" instead.)

    5. On the "Select Processor" page, we normally have a choice between using the PowerPC "hard"

    processor, or the Microblaze "soft" processor. Since the Virtex-5 does not contain any PowerPCs, we

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb2.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    4/17

    can only select Microblaze. Click "Next".

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb3.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    5/17

    6. On the "Configure Microblaze" page, select the clock frequency to be 125MHz. We will use the RS232

    port for debugging rather than the JTAG, so select "No debug". Click "Next".

    7. In selecting the Additional IO Interfaces, leave "RS232_Uart_1", "LEDs_8Bit" and "DIP_Switches_8Bit"

    ticked and un-tick everything else.

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb4.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    6/17

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb5.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    7/17

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb6.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    8/17

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb7.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    9/17

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb8.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    10/17

    8. On the "Add Internal Peripherals" page, click "Next".

    9. On the "Software Setup" page, select "RS232_Uart_1" for both STDIN and STDOUT. The Base

    System Builder can produce sample software applications to run on the Microblaze and test the

    memory and peripherals. For this project we will not need them as we will create our own. Un-tick

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb9.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    11/17

    "Memory Test" and "Peripheral Test". Click "Next".

    10. Click "Generate".

    11. Click "Finish".

    12. If you are using the XUPV5 (ML509) board and you selected "Virtex 5 ML505 Evaluation Platform" in

    step 4 above, you must select the right Virtex-5 version in the project settings. Select "Project->Project

    Options" and set the Virtex-5 version to "XC5VLX110T", package "FFG1136" and speed grade "-1".

    Create a Simple Application

    Now that the basic project is made, we can create a simple software application to run on the Microblaze to test

    the DIP switches and LEDs.

    1. Select the Applications tab. You will see a software application already there called "Default:

    microblaze_0_bootloop". The purpose of this application is to occupy the Microblaze in the case that

    there is no other software application in the design. It simply keeps the Microblaze running in an

    endless loop.

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/bsb10.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    12/17

    2. Double click "Add Software Application".

    3. For the project name type "TestApp". For the processor select "microblaze_0". Click "OK".

    4. From the Applications tab, right click on the software application "Default: microblaze_0_bootloop" and

    select "Mark to Initialize BRAMs". The icon will now have a small red cross signifying that it will not run

    on the Microblaze.

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/software2.JPGhttp://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/software1.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    13/17

    5. Right click on the software application we just created "Project: TestApp" and select "Mark to Initialize

    BRAMs". The red cross on the icon of our software application should have been removed signifying

    that it will run on the Microblaze.

    6. From the menu select File->New, then select "Text file". Copy the following code into the new file.

    Save the file as "TestApp.c" in a folder called "TestApp" within the project folder.

    #include "xparameters.h"#include "xbasic_types.h"#include "xgpio.h"

    #include "xstatus.h"

    XGpio GpioOutput;XGpio GpioInput;

    int main (void) {

    Xuint32 status;Xuint32 DataRead;Xuint32 OldData;

    // Clear the screenxil_printf("%c[2J",27);

    // Initialize the GPIO driver so that it's ready to use,status = XGpio_Initialize(&GpioOutput,

    XPAR_LEDS_8BIT_DEVICE_ID);

    http://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/software3.JPGhttp://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/software3.JPG
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    14/17

    if (status != XST_SUCCESS)return XST_FAILURE;

    // Set the direction for all signals to be outputsXGpio_SetDataDirection(&GpioOutput, 1, 0x0);

    // Initialize the GPIO driver so that it's ready to use,status = XGpio_Initialize(&GpioInput,

    XPAR_DIP_SWITCHES_8BIT_DEVICE_ID);if (status != XST_SUCCESS)return XST_FAILURE;

    // Set the direction for all signals to be inputsXGpio_SetDataDirection(&GpioInput, 1, 0xFFFFFFFF);

    OldData = 0xFFFFFFFF;while(1){

    // Read the state of the DIP switchesDataRead = XGpio_DiscreteRead(&GpioInput, 1);

    // Send the data to the UART if the settings changeif(DataRead != OldData){xil_printf("DIP Switch settings: 0x%X\r\n", DataRead);// Set the GPIO outputs to the DIP switch valuesXGpio_DiscreteWrite(&GpioOutput, 1, DataRead);// Record the DIP switch settingsOldData = DataRead;

    }}return 0;

    }

  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    15/17

    7. In the "Project:TestApp" tree, right click on "Sources" and select "Add existing files". Select the

    "TestApp.c" file that we just created and click "OK".

    8. Right click on the "Project: TestApp" application and select "Generate Linker Script" and click

    "Generate".

    9. Select "Software->Generate Libraries and BSPs" from the menu.

    Download and Test the Project

    1. Open a Hyperterminal window with the required settings. For the correct settings, seeHyperterminal

    Settings.

    http://www.fpgadeveloper.com/2008/02/hyperterminal-settings.htmlhttp://www.fpgadeveloper.com/2008/02/hyperterminal-settings.htmlhttp://www.fpgadeveloper.com/2008/02/hyperterminal-settings.htmlhttp://www.fpgadeveloper.com/2008/02/hyperterminal-settings.htmlhttp://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/software5.JPGhttp://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/software4.JPGhttp://www.fpgadeveloper.com/2008/02/hyperterminal-settings.htmlhttp://www.fpgadeveloper.com/2008/02/hyperterminal-settings.html
  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    16/17

    2. Turn on the ML505 board.

    3. We can now download our hardware description and software application to the FPGA. From the XPS

    software, select "Device Configuration->Download Bitstream".

    The simple C program that we added to this project simply reads the DIP switch settings and sends a message

    with that data to the UART. It also writes the same values to the LEDs. When the application is running and

    Hyperterminal is open, the DIP switch settings should be seen on the LEDs and on the Hyperterminal screen.

    Change the DIP switches to see the message change.

    After a few changes in the DIP switches, the Hyperterminal output should look similar to the screen shot below:

  • 8/4/2019 Create a Project Using the Base System Builder in EDK10

    17/17

    The project folder for this tutorial can be downloaded in a compressed ZIP fileDIP2LED-EDK10-1.zip . Right-

    click on the link and select "Save Link As".

    In the next tutorial, Manually Add a Peripheral to a Project, we show how to manually add peripherals to a

    design, instead of letting the BSB do all the work.

    To contact the author of this tutorial, please send an email to:[email protected]

    http://www.fpgadeveloper.com/downloads/DIP2LED-EDK10-1.ziphttp://www.fpgadeveloper.com/downloads/DIP2LED-EDK10-1.ziphttp://www.fpgadeveloper.com/2008/10/manually-add-peripheral-to-project.htmlmailto:[email protected]://www.fpgadeveloper.com/en/create-project-using-base-system-edk10-1/hyperterminal.JPGhttp://www.fpgadeveloper.com/downloads/DIP2LED-EDK10-1.ziphttp://www.fpgadeveloper.com/2008/10/manually-add-peripheral-to-project.htmlmailto:[email protected]