# 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: /home/ruther/doc/uni/master-2/first_semester/mam/sem/vitis/spi_master_counter_system/_ide/scripts/debugger_spi_master_counter-default_9.tcl
# 
# 
# Usage with xsct:
# To debug using xsct, launch xsct and run below command
# source /home/ruther/doc/uni/master-2/first_semester/mam/sem/vitis/spi_master_counter_system/_ide/scripts/debugger_spi_master_counter-default_9.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 =~ "Xilinx TUL 1234-tulA" && level==0 && jtag_device_ctx=="jsn-TUL-1234-tulA-23727093-0"}
fpga -file /home/ruther/doc/uni/master-2/first_semester/mam/sem/vitis/spi_master_counter/_ide/bitstream/spi_peripheral.bit
targets -set -nocase -filter {name =~"APU*"}
loadhw -hw /home/ruther/doc/uni/master-2/first_semester/mam/sem/vitis/spi_peripheral/export/spi_peripheral/hw/spi_peripheral.xsa -mem-ranges [list {0x40000000 0xbfffffff}] -regs
configparams force-mem-access 1
targets -set -nocase -filter {name =~"APU*"}
source /home/ruther/doc/uni/master-2/first_semester/mam/sem/vitis/spi_master_counter/_ide/psinit/ps7_init.tcl
ps7_init
ps7_post_config
targets -set -nocase -filter {name =~ "*A9*#0"}
dow /home/ruther/doc/uni/master-2/first_semester/mam/sem/vitis/spi_master_counter/Debug/spi_master_counter.elf
configparams force-mem-access 0
targets -set -nocase -filter {name =~ "*A9*#0"}
con
