How to generate "platform.h" in a Xilinx SDK Project?

2.3k Views Asked by At

I'm currently working on a Zynq-7000 Software project using Xilinx SDK toolchain.

I've noticed that nearly all of Xilinx's Demo projects automatically generate a "platform.h" file. However, when I start from an empty project in the SDK IDE it never generates "platform.h". This normally this would not be a problem, however, I want to cut and paste code from the "demo" project into my empty application project, and I can't do this because the "demo" projects rely on the "platform.h" header file. (I could create the demo project and delete every file from it, except platform.h, except this solution doesn't work because I need to modify the hardware away from the defaults with a custom FPGA image.)

What's the secret to get Xilinx SDK to auto-generate the "platform.h" file for an empty SDK Application?

For instance, is there an obscure checkbox that I need to click somewhere in the Board Support Package Project that says generate "platform.h"? or something like that? no idea...

1

There are 1 best solutions below

0
On

It turns out that "platform.h" and "platform.c" are just normal c-code that are part of the Xilinx demo project. This code is not generated automatically generated as part of the Board Support Package. Thus, you can simply cut and paste these files into your new project without causing any problems. This is why an empty Application project doesn't contain these files.

The reason why they called it "platform.h" was just to hide the API differences between different Xilinx CPU types. Thus, the same demo code compiles on multiple platforms.

If you are like me an only using the Zynq-7000 platform, you can simply delete everything else in the platform files that's not related to Zynq-7000.