Skip to content

Commit

Permalink
correct return value if vivado fails
Browse files Browse the repository at this point in the history
  • Loading branch information
recolic committed Sep 4, 2018
1 parent d49d754 commit 1bff996
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions vivado-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/"*
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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 () {
Expand Down Expand Up @@ -245,3 +249,4 @@ case $vw_cmd in
;;
esac

exit $?

0 comments on commit 1bff996

Please sign in to comment.