A simple command line app in bash to generate project structure to develop FPGA (pl) projects, Embedded (ps) projects, and Combined (pspl) projects using Xilinx Tools.
- Enables consistent project structrue.
- Force source and revision control.
- Xilinx Vivado 2019.1
- Xilinx SDK 2019.1
- Git Bash for Windows
-
Clone this (xpm) repo to your home (
~) directory$ cd ~ $ git clone https://github.com/riuandg5/xpm.git -
Add the following to your
~/.bash_profile# xpm export PATH=$PATH:~/xpm/src # append xpm directory to PATH alias xpm=xpm.sh # enable you to call xpm instead of xpm.sh -
Source
~/.bash_profileto your current session$ source ~/.bash_profile
$ xpm
Usage: xpm <project_name> [project_type]
[project_type]: 'pl' for Vivado Project only (Default)
'ps' for SDK Project only
'pspl' for Vivado + SDK project
-
pl Project
ex_pl │ .gitignore │ build_project.tcl │ README.md │ ├───images ├───srcs │ ├───bd │ ├───constrs │ ├───ip │ └───sim └───vivado_project -
ps Project
ex_ps │ .gitignore │ build_workspace.tcl │ README.md │ └───images -
pspl Project
ex_pspl │ README.md │ ├───images ├───pl │ │ .gitignore │ │ build_project.tcl │ │ │ ├───srcs │ │ ├───bd │ │ ├───constrs │ │ ├───ip │ │ └───sim │ └───vivado_project └───ps .gitignore build_workspace.tcl
# create pl project
$ xpm ex_pl pl
# open vivado
$ cd ex_pl
$ vivado
-
Create Project
- Set
Project Nameasvivado_project. - Set
Project Locationto/ex_pl. - Check
Create project subdirectory.
- Set
-
Set
Project TypeasRTL Project. -
Add Sources
- Add source files from
srcs, sim, and ip (.xci file)directories. - Create new source file but set location to:
srcsfor design sourcesimfor testbenches/simulation source
- Change
HDL Source Foroption for testbenches/simulation sources toSimulation only. - Uncheck
Copy sources into project.
- Add source files from
-
Add Constraints
- Add constraints files from
constrs (.xdc file)directory. - Create new constraint file but set location to
constrs. - Uncheck
Copy constraints into project.
- Add constraints files from
-
Set Default Part
-
Finish
- Whenever you add a new file, remember to set the location to
srcs,sim, orconstrsas needed. - When adding an IP from the catalog, make sure to set
IP Locationasip. See Setting Default IP Location. - When adding a BD, make sure to set
Block Design Directorytobd. Also let Vivado manage the HDL wrapper for BD. - After development, make sure to regenerate and overwrite
build_project.tclscript.- Select
File > Project > Write Tcl. - Set output file location to
build_project.tcl(overwrite). - Check
Copy sources to new projectandRecreate Block Design using TCL.
- Select
$ cd ex_pl
$ git clean -Xdn # to preview which gitignored files will be removed
$ git clean -Xdf # to force removal of the above listed files
$ vivado -source build_project.tcl
-
Setting
IP Locationasipeach time when adding a new IP from catalog is prone to mistakes. -
Also setting default IP location in settings is a global setting and not a project specific setting. That is if
/proj/A/ipis set as default IP location forproject Athen it will also be default forproject Bwhich means you may end up editing IP of project A while working in project B. -
To avoid the above scenario, and force
Remote IP Locationpractice, set the defautlt IP location to areadonly/no access locationlike:# run the following tcl commands in Vivado TCL Console # create a directory at C:/Xilinx/Vivado/2019.1/NO_ACCESS_LOCATION file mkdir $env(XILINX_VIVADO)/NO_ACCESS_LOCATION # set permissions to no access [WINDOWS] exec icacls $env(XILINX_VIVADO)/NO_ACCESS_LOCATION /deny Everyone:(OI)(CI)(F) # verify no access permissions file mkdir $env(XILINX_VIVADO)/NO_ACCESS_LOCATION/test # now set this directory as default IP location # Tools > Settings > IP > Default IP Location # use the following to reset permissions [WINDOWS] # exec icacls $env(XILINX_VIVADO)/NO_ACCESS_LOCATION /reset /t /cNow if you miss to set the IP location to
ipwhile adding a new IP from catalog then it will simply not suceed (without any popup) and throw the error in TCL Console.
# create ps project
$ xpm ex_ps ps
- Select
File > Export > Export Hardware. - Check
Include bitstream. - Export to the root of
ex_psproject.
# open sdk
$ cd ex_ps
$ xsdk -workspace .
-
Create Hardware Project
- Select
File > New > Project > Xilinx > Hardware Platform Specification. - In
Target Hardware Specificationbrowse toex_psand select.hdffile which was exported from theex_plproject. Project namewill be set automatically as<hdf_file_name_hw_platform_n>.Note: If you are manually setting the project name then do sufix it with
_hw or _hw_platform or _hw_projectso that default.gitignorecan ignore this project from tracking else modify.gitignoreaccordingly.- Hardware project will appear in the Project Explorer of SDK.
- Select
-
Create Board Support Package Project
- Select
File > New > Board Support Package. - Give it a name and check
Use default location.Note: Add
_bspas suffix in the name for default.gitignoreto work properly else modify.gitignoreaccordingly. - Select
Hardware Platform,CPU cores, andBSP OS. - BSP will appear in the Project Expolrer of SDK.
- Modify
bsp > system.mssas needed.
- Select
-
Creating Application Project
- Select
File > New > Application Project. - Give it a name and check
Use default location. - Select
OS Platform,Target Hardware,Target Software, andBSP. - Select
Templateto start with.
- Select
- Select
File > Launch SDKin Vivado. - Set
Exported Locationtoex_ps. - Set
Workspacetoex_ps. - SDK will open and hardware project will appear in the Project Explorer of SDK with name like
<hdf_file_name_hw_platform_n>.
$ cd ex_ps
$ git clean -Xdn # to preview which gitignored files will be removed
$ git clean -Xdf # to force removal of the above listed files
# use build_workspace.tcl to setup the workspace
$ xsct build_workspace.tcl
# note: the TCL script assumes that there is only one .hdf file preseent in the root of ps project.
# if no .hdf file is present then first export from vivado to root of ps project
# if more than one .hdf files are presemt then use the next method
# OR
# open workspace and follow steps in SDK GUI to recreate hardware project and import existing bsp and application projects
$ xsdk -workspace .
-
Recreate hardware project
- Select
File > New > Project > Xilinx > Hardware Platform Specification. - In
Target Hardware Specificationbrowse toex_psand select.hdffile which was exported from theex_plproject. Project namewill be set automatically as<hdf_file_name_hw_platform_n>.Note: You can also set it manually to what your BSP and Application Projects assume it to be.
- Hardware project will appear in the Project Explorer of SDK.
- Select
-
Import existing BSP and Application Projects
- Select
File > Import > General > Existing Projects into Workspace. - Select
root drectorytoex_ps. - Check the projects to import.
- Select
-
Changing references
- If you have created hardware project with a different name then you have to refer to it after importing existing BSP project.
- Right click on BSP project and select
Properties > Project References. - Check the new hardware project and uncheck the old one.
- Right click on BSP project and select
- You can also change the reference BSP of an Application Project in the same way.
- If you have created hardware project with a different name then you have to refer to it after importing existing BSP project.