From 81f0e417d46004e3ea6ec4b0b0ae35f2d9d45fc1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 25 Nov 2014 18:34:44 +0100 Subject: [PATCH] Add Vivado version check to adi_project_create The scripts generating the projects files typically only work correctly with one specific version of Vivado. If a incorrect version is used the script may fail at some point with a cryptic error message or may not fail but create a bitstream that is not working as expected, e.g. unconnected signals, etc. This patch adds a version check to adi_project_create that will error out early on stating that the wrong version of Vivado was used and which is the right version to use. By default the required version will be the version that is required by the common scripts. Individual projects can overwrite the required version by setting the REQUIRED_VIVADO_VERSION variable to the required version or can bypass the version check completely by setting the IGNORE_VERSION_CHECK variable to 1. Callers of the script can also disable the version check by setting the ADI_IGNORE_VERSION_CHECK environment variable. Signed-off-by: Lars-Peter Clausen --- projects/scripts/adi_project.tcl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/projects/scripts/adi_project.tcl b/projects/scripts/adi_project.tcl index 94c6c7d87..9459aed4e 100644 --- a/projects/scripts/adi_project.tcl +++ b/projects/scripts/adi_project.tcl @@ -1,11 +1,23 @@ set xl_board "none" +if {![info exists REQUIRED_VIVADO_VERSION]} { + set REQUIRED_VIVADO_VERSION "2014.2" +} + +if {[info exists ::env(ADI_IGNORE_VERSION_CHECK)]} { + set IGNORE_VERSION_CHECK 1 +} elseif {![info exists IGNORE_VERSION_CHECK]} { + set IGNORE_VERSION_CHECK 0 +} + proc adi_project_create {project_name} { global ad_hdl_dir global ad_phdl_dir global xl_board + global REQUIRED_VIVADO_VERSION + global IGNORE_VERSION_CHECK set xl_board "none" set project_part "none" @@ -78,6 +90,10 @@ proc adi_project_create {project_name} { # vivado - 7 and up + if {!$IGNORE_VERSION_CHECK && [string compare [version -short] $REQUIRED_VIVADO_VERSION] != 0} { + return -code error [format "ERROR: This project requires Vivado %s." $REQUIRED_VIVADO_VERSION] + } + set project_system_dir "./$project_name.srcs/sources_1/bd/system" create_project $project_name . -part $project_part -force