有没有办法将设计参数从自定义 IP 传递到软件 [英] Is there a way to pass a design parameter from a custom IP to software

查看:29
本文介绍了有没有办法将设计参数从自定义 IP 传递到软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一些设计参数的自定义 IP.它们从 IP 公开,因此我可以在块设计中使用 IP 时自定义它们.

I have a custom IP with some design parameters. They are exposed from the IP so I can customize them when using the IP in a block design.

我希望能够在我的固件代码中使用这些参数.

I want to be able to use those parameters inside my firmware code.

例如,当使用简单的 GPIO 时,xparameters.h 标头中会公开几个参数:

For example when using a simple GPIO there are several parameters exposed in the xparameters.h header:

#define XPAR_GPIO_0_BASEADDR 0x41200000
#define XPAR_GPIO_0_HIGHADDR 0x4120FFFF
#define XPAR_GPIO_0_DEVICE_ID XPAR_GPIO_DEVICE_ID
#define XPAR_GPIO_0_INTERRUPT_PRESENT 0
#define XPAR_GPIO_0_IS_DUAL 0

除了最感兴趣的基地址之外,还有 IS_DUAL 参数,它是在块设计中实例化 IP 时设置的.

Besides the base address of most interest is the IS_DUAL parameter, that is set when instantiating the IP in a block design.

对于我的自定义 IP,标头中仅公开了 BASEADDRHIGHADDR.

For my, custom IP, only the BASEADDR and HIGHADDR are exposed in the header.

那么,问题是,有没有办法公开我的自定义参数?

So, the question is, is there a way to expose my custom parameters as well?

推荐答案

xparameters.h 的内容由 IP 的软件驱动程序中的 TCL 脚本生成.如果您尚未创建驱动程序,默认情况下您将获得通用驱动程序,该驱动程序只是将这些地址添加到 xparameters.h 中.

The content of xparameters.h is generated by the TCL scripts in the software drivers for the IP. If you haven't created a driver, by default you'll get the generic driver which just adds those addresses to xparameters.h.

您可以查看 gpio 驱动程序以了解如何做您想做的事.它位于 data/embeddedsw/XilinxProcessorIPLib/drivers/gpio_v4_4 下的 SDK 安装目录中,TCL 脚本位于 data/gpio.tcl 下.在该脚本中,有一个在生成 BSP 时运行的 generate 函数,您可以在其中添加代码以执行您需要的任何操作,包括将文本输出到 xparameters.h.define_include_file 行是为 GPIO 内核输出所有这些参数的行.

You can look at the gpio driver to get an idea of how to do what you want. It's located in the SDK install dir under data/embeddedsw/XilinxProcessorIPLib/drivers/gpio_v4_4, and the TCL script is in there at data/gpio.tcl. In that script, there's a generate function that runs when the BSP is generated, and you can add code there to do whatever you need, including outputting text to xparameters.h. The define_include_file line is the one outputting all those parameters for GPIO cores.

您可以使用 gpio 或其他之一作为创建您自己的驱动程序的参考.完成此操作后,将其添加到 SDK 中的存储库列表中,然后修改您的 BSP 配置以将该驱动程序用于您的 IP 实例.(或者,如果您创建新的 BSP,它可能会自动选择它.)

You can use gpio or one of others as a reference for creating your own driver. Once you do that, add it to the repositories list in SDK and then modify your BSP configuration to use that driver for your IP instances. (Or it may select it automatically if you create a new BSP.)

这篇关于有没有办法将设计参数从自定义 IP 传递到软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆