zynq7000-rs/scripts/xsct-init.tcl

69 lines
1.9 KiB
Tcl
Raw Normal View History

2025-02-24 11:26:28 +01:00
if {[info exists env(IP_ADDRESS_HW_SERVER)]} {
2025-02-26 22:25:21 +01:00
set ip $env(IP_ADDRESS_HW_SERVER)
2025-02-24 11:26:28 +01:00
} else {
2025-02-26 22:25:21 +01:00
set ip "localhost"
2025-02-24 11:26:28 +01:00
}
puts "Hardware server IP address: $ip"
connect -url tcp:$ip:3121
set devices [targets]
set apu_line [string trim [targets -nocase -filter {name =~ "APU"}]]
set arm_core_0_line [string trim [targets -nocase -filter {name =~ "ARM Cortex-A9 MPCore #0"}]]
set fpga_line [string trim [targets -nocase -filter {name =~ "xc7z020"}]]
set apu_device_num [string index $apu_line 0]
set arm_core_0_num [string index $arm_core_0_line 0]
set fpga_device_num [string index $fpga_line 0]
puts "Select ps target with number: $apu_device_num"
# Select the target
target $apu_device_num
# Resetting the target involved problems when an image is stored on the flash.
# It has turned out that it is not essential to reset the system before loading
# the software components into the device.
puts "Reset target"
# Reset the target
rst
if {![file exists $env(PS_INIT_SCRIPT)]} {
2025-02-26 22:25:21 +01:00
puts "The ps init tcl script '$env(PS_INIT_SCRIPT)' does not exist"
exit 0
2025-02-24 11:26:28 +01:00
}
# Check if BITSTREAM is set and the file exists before programming FPGA
if {[info exists env(BITSTREAM)] && [file exists $env(BITSTREAM)]} {
puts "Set FPGA target with number: $fpga_device_num"
target $fpga_device_num
# Without this delay, the FPGA programming will fail
after 1500
puts "Program bitstream $env(BITSTREAM)"
# Program FPGA
fpga -f $env(BITSTREAM)
} else {
2025-02-26 22:25:21 +01:00
puts "Skipping bitstream programming (BITSTREAM is not set or file does not exist)"
2025-02-24 11:26:28 +01:00
}
puts "Set ps target with device number: $arm_core_0_num"
targets $arm_core_0_num
puts "Initialize processing system"
# Init processing system
source $env(PS_INIT_SCRIPT)
ps7_init
ps7_post_config
puts "Set arm core 0 target with number: $arm_core_0_num"
target $arm_core_0_num
2025-02-26 22:25:21 +01:00
if {[info exists env(APP)] && [file exists $env(APP)]} {
puts "Download app $env(APP) to target"
dow $env(APP)
}
2025-02-24 11:26:28 +01:00
2025-02-26 22:25:21 +01:00
puts "Successful"