Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vivado-wrapper
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
vivado-wrapper
Commits
708ef003
There was an error fetching the commit references. Please try again later.
Unverified
Commit
708ef003
authored
6 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
better message output formatting, no-source detection
parent
0f55389c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vivado-wrapper
+41
-22
41 additions, 22 deletions
vivado-wrapper
with
41 additions
and
22 deletions
vivado-wrapper
+
41
−
22
View file @
708ef003
...
...
@@ -3,14 +3,16 @@
_vw_bin_name
=
"
$0
"
_vw_version_major
=
"1"
_vw_version_minor
=
"3"
_vw_version
=
"
${
_vw_version_major
}
.
${
_vw_version_minor
}
"
_vw_version_minor
=
"4"
_vw_version_ext
=
""
_vw_version
=
"
${
_vw_version_major
}
.
${
_vw_version_minor
}${
_vw_version_ext
}
"
[[
$_vw_version_major
==
0
]]
&&
echo
"Vivado wrapper is unfinished, and unable to work."
&&
exit
11
[[
$_vw_bin_name
==
''
]]
&&
_vw_bin_name
=
vivado-wrapper
trap
"exit 9"
TERM
export
_vw_mypid
=
$$
shopt
-s
nullglob
function
show_help
()
{
echo
"Vivado wrapper
${
_vw_version
}
...
...
@@ -63,6 +65,18 @@ Examples:
function
echo2
()
{
echo
$@
>
/dev/fd/2
}
function
echo_err
()
{
echo2
"[VIVADOW ERROR] "
$@
}
function
echo_warn
()
{
echo2
"[VIVADOW WARNING] "
$@
}
function
echo_info
()
{
echo2
"[VIVADOW INFO] "
$@
}
function
echo_debug
()
{
[[
$_vw_version_ext
==
'dev'
]]
&&
echo2
"[VIVADOW DEBUG] "
$@
}
function
where_is_him
()
{
SOURCE
=
"
$1
"
...
...
@@ -100,14 +114,14 @@ function import_vivadofile_impl () {
function
import_vivadofile
()
{
import_vivadofile_impl
[[
$?
==
1
]]
&&
echo
'Vivadofile, vivadofile, VivadoFile, VIVADOFILE not found.'
&&
return
1
[[
!
-e
${
vivado_exec
}
]]
&&
echo
"vivado_exec '
${
vivado_exec
}
' not found."
&&
return
1
[[
!
-x
${
vivado_exec
}
]]
&&
echo
"vivado_exec '
${
vivado_exec
}
' not executable."
&&
return
1
[[
$?
==
1
]]
&&
echo
_err
'Vivadofile, vivadofile, VivadoFile, VIVADOFILE not found.'
&&
return
1
[[
!
-e
${
vivado_exec
}
]]
&&
echo
_err
"vivado_exec '
${
vivado_exec
}
' not found."
&&
return
1
[[
!
-x
${
vivado_exec
}
]]
&&
echo
_err
"vivado_exec '
${
vivado_exec
}
' not executable."
&&
return
1
[[
"
${
thread_num
}
"
==
''
]]
&&
thread_num
=
1
[[
"
${
sources
[*]
}
"
==
''
]]
&&
echo
"sources not provided."
&&
return
1
[[
"
${
bit_dir
}
"
==
''
]]
&&
echo
"bit_dir not provided."
&&
return
1
[[
"
${
top_modules
[*]
}
"
==
''
]]
&&
echo
"top_modules not provided."
&&
return
1
[[
"
${
top_module
}
"
==
''
]]
&&
echo
"top_module not provided."
&&
return
1
[[
"
${
sources
[*]
}
"
==
''
]]
&&
echo
_err
"sources not provided."
&&
return
1
[[
"
${
bit_dir
}
"
==
''
]]
&&
echo
_err
"bit_dir not provided."
&&
return
1
[[
"
${
top_modules
[*]
}
"
==
''
]]
&&
echo
_err
"top_modules not provided."
&&
return
1
[[
"
${
top_module
}
"
==
''
]]
&&
echo
_err
"top_module not provided."
&&
return
1
return
0
}
...
...
@@ -120,17 +134,20 @@ function get_constraint_of_module () {
_value
=
${
_ele
#*
:
}
if
[[
${
_key
}
==
${
_mod_name
}
]]
;
then
[[
-f
"
${
_value
}
"
]]
&&
echo
-n
"
${
_value
}
"
&&
return
0
echo
2
"Error:
constraint file '
${
_value
}
' not found."
echo
_err
"
constraint file '
${
_value
}
' not found."
fi
done
echo
2
"Error:
Can not find constraint for module '
$_mod_name
'"
# `exit 9` won't work
.
echo
_err
"
Can not find constraint for module '
$_mod_name
'"
# `exit 9` won't work
here. So I'm killing myself.
kill
-s
TERM
$_vw_mypid
# exit
}
function
vivado_check_and_init_template
()
{
[[
-z
"
$board
"
]]
&&
echo
"You must set variable 'board'. Try
\`
vivadow init
\`
again."
&&
return
4
[[
-z
"
$board
"
]]
&&
echo
_err
"You must set variable 'board'. Try
\`
vivadow init
\`
again."
&&
return
4
[[
-d
"
$my_path
/template/
$board
"
]]
&&
return
0
echo_warn
"Creating a new template for board
$board
. You may need permission to write to installation directory
$my_path
/template/"
"
$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
||
return
$?
rm
"
$my_path
/template/
$board
/temp_project.srcs/constrs_1/new/constraint.xdc"
...
...
@@ -148,18 +165,20 @@ function generate_real_project () {
[[
${
constr_path
:
-4
}
==
".vwc"
]]
&&
"
$my_path
/vwc2xdc.sh"
"
$constr_path
"
>
"
$temp_dir
/generated.xdc"
&&
constr_path
=
"
$temp_dir
/generated.xdc"
# Move sources and constraints
echo_debug
${#
sources
[@]
}
${
sources
[@]
}
[[
${#
sources
[@]
}
-eq
0
]]
&&
echo_warn
"No source file detected. However, I'll continue and have a try."
_real_proj_src
=
"
$temp_dir
/project/temp_project.srcs"
for
src
in
`
echo
${
sources
[@]
}
`
;
do
mkdir
-p
"
$_real_proj_src
/sources_1/new/
$(
dirname
"
$src
"
)
"
ln
-s
"
$(
pwd
)
/
$src
"
"
$_real_proj_src
/sources_1/new/
$src
"
done
ln
-s
"
$constr_path
"
"
$_real_proj_src
/constrs_1/new/constraint.xdc"
echo
"real_project generated at
$temp_dir
"
echo
_info
"real_project generated at
$temp_dir
"
}
function
clean_real_project
()
{
rm
-rf
$temp_dir
./.Xil
echo
"real_project cleaned"
echo
_info
"real_project cleaned"
}
function
cp_with_backup
()
{
...
...
@@ -172,23 +191,23 @@ function cp_with_backup () {
function
do_init
()
{
mkdir
-p
constraint build src
cp_with_backup
"
$my_path
"
/template/Vivadofile ./Vivadofile
echo
"I'll provide a constraint file for xc7a100tcsg324-1, which is used by HUST students. Remove it if it's not your case."
echo
_info
"I'll provide a constraint file for xc7a100tcsg324-1, which is used by HUST students. Remove it if it's not your case."
cp_with_backup
"
$my_path
"
/template/xc7a100tcsg324-1.xdc ./constraint/xc7a100tcsg324-1.xdc
cp_with_backup
"
$my_path
"
/template/xc7a100tcsg324-1.vwc ./constraint/xc7a100tcsg324-1.vwc
echo
"Vivadow project inited."
echo
_info
"Vivadow project inited."
}
function
do_build
()
{
generate_real_project
[[
$?
-ne
0
]]
&&
echo
"Generate real project failed."
&&
clean_real_project
&&
return
4
[[
$?
-ne
0
]]
&&
echo
_err
"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
]]
&&
echo
2
"vivado-wrapper: Error:
Build failed. Please check previous error report."
&&
clean_real_project
&&
return
$_ret
[[
$_ret
-ne
0
]]
&&
echo
_err
"
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"
[[
$?
-ne
0
]]
&&
echo
2
"vivado-wrapper: Error: Build failed. Please check previous error report."
&&
clean_real_project
&&
return
5
[[
$?
-ne
0
]]
&&
echo
_err
"vivado-wrapper: Error: Build failed. Please check previous error report."
&&
clean_real_project
&&
return
5
clean_real_project
}
...
...
@@ -223,7 +242,7 @@ shift
[[
$vw_cmd
==
'--help'
]]
&&
show_help
&&
exit
0
if
[[
$vw_cmd
==
'build'
]]
||
[[
$vw_cmd
==
'burn'
]]
||
[[
$vw_cmd
==
'gui'
]]
;
then
import_vivadofile
[[
$?
!=
0
]]
&&
echo
"Vivadofile error reported. Exiting..."
&&
exit
2
[[
$?
!=
0
]]
&&
echo
_err
"Vivadofile error reported. Exiting..."
&&
exit
2
fi
naive_opt
$@
...
...
@@ -245,7 +264,7 @@ case $vw_cmd in
burn_file
$1
;;
*
)
echo
"Unknown command '
${
vw_cmd
}
', try '
${
_vw_bin_name
}
--help'"
echo
_err
"Unknown command '
${
vw_cmd
}
', try '
${
_vw_bin_name
}
--help'"
;;
esac
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment