Skip to content

Commit 15eeaf9

Browse files
committed
Add: new Updated zynq_bp.tcl.in as zynqmp_bp.tcl.in file.
With generation of .hdf hw definition file including bitstream Signed-off-by: Holotronic <producer@holotronic.dk>
1 parent 2e9a586 commit 15eeaf9

File tree

4 files changed

+240
-3
lines changed

4 files changed

+240
-3
lines changed

HW/VivadoProjects/avnet/ultra96/ultra96v1_config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# TCL Template Filename
4-
TCL_TEMP_FILE=../../zynq_bp.tcl.in
4+
TCL_TEMP_FILE=../../zynqmp_bp.tcl.in
55

66
# The fpga device we are building for
77
FPGA_DEVICE=xczu3eg-sbva484-1-e

HW/VivadoProjects/avnet/ultra96/ultra96v2_config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# TCL Template Filename
4-
TCL_TEMP_FILE=../../zynq_bp.tcl.in
4+
TCL_TEMP_FILE=../../zynqmp_bp.tcl.in
55

66
# The fpga device we are building for
77
FPGA_DEVICE=xczu3eg-sbva484-1-e

HW/VivadoProjects/make_bitfile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ cd ../VivadoProjects
8484
/tools/Xilinx/Vivado/2019.1/bin/vivado -mode batch -source "$PRJ_FILE"
8585

8686
# bootgen: skip ultre96 projects
87-
if test "${1#*"ultra96"}" = "$1"; then
87+
if test "${1#*"ultra96"}" = "$1" && test "${1#*"fz3"}" = "$1"; then
8888

8989
# Update the bif file for bootgen
9090
# component file1 needs the pin file path

HW/VivadoProjects/zynqmp_bp.tcl.in

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
#
2+
# Vivado (TM) v2019.1 (64-bit)
3+
#
4+
# Tcl script template for re-creating zynq projects
5+
#
6+
# Generated by Vivado on Wed Apr 20 01:20:00 UTC 2016
7+
# IP Build 1412160 on Tue Nov 17 13:47:24 MST 2019
8+
#
9+
# This file contains the Vivado Tcl commands for re-creating the project to the state*
10+
# when this script was generated. In order to re-create the project, please source this
11+
# file in the Vivado Tcl Shell.
12+
#
13+
# * Note that the runs in the created project will be configured the same way as the
14+
# original project, however they will not be launched automatically. To regenerate the
15+
# run results please launch the synthesis/implementation runs as needed.
16+
#
17+
18+
# Set the reference directory for source file relative paths (by default the value is script directory path)
19+
set origin_dir [file dirname [info script]]
20+
set origin_dir "${origin_dir}/../"
21+
22+
# Use origin directory path location variable, if specified in the tcl shell
23+
if { [info exists ::origin_dir_loc] } {
24+
set origin_dir $::origin_dir_loc
25+
}
26+
27+
# Setup some helpful variables passed in by the make script
28+
set prj_name %PRJ_NAME%
29+
set pin_const_file $origin_dir/%PIN_HW_XDC_FILE%
30+
set fpgadev_name %FPGA_DEVICE%
31+
set board_part "%BOARD_PART%"
32+
set bitfile_name %BIT_FILE%
33+
set top_lvl_bd_script_file %TOP_LEVEL_BD_FILE%
34+
set prj_created_dir "$origin_dir/${prj_name}_created"
35+
set script_file "${prj_name}.tcl"
36+
37+
# Help information for this script
38+
proc help {} {
39+
variable script_file
40+
puts "\nDescription:"
41+
puts "Recreate a Vivado project from this script. The created project will be"
42+
puts "functionally equivalent to the original project for which this script was"
43+
puts "generated. The script contains commands for creating a project, filesets,"
44+
puts "runs, adding/importing sources and setting properties on various objects.\n"
45+
puts "Syntax:"
46+
puts "$script_file"
47+
puts "$script_file -tclargs \[--origin_dir <path>\]"
48+
puts "$script_file -tclargs \[--help\]\n"
49+
puts "Usage:"
50+
puts "Name Description"
51+
puts "-------------------------------------------------------------------------"
52+
puts "\[--origin_dir <path>\] Determine source file paths wrt this path. Default"
53+
puts " origin_dir path value is \".\", otherwise, the value"
54+
puts " that was set with the \"-paths_relative_to\" switch"
55+
puts " when this script was generated.\n"
56+
puts "\[--help\] Print help information for this script"
57+
puts "-------------------------------------------------------------------------\n"
58+
exit 0
59+
}
60+
61+
if { $::argc > 0 } {
62+
for {set i 0} {$i < [llength $::argc]} {incr i} {
63+
set option [string trim [lindex $::argv $i]]
64+
switch -regexp -- $option {
65+
"--origin_dir" { incr i; set origin_dir [lindex $::argv $i] }
66+
"--help" { help }
67+
default {
68+
if { [regexp {^-} $option] } {
69+
puts "ERROR: Unknown option '$option' specified, please type '$script_file -tclargs --help' for usage info.\n"
70+
return 1
71+
}
72+
}
73+
}
74+
}
75+
}
76+
77+
# Set the directory path for the original project from where this script was exported
78+
set orig_proj_dir "[file normalize $prj_created_dir]"
79+
80+
# Create project
81+
create_project "$prj_name" $prj_created_dir
82+
83+
# Set the directory path for the new project
84+
set proj_dir [get_property directory [current_project]]
85+
86+
# Set project properties
87+
set obj [get_projects $prj_name]
88+
if {$board_part ne ""} {
89+
set_property "part" "$fpgadev_name" $obj
90+
set_property "board_part" $board_part $obj
91+
} else {
92+
set_property "part" "$fpgadev_name" $obj
93+
}
94+
set_property "default_lib" "xil_defaultlib" $obj
95+
set_property "sim.ip.auto_export_scripts" "1" $obj
96+
set_property "simulator_language" "Mixed" $obj
97+
set_property "target_language" "VHDL" $obj
98+
99+
# Create 'sources_1' fileset (if not found)
100+
if {[string equal [get_filesets -quiet sources_1] ""]} {
101+
create_fileset -srcset sources_1
102+
}
103+
104+
# Set IP repository paths
105+
set obj [get_filesets sources_1]
106+
set prj_ip_path "[file normalize "$origin_dir/../../../zynq-ip"]"
107+
# Include a project local IP repository if it exists
108+
if {[file isdirectory "$origin_dir/ip"]} {
109+
set prj_ip_path "$prj_ip_path $origin_dir/ip"
110+
}
111+
set_property "ip_repo_paths" "$prj_ip_path" $obj
112+
113+
# Rebuild user ip_repo's index before adding any source files
114+
update_ip_catalog -rebuild
115+
116+
# Build the bd
117+
source $origin_dir/$top_lvl_bd_script_file
118+
# Create the hdl wrapper file
119+
make_wrapper -files [get_files $proj_dir/${prj_name}.srcs/sources_1/bd/soc_system/soc_system.bd] -top
120+
add_files -norecurse $orig_proj_dir/${prj_name}.srcs/sources_1/bd/soc_system/hdl/soc_system_wrapper.vhd
121+
122+
# Set 'sources_1' fileset object
123+
set obj [get_filesets sources_1]
124+
set files [list \
125+
[file normalize "$prj_created_dir/${prj_name}.srcs/sources_1/bd/soc_system/hdl/soc_system_wrapper.vhd" ]\
126+
[file normalize "$prj_created_dir/firmware_id.mif" ]\
127+
]
128+
129+
#add_files -norecurse -fileset $obj $files
130+
set imported_files [import_files -fileset sources_1 $files]
131+
132+
set file "hdl/soc_system_wrapper.vhd"
133+
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
134+
set_property -name "file_type" -value "VHDL" -objects $file_obj
135+
136+
#set file "${prj_name}_created/firmware_id.mif"
137+
set file "firmware_id.mif"
138+
set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
139+
set_property -name "file_type" -value "Memory Initialization Files" -objects $file_obj
140+
141+
# Set 'sources_1' fileset properties
142+
set obj [get_filesets sources_1]
143+
set_property "top" "soc_system_wrapper" $obj
144+
145+
# Create 'constrs_1' fileset (if not found)
146+
if {[string equal [get_filesets -quiet constrs_1] ""]} {
147+
create_fileset -constrset constrs_1
148+
}
149+
150+
# Set 'constrs_1' fileset object
151+
set obj [get_filesets constrs_1]
152+
153+
# Add/Import constrs file and set constrs file properties
154+
set file "[file normalize "$pin_const_file"]"
155+
set file_added [add_files -norecurse -fileset $obj $file]
156+
set file "$pin_const_file"
157+
set file [file normalize $file]
158+
set file_obj [get_files -of_objects [get_filesets constrs_1] [list "*$file"]]
159+
set_property "file_type" "XDC" $file_obj
160+
161+
# Set 'constrs_1' fileset properties
162+
set obj [get_filesets constrs_1]
163+
164+
# Create 'sim_1' fileset (if not found)
165+
if {[string equal [get_filesets -quiet sim_1] ""]} {
166+
create_fileset -simset sim_1
167+
}
168+
169+
# Set 'sim_1' fileset object
170+
set obj [get_filesets sim_1]
171+
# Empty (no sources present)
172+
173+
# Set 'sim_1' fileset properties
174+
set obj [get_filesets sim_1]
175+
set_property "top" "soc_system_wrapper" $obj
176+
set_property "xelab.nosort" "1" $obj
177+
set_property "xelab.unifast" "" $obj
178+
179+
# Create 'synth_1' run (if not found)
180+
if {[string equal [get_runs -quiet synth_1] ""]} {
181+
create_run -name synth_1 -part $fpgadev_name -flow {Vivado Synthesis 2019} -strategy "Vivado Synthesis Defaults" -constrset constrs_1
182+
} else {
183+
set_property strategy "Vivado Synthesis Defaults" [get_runs synth_1]
184+
set_property flow "Vivado Synthesis 2019" [get_runs synth_1]
185+
}
186+
set obj [get_runs synth_1]
187+
set_property "needs_refresh" "1" $obj
188+
set_property "part" "$fpgadev_name" $obj
189+
190+
# set the current synth run
191+
current_run -synthesis [get_runs synth_1]
192+
193+
# Create 'impl_1' run (if not found)
194+
if {[string equal [get_runs -quiet impl_1] ""]} {
195+
create_run -name impl_1 -part $fpgadev_name -flow {Vivado Implementation 2019} -strategy "Vivado Implementation Defaults" -constrset constrs_1 -parent_run synth_1
196+
} else {
197+
set_property strategy "Vivado Implementation Defaults" [get_runs impl_1]
198+
set_property flow "Vivado Implementation 2019" [get_runs impl_1]
199+
}
200+
set obj [get_runs impl_1]
201+
set_property "needs_refresh" "1" $obj
202+
set_property "part" "$fpgadev_name" $obj
203+
set_property "steps.write_bitstream.args.readback_file" "0" $obj
204+
set_property "steps.write_bitstream.args.verbose" "0" $obj
205+
206+
# set the current impl run
207+
current_run -implementation [get_runs impl_1]
208+
209+
puts "INFO: Project created: $prj_name"
210+
211+
# reset the runs just in case
212+
reset_run synth_1
213+
reset_run impl_1
214+
215+
# Launch the runs
216+
set_property synth_checkpoint_mode None [get_files $prj_created_dir/$prj_name.srcs/sources_1/bd/soc_system/soc_system.bd]
217+
generate_target all [get_files $prj_created_dir/$prj_name.srcs/sources_1/bd/soc_system/soc_system.bd]
218+
export_ip_user_files -of_objects [get_files $prj_created_dir/$prj_name.srcs/sources_1/bd/soc_system/soc_system.bd] -no_script -sync -force -quiet
219+
220+
launch_runs impl_1 -to_step write_bitstream -jobs 16
221+
wait_on_run impl_1
222+
223+
open_run impl_1
224+
225+
# Write the bitstream
226+
write_bitstream "$prj_created_dir/$bitfile_name"
227+
228+
# Write the hw platform
229+
set sdk_workspace [file join $prj_created_dir $prj_name.sdk]
230+
231+
if { [file exists $sdk_workspace] == 0 } {
232+
file mkdir $sdk_workspace
233+
}
234+
235+
set design_top_name [get_property "top" [current_fileset]]
236+
237+
file copy -force [file join $prj_created_dir $prj_name.runs "impl_1" $design_top_name.sysdef] [file join $sdk_workspace $design_top_name.hdf]

0 commit comments

Comments
 (0)