Revision control for Xilinx EDK projects

From SecretLab

Jump to: navigation, search

There seems to be very little documentation from Xilinx on how to use SCM (Source Code Management) tools to manage EDK projects. It's easy enough to throw a whole project, generated files and all, into a repository for maintaining project history, but doing so isn't so useful when trying to determine what exactly changed between two versions of the code. It results in wading through a large changeset where most of the diffs are in generated files, when all that you're interested in is explicit source code changes.

I've found the git tool to be a particularly useful SCM tool, and as such these notes are geared to managing an EDK tree with git. The suggestions here can easily be adapted to other SCM tools.

Contents

Moving between Windows and Linux/Solaris

Line endings on text files are different between Windows and Linux/Solaris. Text files created by Windows use "CRLF" line endings, whereas other systems simply use the "LF" character. If you are moving a project back and forth between Windows and Linux, you should scrub line ending differences before committing your changes. I use the following script on Linux to change to UNIX style line endings on all text source files.

edk-sanitize.sh:

#!/bin/sh
find * -type d | xargs chmod u+w
git-ls-files | xargs chmod u+w
git-ls-files '*.opt' '*.mhs' '*.mss' '*.xmp' '*.arg' | xargs dos2unix
git-ls-files '*.make*' '*.cmd' '*.ld' '*.c' '*.h' '*.prj' | xargs dos2unix
git-ls-files '*.mpd' '*.pao' '*.cli' '*.txt' '*.ucf' '*.lfp' | xargs dos2unix
git-ls-files '*.ref' '*.vhd' '*.ant' '*.jhd' '*.tbw' '*.vhw' | xargs dos2unix
git-ls-files '*.lso' '*transcript' '*.fdo' '*.udo' '*.xst' | xargs dos2unix
git-ls-files '*_info' '*.cdc' | xargs dos2unix

Getting started

Use the following commands to setup your git repository for an EDK project and checking your initial project.

$ cd /path/to/edk/project/dir
$ git-init
$ vim .gitignore    # Add the patterns listed in the "Controlled file list" section.
$ git add .gitignore
$ git commit -m "Add .gitignore file"
$ git add .
$ edk-sanitize.sh   # Make CR/CRLF line endings consistent
$ git commit -a -m "Initial EDK commit"

Controlled file list

We only want to control files that are not generated by the build system. Use the following .gitignore file to ignore generated files. It's a list of patterns, any file that matches the pattern is ignored by git.

ppc405_?
implementation
synthesis
hdl
report
blkdiagram
__xps
*.log
*.svf
*.scr
*.cmd
*.bak
*~
*.elf
*.ace

Notes

  • Always use 'git diff HEAD' before committing changes. Make sure the diff doesn't contain anything you don't expect.
  • Chipscope files (*.cdc) are in the implementation directory. They should probably be retained, but they are excluded by the above list.
  • However, "Project"->"Clean All Generated Files" deletes the entire implementation/ directory, so if you want to keep the *.cdc files, archive them in a different subdirectory.
  • Platform Studio seems to be hard coded to generate system.make and system_incl.make. If you want to make custom changes to the make files, make sure you rename them in the project first. ("Project"->"Project Options"->"Custom Makefile").
Personal tools