Trying to make Vivado more git-friendly on Windows.
- Git for Windows
- Add
C:\Program Files\Git\bin
(or wherever you have yourgit.exe
) to yourPATH
Add init.tcl
(or append the relevant lines if you already have something in it) along with the scripts
directory to %APPDATA%\Roaming\Xilinx\Vivado
.
Vivado is a pain in the ass to source control decently, so these scripts provide:
-
A modified
write_project_tcl_git.tcl
script to generate the project script without absolute paths. (Original write_project_tcl.tcl is available at (https://github.com/Xilinx/XilinxTclStore/blob/master/tclapp/xilinx/projutils/write_project_tcl.tcl)) -
A git wrapper that will recreate the project script and add it before committing.
-
After creating project in Vivado you have to make 'git init' under TCL console to add you project to Git. Git init wrapper automatically creates .gitignore file with all temporary folders and logs
-
Here is an example of a possible project structure:
PROJECT_NAME ├── .git ├── .gitignore ├── project_name.tcl # Project generator script ├── project_name.srcs/ # Tracked source files │ ├── *.v │ ├── *.vhd │ └── ... ├── project_name.xpr # Untracked generated files ├── project_name.cache/ # Untracked generated files ├── project_name.hw/ # Untracked generated files ├── project_name.sim/ # Untracked generated files └── ...
-
Stage your source files with
git add
, for instancegit add project_name.srcs
-
When you are done,
git commit
your project. APROJECT_NAME.tcl
script will be created in yourC:/.../PROJECT_NAME
folder and added to your commit. -
All other Git commands (
git push
,git branch
, etc) should work from TCL console as usual. -
When opening the project after a cloning, do it by using
Tools -> Run Tcl Script...
and selecting thePROJECT_NAME.tcl
file created earlier. This will regenerate the project so that you can continue working.
TODO: Take care about SDK files (project_name.sdk/). Some of them are text but some others are binary.