1.建立一个工程。
硬件设计
2.IP integrator -> create block desgin;Run Block Automation.
3.add IP -> AXI GPIO;ritht-click -> Costomize Blocking or double left-click,gpio 8bits leds;
3. Run Connection Automation -> select all.
4.file -> save
硬件处理
5.Tools -> Validate Design
6.right-click -> Generate Output Products;right-click -> Create HDL Wapper;
7.Generate Bitstream.
8.File -> Export Hardware;include bitstream.
9. File -> Launch SDK
接下来在SDK中写软件
10. File -> New -> App Project.
11.Next -> Hello World -> finish.
12. open -> resouce -> helloworld.c
13.写代码
1 #include <stdio.h> 2 #include "platform.h" 3 #include "xil_printf.h" 4 #include "xparameters.h" 5 #include "xgpio.h" 6 7 #define LED_DELAY 10000000 8 9 void led_delay() //times delay 10 { 11 u32 i; 12 for(i=0;i<=LED_DELAY;i++); 13 } 14 15 int main() 16 { 17 init_platform(); 18 u32 cnt,m; 19 //loop forever 20 while(1){ 21 for(m=0;m<=8;m++){ 22 Xil_Out32(XPAR_AXI_GPIO_0_BASEADDR, 0x01<<m); 23 led_delay(); 24 if(m==8){ 25 printf("Hello World! %ld:SUCESS! ",cnt++); 26 } 27 } 28 } 29 30 cleanup_platform(); 31 return 0; 32 }
14.Save.
控制出现 build finished 就编译好了。
下载与调试
15.连接zedboard与pc。两根microUSB,一根是PROG,JTAG;一根是USB转串口。上电!
16.Xlinx -> Program FPGA
17.Run -> run configurations -> run
Done!
此时板上led开始闪烁,控制台也开始打印输出。
finished!