From 1bff996f8bd406a3ae329227d5abc7c7c908f293 Mon Sep 17 00:00:00 2001 From: Recolic Keghart <root@recolic.net> Date: Tue, 4 Sep 2018 20:24:58 +0800 Subject: [PATCH] correct return value if vivado fails --- vivado-wrapper | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vivado-wrapper b/vivado-wrapper index 6c631c3..97bf20c 100755 --- a/vivado-wrapper +++ b/vivado-wrapper @@ -3,7 +3,7 @@ _vw_bin_name="$0" _vw_version_major="1" -_vw_version_minor="2" +_vw_version_minor="3" _vw_version="${_vw_version_major}.${_vw_version_minor}" [[ $_vw_version_major == 0 ]] && echo "Vivado wrapper is unfinished, and unable to work." && exit 11 @@ -132,7 +132,7 @@ function vivado_check_and_init_template () { [[ -z "$board" ]] && echo "You must set variable 'board'. Try \`vivadow init\` again." && return 4 [[ -d "$my_path/template/$board" ]] && return 0 "$my_path/gen_tcl.sh" init-project temp_project "$my_path/template/$board" "$board" > $temp_dir/sh.tcl - "$vivado_exec" -mode batch -source "$temp_dir/sh.tcl" -nojournal -nolog + "$vivado_exec" -mode batch -source "$temp_dir/sh.tcl" -nojournal -nolog || return $? rm "$my_path/template/$board/temp_project.srcs/constrs_1/new/constraint.xdc" rm -rf "$my_path/template/$board/temp_project.cache/"* } @@ -180,12 +180,15 @@ function do_init () { function do_build () { generate_real_project - [[ $? -ne 0 ]] && echo "Generate real project failed." && clean_real_project && exit 4 + [[ $? -ne 0 ]] && echo "Generate real project failed." && clean_real_project && return 4 "$my_path/gen_tcl.sh" build "$temp_dir/project/temp_project.xpr" synth_1 impl_1 write_bitstream "$top_module" $thread_num > $temp_dir/sh.tcl "$vivado_exec" -mode batch -source "$temp_dir/sh.tcl" -nojournal -nolog + _ret=$? + [[ $_ret -ne 0 ]] && echo2 "vivado-wrapper: Error: Build failed. Please check previous error report." && clean_real_project && return $_ret _bit_file="$temp_dir/project/temp_project.runs/impl_1/$top_module.bit" - [[ -e "$_bit_file" ]] && cp "$_bit_file" "$bit_dir/$top_module.bit" || echo "vivado-wrapper: Error: Build failed. Please check previous error report." + [[ -e "$_bit_file" ]] && cp "$_bit_file" "$bit_dir/$top_module.bit" + [[ $? -ne 0 ]] && echo2 "vivado-wrapper: Error: Build failed. Please check previous error report." && clean_real_project && return 5 clean_real_project } @@ -194,6 +197,7 @@ function burn_file () { file_to_burn="$1" "$my_path/gen_tcl.sh" burn-file "$file_to_burn" "$device_name" > $temp_dir/sh.tcl "$vivado_exec" -mode batch -source "$temp_dir/sh.tcl" -nojournal -nolog + return $? } function do_burn () { @@ -245,3 +249,4 @@ case $vw_cmd in ;; esac +exit $? -- GitLab