2025-12-03 10:35:03 +00:00

40 lines
808 B
Tcl

if { $argc < 1 } {
puts "Usage: program_device.sh BITFILE"
exit -1
}
set bitfile [lindex $argv 0]
set hwserver "localhost:3121"
set hwtarget "$hwserver/*"
puts "Opening hardware server at $hwserver"
open_hw_manager
connect_hw_server -url $hwserver
puts "Opening target $hwtarget"
set targetlist [get_hw_targets $hwtarget]
if { [llength $targetlist] != 1 } {
puts "Failed to get hw target. Number of matching targets is not 1."
exit -2
}
set target $targetlist
current_hw_target $target
open_hw_target
puts "Refreshing device"
refresh_hw_device [current_hw_device]
puts "Programming device using bitfile $bitfile"
set_property PROGRAM.file "$bitfile" [current_hw_device]
program_hw_devices [current_hw_device]
refresh_hw_device [current_hw_device]
puts "Successfully programmed device"
exit 0