This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > FPGA Technical Tutorials > The Zynq Book Tutorials > First Designs on Zynq > Creating a Software Application in the SDK

Creating a Software Application in the SDK

FONT SIZE : AAA

In this exercise we will create a simple software application which will control the LEDs on the ZedBoard. The software application will run on the Zynq processing system and communicate with the AXI GPIO block which is implemented in the PL. We will take a look at the software drivers that are created by IP Integrator, for each of the IP modules, before building and executing the software on the ZedBoard.

The SDK should have opened after the conclusion of Exercise 1B. If it did not open, you can open the SDK by navigating to Start > All Programs > Xilinx Design Tools > Vivado 2014.1 > Xilinx SDK 2014.1

When launching the SDK from the start menu, you will need to specify the workspace that was created when the Vivado IP Integrator design was exported in Exercise 1B. It should be: 

C:\Zynq_Book\first_zynq_design\first_zynq_design.sdk\SDK\SDK_Export

Enter this in the Workspace field of the Workspace Launcher dialogue window, as shown in Figure 1.22.

SDK Workspace Launcher Dialogue Window.png

With the SDK open, we can begin the creation of our software application.

(a) Select File > New > Application Project from the Menu bar.

(b) The New Project dialogue window will open. Enter LED_test in the Project name field, as shown in Figure 1.23, keeping all other options with the default settings. Click Next.

New Application Project Dialogue.png

(c) At the New Project Templates screen, select Empty Application, as in Figure 1.24, and click Finish to create the project.

New Project Template Dialogue.png

NOTE: the new project should open automatically. If it doesn’t, you may need to close the Welcome tab in order to view the project.

With the new Application Project created, we can now import some pre-prepared source code for the application.

(d) In the Project Explorer panel, expand LED_test and highlight the src directory. Right-click and select Import., as shown in Figure 1.25.

Import Source Files to Project.png


(e) The Import window will open. Expand the General option and highlight File System, as in Figure 1.26, and click Next.

Import File System.png


(f) In the Import File System window, click the Browse. button. 

(g) Navigate to the directory: C:\Zynq_Book\sources\first_zynq_design and click OK

(h) Select the file LED_test_tut_1C.c, as shown in Figure 1.27, and click Finish.

Import C Source File.png

The C source file will be imported and the project should automatically build. You should see a similar message to Figure 1.28 in the Console window.

Build Finished Console Message.png

(i) Open the imported source file by expanding the src folder and double-clicking on LED_test_tut_1C.c, and explore the code.

Note the command XGpio_Initialize(&Gpio, GPIO_DEVICE_ID); This is a function provided by the GPIO device driver in the file xgpio.h. It initialises the XGpio instance, Gpio, with the unique ID of the device specified by GPIO_DEVICE_ID.

If you look toward the top of the source file you will see that GPIO_DEVICE_ID is defined as XPAR_AXI_GPIO_0_DEVICE_ID. The value of XPAR_AXI_GPIO_0_DEVICE_ID can be found by opening the file, xparameters.h, which is automatically generated by Vivado IDE when exporting a hardware design to the SDK. It contains definitions of all the hardware parameters of the system.

The function, XGpio_SetDataDirection(&Gpio, LED_CHANNEL, 0xFF); is also provided by the GPIO device driver, and sets the direction of the specified GPIO port. As we are specifying the LEDs in this case, it is specifying an output. Bits set to ‘0’ are output, and bits set to ‘1’ are input. As there are 8 LEDs, by setting the LED channel direction to a value of 0x00, or 00000000 in binary, we are setting all 8 LEDs as outputs.

Further information on the peripheral drivers can be found by selecting the system.mss tab. A list of all the peripherals in the system is provided, along with links to available documentation and examples, as shown in Figure 1.29.

Peripheral Documentation and Drivers in system.mss tab.png

The next step is to program the Zynq PL with the bitstream file that we generated in Exercise 1B.

Ensure that the ZedBoard is powered on and that the JTAG port is connected to the PC via the provided USB-A to USB-B cable.

(j) Download the bitstream to the Zynq PL by selecting Xilinx Tools > Program FPGA from the Menu bar. The Program FPGA window will appear. The Bitstream field should already be populated with the correct bitstream file, as in Figure 1.30.

Program FPGA dialogue Window.png

NOTE: Once the device has successfully been programmed, the DONE LED on the ZedBoard will turn blue.

With the Zynq PL successfully configured with the bitstream file, we can now launch our software application on the Zynq PS.

(k) Select the project LED_test in Project Explorer. Right-click and select Run As > Launch on Hardware (GDB).

After a few seconds the LEDs on the ZedBoard should begin to flash between the states highlighted in Figure 1.31.

LED Flashing States.png


You have successfully created and executed your first software application on the Zynq processing system.




  • XC18V02-VQ44C

    Manufacturer:Xilinx

  • PROM Parallel/Serial 2M-bit 3.3V
  • Product Categories:

    Lifecycle:Active Active

    RoHS: -

  • XC2S30-5TQ144I

    Manufacturer:Xilinx

  • FPGA Spartan-II Family 30K Gates 972 Cells 263MHz 0.18um Technology 2.5V 144-Pin TQFP
  • Product Categories: Embedded - FPGAs (Field Programmable Gate Array)

    Lifecycle:Active Active

    RoHS: No RoHS

  • XC2S30-6VQ100C

    Manufacturer:Xilinx

  • FPGA Spartan-II Family 30K Gates 972 Cells 263MHz 0.18um Technology 2.5V 100-Pin VTQFP
  • Product Categories: Embedded - FPGAs (Field Programmable Gate Array)

    Lifecycle:Active Active

    RoHS: No RoHS

  • XC4VLX60-11FFG668C

    Manufacturer:Xilinx

  • FPGA Virtex-4 LX Family 59904 Cells 90nm Technology 1.2V 668-Pin FCBGA
  • Product Categories: FPGAs

    Lifecycle:Active Active

    RoHS:

  • XC4VLX60-12FFG1148C

    Manufacturer:Xilinx

  • FPGA Virtex-4 LX Family 59904 Cells 90nm Technology 1.2V 1148-Pin FCBGA
  • Product Categories: FPGAs (Field Programmable Gate Array)

    Lifecycle:Active Active

    RoHS:

Need Help?

Support

If you have any questions about the product and related issues, Please contact us.