此记录JFMQL15T开发板,实现ps通过axi接口控制pl 的EMIO接口led闪烁,添加EMIO PJTAG用于PS端调试,先创建vivado工程,最终生成bitstream,procise从vivado中导入工程,procise下载bitstream,启动IAR,编译下载调试即可。
proccise工程由vivado中导入。
芯片类型选择zynq-7000, xc7z015clg485-2
点击Create Block Design,命名为system
双击AXI GPIO,选择All Outputs,设置GPIO Width为4(本例中控制四个PL_LED),其他保持不变。
选择Make External
连线
重新生成顶层文件流程,参考3.7和3.8
Generate Output Products
重新加载顶层文件
Reload完成后Ctrl+S保存,同时可以看到EMIO PJTAG的引脚包含在了顶层文件中
编写引脚约束文件(由于AXI GPIO配置时All Outputs 所以引脚约束文件中为pl_led_tri_o)
set_property IOSTANDARD LVCMOS25 [get_ports {pl_led_tri_o[*]}]
set_property IOSTANDARD LVCMOS33 [get_ports PJTAG_0_tck]
set_property IOSTANDARD LVCMOS33 [get_ports PJTAG_0_tdi]
set_property IOSTANDARD LVCMOS33 [get_ports PJTAG_0_tdo]
set_property IOSTANDARD LVCMOS33 [get_ports PJTAG_0_tms]
set_property PACKAGE_PIN E2 [get_ports {pl_led_tri_o[0]}]
set_property PACKAGE_PIN D6 [get_ports {pl_led_tri_o[1]}]
set_property PACKAGE_PIN F5 [get_ports {pl_led_tri_o[2]}]
set_property PACKAGE_PIN E3 [get_ports {pl_led_tri_o[3]}]
set_property PACKAGE_PIN AB11 [get_ports PJTAG_0_tck]
set_property PACKAGE_PIN V11 [get_ports PJTAG_0_tdi]
set_property PACKAGE_PIN W11 [get_ports PJTAG_0_tdo]
set_property PACKAGE_PIN AA11 [get_ports PJTAG_0_tms]
vivado 菜单栏中File—> Export—>Export Hardware,选中Include bitstream,点击ok
vivado 菜单栏中File—> Launch SDK,点击OK
创建工程
新生成的bsp中的部分驱动文件后续会用到,完成此操作新建SDK工程后(bsp包必须以_bsp结尾,procise只识别此格式)即可关闭vivado和sdk ,用procis导入vivado工程。
将vivado sdk的程序文件夹放到procise工程下的SDK/system_platform_FM_QL_bsp/pl下
将vivado sdk的程序文件夹放到procise工程下的SDK/system_platform_FM_QL_bsp/pl下
vivado SDK bsp下的include 文件夹下的“xil_assert.h”、“xil_types.h”、“xparameters.h”、“xstatus.h”,libsrc\standalone_v6_1\src 目录下的“xil_assert.c”, libsrc\gpio_v4_3\src 下所有的 c 和 h 文件。
对应添加完成后的效果如下:
xparameters.h文件中注释掉#include “xparameters_ps.h”
xgpio_l.h中注释掉#include “xil_io.h”,添加#include “fmsh_common.h”
更改读写接口宏定义
#define XGpio_In32(addr) FMSH_ReadReg(addr,0x0)
#define XGpio_Out32(addr,data) FMSH_WriteReg(addr,0x0,data)
#include
#include “platform.h”
#include “fmsh_common.h”
#include “xgpio.h”
#include “fmsh_ps_parameters.h”
int FGpioOutputExample(void);
int main()
{
//init_platform();
FMSH_WriteReg(FPS_SLCR_BASEADDR, 0x008, 0xDF0D767BU);
FMSH_WriteReg(FPS_SLCR_BASEADDR, 0x838, 0xf);
FMSH_WriteReg(FPS_SLCR_BASEADDR, 0x004, 0xDF0D767BU);
//printf(“1\r\n”);
while (1)
{
FGpioOutputExample();
}
//cleanup_platform();
return 0;
}
int FGpioOutputExample(void)
{
XGpio led_out;
u32 led_channel = 1;
int status;
u32 maxloop = 3;
u32 led_bit;
u32 led_width = 4;
u32 i;
status = XGpio_Initialize(&led_out, 0);
if(status != XST_SUCCESS)
{
return XST_FAILURE;
}
//set all output
XGpio_SetDataDirection(&led_out, led_channel, 0x0);
//set GPIO outputs to high
XGpio_DiscreteWrite(&led_out, led_channel, 0x0F);
for(i = 0; i < maxloop; i++)
{
for(led_bit = 0; led_bit < led_width; led_bit++)
{
XGpio_DiscreteWrite(&led_out, led_channel, ~(1<
}
}
return 0;
}