A while back I started sharing FPGA projects and code on Github. As I typically only commit sources and not generated files, the process of rebuilding the projects from sources can be a little tricky if you’re not used to working with the Xilinx tools. In this post I’ll explain exactly how you can download and rebuild one of my projects, and hopefully it will make the projects useful to more people.
Download the sources from Github
The first thing you have to do is obviously to get the sources from Github. Now if you’re a user of Git, that’s a simple matter of cloning the repository. If you’re not a user of Git, you’ll have to visit the Github page and use the download link.
Go to the Github page of the project you want, for example: https://github.com/fpgadeveloper/zc706-bsb
For Git users, use the clone URL that you find circled in the image below. For non-Git users, use the download ZIP link button just below.
- Extract the files to the folder you want to work in, for this example, create a folder called
zc706-bsb. Among the extracted files you should find at least two folders: EDK and SDK, that’s the minimum for any of my projects.
- The EDK folder contains the Xilinx Platform Studio (EDK) project files. These files can be directly opened in the EDK.
- The SDK folder contains applications and board support packages for the Xilinx SDK. To use these files, you will use this folder as your new SDK workspace and import the existing applications. We will go into this later.
Build the EDK project
The EDK project is simple to rebuild, there is nothing fancy that needs to be done, just open the project in Xilinx Platform Studio (EDK) and click the “Generate Bitstream” button.
You then will need to export the design to SDK by clicking the “Export Design” button.
Click “Export & Launch SDK” because we will need the SDK for the next step.
Build the SDK workspace
If you are used to using the Xilinx SDK, you might notice that the SDK folder doesn’t contain any hardware platform (typically it’s called
EDK_hw_platform). I don’t commit the hardware platform because I don’t consider these files to be true sources because they are generated by the SDK and they change every time you modify the EDK project. So what I prefer to do is to have SDK regenerate the hardware platform when I clone a project. That is what we do in this step.
When SDK starts up, it will ask which workspace you would like to open. You should select the SDK folder from the files you just downloaded/extracted.
The SDK will open up with a workspace that contains the hardware platform called
EDK_hw_platform. The screen should be as shown in the image below.
You should notice
EDK_hw_platform in the Project Explorer as in the above image. As the name implies, these files are generated by the EDK design and they contain all the files necessary to describe the hardware configuration that you specified in the EDK project. You can see the bitstream in there (system.bit) as well as other configuration files that are specific to the Zynq. Every time you change the EDK project and use the “Export design” button, the SDK will know about it and update its copy of those files if you give it permission to do so.
If you did not use the “Export & Launch SDK” from Xilinx Platform Studio, you will have to create the hardware platform yourself in SDK. In that case, you would open the SDK and choose the SDK workspace folder. The workspace should be completely empty. You would follow these steps to create the hardware platform:
- Select the SDK folder as your SDK workspace.
- SDK will then open an empty workspace. Select File->New->Project.
- In the New Project Wizard, select Xilinx->Hardware Platform Specification. Click Next.
- In the Target Hardware Specification window, click Browse.
- Browse to the
EDK/SDK/SDK_Export/hwfolder and select the
- The project name should be automatically named
EDK_hw_platform. Make sure that the name is spelt exactly like that and click Finish.
After completing those steps you should have an SDK workspace with a single project named
Now you need to import the applications and BSPs.
- Select File->Import.
2. In the Import window, select General->Existing projects into workspace. Click Next.
3. Click Browse, and select the SDK folder (from the files you downloaded).
- Ensure that all applications and BSPs are ticked, then click Finish.
Build and run your application
Before trying to run your code, wait a while for SDK to build the application. It should be automatic, but if it doesn’t start by itself, you can always select Project->Build All. It can sometimes take a while, check the progress at the bottom right corner of the SDK window.
Fork and share
If you port any of my projects to other hardware platforms, or if you have some interesting applications, please send me the code or push it onto GitHub and send me a link so I can share it on my website. The more people that benefit, the better.