Add tcl scripts for opening hardware and running over jtag

This commit is contained in:
Madeline Busig 2026-07-09 09:16:00 -07:00
parent 1e3575e4a2
commit 23b5166c32
2 changed files with 70 additions and 0 deletions

9
open_hw.tcl Normal file
View File

@ -0,0 +1,9 @@
set SRC_XSA_FILE [lindex $argv 0]
set HW_WORK_DIR hw
set WORK_XSA_FILE $HW_WORK_DIR/hw.xsa
exec mkdir "$HW_WORK_DIR"
exec cp "$SRC_XSA_FILE" "$WORK_XSA_FILE"
openhw "$WORK_XSA_FILE"

61
run.tcl Normal file
View File

@ -0,0 +1,61 @@
set PART xc7z007s
set APP_ELF main.elf
set HW_WORK_DIR hw
set HW_WORK_XSA_FILE $HW_WORK_DIR/hw.xsa
set HW_ADDR_BEGIN 0x40000000
set HW_ADDR_END 0xbfffffff
# Connect to HW server and get target IDS
connect
puts "--- Targets ---"
puts "[targets]"
puts "--- ------- ---"
set TARGET_APU [lindex [targets -filter {name =~ "APU*"}] 0]
set TARGET_PS0 [lindex [targets -filter {name =~ "*A9*#0"}] 0]
set TARGET_PL [lindex [targets -filter {name =~ "$PART"}] 0]
set TARGET_APU [string trim $TARGET_APU *]
set TARGET_PS0 [string trim $TARGET_PS0 *]
set TARGET_PL [string trim $TARGET_PL *]
puts "Target APU ID: $TARGET_APU"
puts "Target PS0 ID: $TARGET_PS0"
puts "Target PL ID: $TARGET_PL"
targets $TARGET_APU
# Reset and wait
rst -system
after 3000
# Program PL
targets $TARGET_PL
fpga -file "$HW_WORK_DIR/bist.bit"
loadhw -hw "$HW_WORK_XSA_FILE" -mem-ranges [list {0x40000000 0xbfffffff}]
# Disable access protection for dow command
configparams force-mem-accesses 1
# Init and program PS
targets $TARGET_APU
source "$HW_WORK_DIR/ps7_init.tcl"
ps7_init
ps7_post_config
targets $TARGET_PS0
dow "$APP_ELF"
# Re-enable access protection
configparams force-mem-accesses 0
# Start
targets $TARGET_PS0
con