# Usage with Vitis IDE:
# In Vitis IDE create a Single Application Debug launch configuration,
# change the debug type to 'Attach to running target' and provide this 
# tcl script in 'Execute Script' option.
# Path of this script: C:\Users\testrong\Documents\Work\NewInstrCalBoard\2.FW\Zynq\Debug_FW\Vitis_Classic\NewInstrCalBoard_system\_ide\scripts\debugger_newinstrcalboard-default.tcl
# 
# 
# Usage with xsct:
# To debug using xsct, launch xsct and run below command
# source C:\Users\testrong\Documents\Work\NewInstrCalBoard\2.FW\Zynq\Debug_FW\Vitis_Classic\NewInstrCalBoard_system\_ide\scripts\debugger_newinstrcalboard-default.tcl
# 
connect -url tcp:127.0.0.1:3121
targets -set -nocase -filter {name =~"APU*"}
rst -system
after 3000
targets -set -filter {jtag_cable_name =~ "Digilent JTAG-HS1 210249859440" && level==0 && jtag_device_ctx=="jsn-JTAG-HS1-210249859440-23732093-0"}
fpga -file C:/Users/testrong/Documents/Work/NewInstrCalBoard/2.FW/Zynq/Debug_FW/Vitis_Classic/NewInstrCalBoard/_ide/bitstream/system_wrapper.bit
targets -set -nocase -filter {name =~"APU*"}
loadhw -hw C:/Users/testrong/Documents/Work/NewInstrCalBoard/2.FW/Zynq/Debug_FW/Vitis_Classic/NewInstCal_bsp/export/NewInstCal_bsp/hw/system_wrapper.xsa -mem-ranges [list {0x40000000 0xbfffffff}] -regs
configparams force-mem-access 1
targets -set -nocase -filter {name =~"APU*"}
source C:/Users/testrong/Documents/Work/NewInstrCalBoard/2.FW/Zynq/Debug_FW/Vitis_Classic/NewInstrCalBoard/_ide/psinit/ps7_init.tcl
ps7_init
ps7_post_config
targets -set -nocase -filter {name =~ "*A9*#0"}
dow C:/Users/testrong/Documents/Work/NewInstrCalBoard/2.FW/Zynq/Debug_FW/Vitis_Classic/NewInstrCalBoard/Debug/NewInstrCalBoard.elf
configparams force-mem-access 0
bpadd -addr &main
