Files
b210-k7-fpga/vivado/b210_k7/build.tcl
T

67 lines
2.1 KiB
Tcl

# SPDX-License-Identifier: GPL-3.0-or-later
# Full reproducible build: project -> IP -> synthesis -> implementation ->
# bitstream/bin -> reports -> UHD-named image.
set B210_SCRIPT_DIR [file dirname [file normalize [info script]]]
source [file join $B210_SCRIPT_DIR create_project.tcl]
if {[info exists ::env(B210_JOBS)] && $::env(B210_JOBS) ne ""} {
set B210_JOBS $::env(B210_JOBS)
} else {
set B210_JOBS $B210_DEFAULT_JOBS
}
proc b210_require_run_complete {run_name} {
set status [get_property STATUS [get_runs $run_name]]
if {![string match "*Complete*" $status]} {
error "Vivado run $run_name did not complete successfully: $status"
}
}
# Reproduce the original project's out-of-context clock-IP synthesis.
foreach ip_obj [get_ips] {
set ip_name [get_property NAME $ip_obj]
create_ip_run -force $ip_obj
set ip_run_name "${ip_name}_synth_1"
if {[llength [get_runs -quiet $ip_run_name]] == 0} {
error "Expected IP synthesis run was not created: $ip_run_name"
}
launch_runs $ip_run_name -jobs $B210_JOBS
wait_on_run $ip_run_name
b210_require_run_complete $ip_run_name
}
launch_runs synth_1 -jobs $B210_JOBS
wait_on_run synth_1
b210_require_run_complete synth_1
launch_runs impl_1 -to_step write_bitstream -jobs $B210_JOBS
wait_on_run impl_1
b210_require_run_complete impl_1
open_run impl_1
source [file join $B210_SCRIPT_DIR reports.tcl]
set B210_IMAGE_DIR [file join $B210_REPO_ROOT build images]
file mkdir $B210_IMAGE_DIR
set impl_dir [get_property DIRECTORY [get_runs impl_1]]
set bit_src [file join $impl_dir ${B210_TOP}.bit]
set bin_src [file join $impl_dir ${B210_TOP}.bin]
if {![file exists $bit_src]} {
error "Expected bitstream not found: $bit_src"
}
if {![file exists $bin_src]} {
error "Expected raw bin image not found: $bin_src"
}
file copy -force $bit_src [file join $B210_IMAGE_DIR usrp_b210_fpga.bit]
file copy -force $bin_src [file join $B210_IMAGE_DIR usrp_b210_fpga.bin]
puts ""
puts "Build complete."
puts "BIT: [file join $B210_IMAGE_DIR usrp_b210_fpga.bit]"
puts "BIN: [file join $B210_IMAGE_DIR usrp_b210_fpga.bin]"
puts "Reports: $B210_REPORT_DIR"