---
# System prepended metadata

title: Xilinx project tutorial & program into flash

---

# Xilinx project tutorial & program into flash

## Create a project make LED blinking 
### 1. create a new project

Launch vivado 2016.4
![](https://i.imgur.com/2UzeAZ9.png)
\
![](https://i.imgur.com/vcImgXF.png)
\
![](https://i.imgur.com/7RfSbsW.png)
\
![](https://i.imgur.com/hQjuriO.png)
\
![](https://i.imgur.com/A7Jq7Tp.png)
\
![](https://i.imgur.com/mTlRS7F.png)
\
![](https://i.imgur.com/X0s6cS8.png)
\
![](https://i.imgur.com/53mRJPK.png)

### 2. Create Block Design
\
![](https://i.imgur.com/zSGcJqR.png)
\
![](https://i.imgur.com/4UsNGSP.png)
\
click "Run Block Automation"
![](https://i.imgur.com/mNMXNn2.png)
\
![](https://i.imgur.com/k1Gtaqp.png)

### 3. Add IP AXI GPIO
\
![](https://i.imgur.com/CgdCUVA.png)
\
Double click AXI GPIO
![](https://i.imgur.com/OsKQiig.png)
\
Set it as an output pin
![](https://i.imgur.com/CCBalSH.png)
\
Click "Run Connection Automation"
![](https://i.imgur.com/lz6O956.png)
\
Check all of the boxes
Set board part interface of GPIO to "custom"
![](https://i.imgur.com/kqA4BXS.png)
\
![](https://i.imgur.com/XHI6hbx.png)
\
Create HDL wrapper
![](https://i.imgur.com/eOhhZDc.jpg)

### 4. Assign output pin
\
Copy the name of the output port
In this project, the name is "gpio_rtl_tri_o"
![](https://i.imgur.com/nzpJ7pr.png)
\
Add design constraints
![](https://i.imgur.com/MZ4Kviu.png)
\
Create a new file
Name the file
![](https://i.imgur.com/sMSFpnX.png)
\
![](https://i.imgur.com/agsiIMV.png)
\
Edit the constrain file
U14 is the pin name(LED) on the FPGA board
![](https://i.imgur.com/xZyWUTX.png)

``` vivado
set_property IOSTANDARD LVCMOS33 [ get_ports {gpio_rtl_tri_o[0]} ]

set_property PACKAGE_PIN U14 [ get_ports {gpio_rtl_tri_o[0]} ]
```
\
Generate bit stream
![](https://i.imgur.com/7x1Mco8.png)
\
![](https://i.imgur.com/qjoUw0o.png)
\
Export hardware(include bitstream)
![](https://i.imgur.com/mSwMOa0.jpg)
\
![](https://i.imgur.com/pzIJfzE.png)
\
Launch SDK
![](https://i.imgur.com/81PRQNe.png)
\
### 5. SDK
\
Create a new application project
![](https://i.imgur.com/NfbdjTz.jpg)
\
![](https://i.imgur.com/dYFYRji.png)
\
Right click "Board Support Package Settings"
![](https://i.imgur.com/Bo6LhHJ.jpg)
\
![](https://i.imgur.com/KnbWINA.png)
\
Edit the main file
![](https://i.imgur.com/sZMmqGT.png)
```c
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xgpio.h"


void simple_delay (int simple_delay)
{
        volatile int i = 0;
        for (i = 0; i < simple_delay; i++);
}

int main()
{
    init_platform();
    XGpio led_gpio;              /* LED Instance */
    char led_value = 0x00;   /* default led_gpio value */


    /* Initialize LED GPIO settings */
    XGpio_Initialize(&led_gpio, XPAR_AXI_GPIO_0_DEVICE_ID);
    XGpio_SetDataDirection(&led_gpio, 1, 0);

    print("Start to blink led_gpio !!!\n\r");
    while(1){
    	simple_delay(10000000);
    	led_value = ~led_value;
    	xil_printf("led value set to %x\r\n",led_value);
		XGpio_DiscreteWrite(&led_gpio, 1 , led_value);
    }

    cleanup_platform();
    return 0;
}
```
\
![](https://i.imgur.com/g0MUZmN.jpg)
\
![](https://i.imgur.com/zc9Es3B.png)
\
![](https://i.imgur.com/2xYC0mz.jpg)
\
Run the program
![](https://i.imgur.com/F0EWCeO.png)
\
View the result from the consule
![](https://i.imgur.com/32pErRy.jpg)
\
The led on Zedboard should start blinking
![](https://i.imgur.com/hq2noJ7.png)


## Program the project into flash
### 6. Program into flash
Create and name a new project "fsbl"
![](https://i.imgur.com/zJ1xzFs.png)
\
Use template "Zynq FSBL"
![](https://i.imgur.com/ft9G1QR.png)
\
![](https://i.imgur.com/v3v13GS.png)
\
Create Boot Image
![](https://i.imgur.com/1Tfg1DK.jpg)
\
![](https://i.imgur.com/FaD5Qvq.png)
\
Create a new folder "boorImage" in fsbl
![](https://i.imgur.com/jUWSrDa.png)
\
Add the following files into path
![](https://i.imgur.com/APzb7bK.png)
\
Add fsbl.elf
![](https://i.imgur.com/Hzq5pBZ.png)
\
![](https://i.imgur.com/nkWLMJt.png)
\
![](https://i.imgur.com/W6u9sjz.png)
\
Add design.bit file
![](https://i.imgur.com/XfF6kVr.png)
\
![](https://i.imgur.com/tk5kRVf.png)
\
Add project .elf file
![](https://i.imgur.com/O6zpCrY.png)
\
![](https://i.imgur.com/Y3AwBPf.png)
\
Program flash
![](https://i.imgur.com/hhRf7r8.jpg)
\
Select the created boot image file
![](https://i.imgur.com/TBUaSyz.png)
\
![](https://i.imgur.com/pbjIz2H.png)
\
Change the jumper to QSPI mode
![](https://i.imgur.com/MLKBifO.png)

**Turn off and turn on the board, and it should start blinking**

## Reference Website
https://reference.digilentinc.com/learn/programmable-logic/tutorials/zedboard-programming-guide/start
\
https://www.itread01.com/content/1544376606.html






































