作者:OpenSLee
1. 背景知识
Helloworld 实验总是各种编程语言的开始第一课,这里我们将使用xilinx zynq-7000芯片ARM端完成串口打印”Helloworld”实验,旨在体验一下zynq-7000 的开发流程,为以后的zynq-7000的开发打下基础。
2. Zynq-7000 HelloWord
本人使用的zynq-7000芯片为xc7z010clg400。
Vivado的工程创建我们在这里就不在详述。
1) Create Block Design
点击Create Block design >>填写Design name >> OK 如下图所示。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38932-1createblockdesign.png)
2) 添加ZYNQ7 Processing System
点击 Add IP>> 搜索zynq>>选着ZYNQ7 Processing System 如下图。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38933-2tianjiazynq7processingsystem.png)
3) 配置ZYNQ7 Processing System
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38934-3peizhizynq7processingsystem.png)
一般Zynq Block 需要配置:
(1) PS-PL Configuration PS端到PL端的配置
(2) Peripheral I/O Pins
(3) MIO Configuration MIO配置
(4) Clock Configuration 时钟配置
(5) DDR Configuration DDR的配置
(6) SMC Timing Calculation
(7) Interrupts
这里我们需要用到PS端的UART。
我们选择PS-PL Configuration>>General >>UART1 Baud Rate 配置为115200
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38935-4.png)
Peripheral I/O Pins 根据自己的硬件连线来选择。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38936-5.png)
MIO Configuration 如下图,选择uart1,电压选择1.8V
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38937-6.png)
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38938-7.png)
Clock Configuration如下图。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38939-8.png)
DDR Configuration 根据自己开发板的DDR进行配置。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38940-9.png)
配置ZYNQ7 Processing System 完成。最终如下图所示。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38941-10.png)
4) Generate Output Products... 和Create HDL Wrapper...
首先选中system右键选中Generate Output Products...
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38942-11.png)
选中system右键选中Create HDL Wrapper...
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38943-12.png)
5) 硬件导入SDK
(1) 导出硬件 选择菜单File->Export->Export Hardware...。这里不包括bitstream
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38944-13.png)
(2) Launch SDK 选择菜单File->Launch SDK,启动SDK环境。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38945-14.png)
6) SDK程序开发
(1)选择菜单File->New->Application Project, 新建一个SDK软件工程。
(2)输入工程名字为helloworld, 生成一个新的bsp文件。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38946-15.png)
(3) 选择工程模版Hello World。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38947-16.png)
生成后的helloworld工程和BSP支持包如下。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38948-17.png)
(4) 右键选择helloworld工程,选择Build Project,编译一下。
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38949-18.png)
整个uart打印HelloWord的工程建立到此完成。
为了让串口多打印几次我们修改helloworld.c如下:
#include
#include "platform.h"
void print(char *str);
int main()
{
int i,j;
init_platform();
for (i = 0; i<100; i++)
{
for(j =10; j> 0; j--)
{
print("Hello World\n\r");
print("Hello FPGA Open Source Studio Lee\n");
}
}
cleanup_platform();
return 0;
}
7) 下载和调试
连接好硬件和打开串口工具后,右键选择helloworld工程,再选择Run as->1. Launch on Hardware (sysntem Debugger)如下图:
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38950-19.png)
结果如下图所示:
![](http://xilinx.eetrend.com/files-eetrend-xilinx/article/201808/13310-38951-20.png)
总结:
本节虽然简单但是演示了整个zynq-7000的开发流程。为其他zynq-7000工程开发打下基础。
文章转载自:FPGA开源工作室