# Xilinx project tutorial & program into flash
## Create a project make LED blinking
### 1. create a new project
Launch vivado 2016.4

\

\

\

\

\

\

\

### 2. Create Block Design
\

\

\
click "Run Block Automation"

\

### 3. Add IP AXI GPIO
\

\
Double click AXI GPIO

\
Set it as an output pin

\
Click "Run Connection Automation"

\
Check all of the boxes
Set board part interface of GPIO to "custom"

\

\
Create HDL wrapper

### 4. Assign output pin
\
Copy the name of the output port
In this project, the name is "gpio_rtl_tri_o"

\
Add design constraints

\
Create a new file
Name the file

\

\
Edit the constrain file
U14 is the pin name(LED) on the FPGA board

``` 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

\

\
Export hardware(include bitstream)

\

\
Launch SDK

\
### 5. SDK
\
Create a new application project

\

\
Right click "Board Support Package Settings"

\

\
Edit the main file

```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;
}
```
\

\

\

\
Run the program

\
View the result from the consule

\
The led on Zedboard should start blinking

## Program the project into flash
### 6. Program into flash
Create and name a new project "fsbl"

\
Use template "Zynq FSBL"

\

\
Create Boot Image

\

\
Create a new folder "boorImage" in fsbl

\
Add the following files into path

\
Add fsbl.elf

\

\

\
Add design.bit file

\

\
Add project .elf file

\

\
Program flash

\
Select the created boot image file

\

\
Change the jumper to QSPI mode

**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