diff options
author | Sam O'Brien <sam.obrien@ni.com> | 2021-06-09 09:28:22 -0500 |
---|---|---|
committer | Wade Fife <wade.fife@ettus.com> | 2021-06-10 08:33:22 -0500 |
commit | 471de61e4d9e53a038942f21f61d4b481b5f9853 (patch) | |
tree | 55348716fe0002079e71200009efb71a802aa4d3 /fpga | |
parent | 4fd3bfe203157e9767bcf174d26b17dd840bb130 (diff) | |
download | uhd-471de61e4d9e53a038942f21f61d4b481b5f9853.tar.gz uhd-471de61e4d9e53a038942f21f61d4b481b5f9853.tar.bz2 uhd-471de61e4d9e53a038942f21f61d4b481b5f9853.zip |
fpga: tools: Fix part selection in setupenv
The script setupenv_base.sh, which is used to setup the development
environmnet in the open source toolchain, adds some functions to the
shell that are used to interact with vivado. Some of the functions were
looking in the wrong argument for the product name. This commit fixes
the bug.
In addition, supplying an incorrect part name returned a rather opaque
error message. This commit also fixes the error handling so that the
intended error message is displayed.
Signed-off-by: Sam O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'fpga')
-rw-r--r-- | fpga/usrp3/tools/scripts/setupenv_base.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fpga/usrp3/tools/scripts/setupenv_base.sh b/fpga/usrp3/tools/scripts/setupenv_base.sh index 6ca9ff60e..cb0c546e5 100644 --- a/fpga/usrp3/tools/scripts/setupenv_base.sh +++ b/fpga/usrp3/tools/scripts/setupenv_base.sh @@ -325,8 +325,8 @@ function viv_create_ip { ip_name=$1 ip_dir=$(readlink -f $2) ip_vlnv=$3 - part_name=$(python $REPO_BASE_PATH/tools/scripts/viv_gen_part_id.py "${PRODUCT_ID_MAP[$2]}") - if [[ -z $part_name ]]; then + part_name=$(python $REPO_BASE_PATH/tools/scripts/viv_gen_part_id.py "${PRODUCT_ID_MAP[$4]}") + if [[ $? -ne 0 ]]; then echo "ERROR: Invalid product name $4. Supported: ${!PRODUCT_ID_MAP[@]}" return 1 fi @@ -376,6 +376,10 @@ function viv_modify_bd { bd_path=$(readlink -f $1) part_name=$(python $REPO_BASE_PATH/tools/scripts/viv_gen_part_id.py "${PRODUCT_ID_MAP[$2]}") + if [[ $? -ne 0 ]]; then + echo "ERROR: Invalid product name $2. Supported: ${!PRODUCT_ID_MAP[@]}" + return 1 + fi if [[ -f $bd_path ]]; then $VIVADO_EXEC -mode gui -source $(resolve_viv_path $VIV_IP_UTILS) -nolog -nojournal -tclargs modify $part_name $(resolve_viv_path $bd_path) else @@ -396,6 +400,10 @@ function viv_modify_tcl_bd { src_path=$(readlink -f $1) part_name=$(python $REPO_BASE_PATH/tools/scripts/viv_gen_part_id.py "${PRODUCT_ID_MAP[$2]}") + if [[ $? -ne 0 ]]; then + echo "ERROR: Invalid product name $2. Supported: ${!PRODUCT_ID_MAP[@]}" + return 1 + fi bd_ip_repo="${src_path%/top*}/lib/vivado_ipi" if [[ -f $src_path ]]; then $VIVADO_EXEC -mode gui -source $(resolve_viv_path $VIV_IP_UTILS) -nolog -nojournal -tclargs modify_bdtcl $part_name $(resolve_viv_path $src_path) $(resolve_viv_path $bd_ip_repo) @@ -416,8 +424,8 @@ function viv_ls_ip { return 1 fi - part_name=$(python $REPO_BASE_PATH/tools/scripts/viv_gen_part_id.py "${PRODUCT_ID_MAP[$2]}") - if [[ -z $part_name ]]; then + part_name=$(python $REPO_BASE_PATH/tools/scripts/viv_gen_part_id.py "${PRODUCT_ID_MAP[$1]}") + if [[ $? -ne 0 ]]; then echo "ERROR: Invalid product name $1. Supported: ${!PRODUCT_ID_MAP[@]}" return 1 fi |