Changes between Initial Version and Version 1 of Exercises/14_4/IntroToSDK


Ignore:
Timestamp:
Mar 23, 2014, 2:18:01 PM (10 years ago)
Author:
murphpo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Exercises/14_4/IntroToSDK

    v1 v1  
     1= Introduction to the Xilinx Software Development Kit (SDK) =
     2 * '''Hardware: WARP v3'''
     3 * '''Tools: Xilinx ISE 14.4 or later'''
     4
     5This exercise uses the Xilinx Software Development Kit (SDK) and WARP v3 hardware to build a classic "Hello World" program.
     6
     7== Requirements ==
     8 * One WARP v3 kit
     9 * ESD protection for the WARP board (wrist strap, etc)
     10 * Micro-USB cable (for WARP v3 - PC UART connection)
     11 * PC with:
     12   * Xilinx ISE tools (14.4 or later)
     13   * FTDI drivers for USB-UART (see [wiki:howto/USB_UART USB-UART howto])
     14   * Terminal emulator program (see [wiki:howto/USB_UART USB-UART howto])
     15 * Local copy of the WARP svn repository
     16
     17== Setup ==
     181.
     19
     20== Instructions ==
     21
     221. Download the WARP v3 "Lite" template project: [http://warpproject.org/dl/refdes/template/w3_TemplateProject_Lite_v1p4.zip w3_TemplateProject_Lite_v1p4.zip].
     23 * The "On Board Peripherals" template will also work
     24 * Refer to the [wiki:/HardwareUsersGuides/WARPv3/TemplateProjects WARP v3 user guide] for more details about the template projects
     251. Extract the template project archive
     26 * The full path containing the template project '''must not''' contain spaces. {{{C:\work\w3_TemplateProject_Lite_v1p4\}}} is good; {{{C:\My Projects\w3_TemplateProject_Lite_v1p4}}} is bad.
     27 * Navigate to the template project folder and find the sub-folder named {{{SDK_Workspace}}} - you'll need this below
     281. Launch the Xilinx SDK, either from the Start Menu or the desktop icon.
     29 *
     30
     311. Launch the Xilinx SDK from the Start Menu. It will ask you to select a workspace. Click "Browse ..." and navigate to the "SDK_workspace" folder in the archive you just extracted. Do '''not''' check the box for "Use this as the default and do not ask again." We recommend the convention of using a single workspace per hardware project; checking this box will make this difficult. More useful tips for using the SDK are available [wiki:XilinxSDK here]. Click OK.
     321. Rather strangely, the Xilinx SDK does not automatically know about software drivers to custom peripherals in your XPS project. You have to explicitly tell the SDK where to find your hardware project. This is a step you have to do with '''every''' new SDK workspace. In this exercise, we do not have any custom peripherals, but it is still a good habit to get into. Click on the "Xilinx Tools" menu item and select "Repositories." Here, you want to ensure two things:
     33 * In Local Repositories, you want to point the SDK to the folder that contains the XPS project system.xmp file. Click on "New..." and navigate to and select this folder.
     34 * In Global Repositories, you want the SDK to point to the edk_user_repository folder on your hard drive. Unlike the local repositories, the SDK does remember this setting across workspaces. You'll only need to manually add the edk_user_repository the first time you run the SDK.
     351. In the template project you downloaded, we have provided a template software project. We now need to add it to the workspace. Click on File→Import...
     361. Click the + next to "General" and select "Existing Projects into Workspace." Then click "Next."
     371. In the "Select root directory:" click "Browse..." Then, navigate to the "SDK_workspace" folder in the extracted archive and click "OK"
     381. Three projects have now been populated in the "Projects" area of the import window. Make sure all of these are checked. Do not check "Copy projects into workspace" because these projects are already in the SDK_workspace folder. Click "Finish."
     391. The three projects now appear in the "Project Explorer" on the left of the screen:
     40 * The "*_hw_platform" contains all of the necessary hardware-specific information for the project. This includes any custom FPGA cores that the project may have. This comes from the Xilinx Platform Studio (XPS) tool. Instructions for using this tool to generate hardware platform information for the SDK is available in the [wiki:Exercises/13_4/IntroToXPS Introduction to XPS] exercise.
     41 * The "*_bsp" is a "Board Support Package" and it contains the software drivers for the peripherals contained in the hardware platform.
     42 * The "*_example" project is the top-level software project that you will modify to add a print of "Hello World" to the UART.
     431. Click the + button next to the "*_example" project. Then open the "src" folder by clicking the + button next to it. Finally, double click the "*_example.c" file to open it in the editor. At this point, you can look through this source code and see that it will print some messages to the terminal and will count upwards, displaying the current count on the hexadecimal displays on the WARP board and the LEDs.
     441. Right click on the "*_example" software project in the Project Explorer and click "Generate Linker Script." Here, we will assign instruction and data pieces of our code to various pieces of memory in our XPS hardware project. Assign the following:
     45 * The code sections to "ilmb_cntrl_dlmb_cntlr"
     46 * The data sections to "xps_bram_if_cntlr_0"
     47 * The heap and stack to "xps_bram_if_cntlr_1"
     481. Click "Generate" and then "Yes" to the message that says you are going to overwrite an existing linker script. The console will print messages and end with "Finished building: *_example.elf.elfcheck"
     491. Make sure your WARP hardware is powered on (fan should be running).  Also make sure the WARP hardware is connected via JTAG (for programming) and connected via micro USB (for terminal communication) to your computer.
     501. Click the "Xilinx Tools" menu item and then "Program FPGA." Then click Program. This will load the hardware design onto the board. It will not load the software project.
     511. Open up a terminal emulator on your computer and configure it to accept your COM port with speed 57600 baud.
     521. The SDK is somewhat sensitive on what project has "focus" when you tell it to do something like load a design onto the board. Make sure the "*_example" project is highlighted. If it is not, click on it so that it will be.
     531. Click the menu item "Run" and then click "Run." A window will pop up asking you to select a way to run your "*_example" program. Click "Launch on Hardware" and then okay.
     541. The project is now running! You should see the LEDs and hexadecimal displays on the board incrementing twice a second. Furthermore, your terminal should be printing.
     551. Try to modify any of the prints in the code with your own custom strings. Click save. The SDK will automatically recompile the project. Download it again through the "run" menu.
     561. Also, find the usleep(250000) line inside the userio_example() function. This line is telling the processor to wait for half a second before incrementing the displays upwards. Replace this with usleep(500000) and you should see the board count half as fast.
     57
     58
     59
     60
     61= Discussion =
     62
     63The purpose of this exercise was to take you through the whole process of writing software for an existing hardware project. In the [wiki:../SysGenExport System Generator Peripheral Export] exercise, you will develop a custom FPGA peripheral core and control it via custom software.
     64
     65= Additional Questions and Feedback =
     66If you have any additional questions about this exercise or other feedback, please post to the [http://warp.rice.edu/forums/ WARP Forums].