# Template: Steps 4+5 - Connect hardware, configure cfgmem, and program Flash # Called by program_flash.py via: vivado -mode batch -source step4_5_program.tcl -tclargs # # Arguments (passed via -tclargs): # argv[0] = FLASH_PART - Flash part name, e.g. w25q128bv-spi-x1_x2_x4 # argv[1] = BIT_FILE_PATH - Full path to the .bit file # argv[2] = MCS_FILE_PATH - Full path to the .mcs file # argv[3] = LTX_FILE_PATH - Full path to .ltx file, or empty string "" if no ILA # # Success indicator: output contains "End of startup status: HIGH" and no ERROR lines set flash_part [lindex $argv 0] set bit_file [lindex $argv 1] set mcs_file [lindex $argv 2] set ltx_file [lindex $argv 3] set has_ltx [expr {$ltx_file ne ""}] open_hw connect_hw_server open_hw_target set_property PROGRAM.FILE $bit_file [get_hw_devices xc7a200t_0] if {$has_ltx} { set_property PROBES.FILE $ltx_file [get_hw_devices xc7a200t_0] set_property FULL_PROBES.FILE $ltx_file [get_hw_devices xc7a200t_0] } current_hw_device [get_hw_devices xc7a200t_0] refresh_hw_device [lindex [get_hw_devices xc7a200t_0] 0] create_hw_cfgmem -hw_device [lindex [get_hw_devices xc7a200t_0] 0] \ [lindex [get_cfgmem_parts $flash_part] 0] set_property PROGRAM.BLANK_CHECK 0 [get_property PROGRAM.HW_CFGMEM [lindex [get_hw_devices xc7a200t_0] 0]] set_property PROGRAM.ERASE 1 [get_property PROGRAM.HW_CFGMEM [lindex [get_hw_devices xc7a200t_0] 0]] set_property PROGRAM.CFG_PROGRAM 1 [get_property PROGRAM.HW_CFGMEM [lindex [get_hw_devices xc7a200t_0] 0]] set_property PROGRAM.VERIFY 1 [get_property PROGRAM.HW_CFGMEM [lindex [get_hw_devices xc7a200t_0] 0]] set_property PROGRAM.CHECKSUM 0 [get_property PROGRAM.HW_CFGMEM [lindex [get_hw_devices xc7a200t_0] 0]] set_property PROGRAM.FILES [list $mcs_file] \ [get_property PROGRAM.HW_CFGMEM [lindex [get_hw_devices xc7a200t_0] 0]] refresh_hw_device [lindex [get_hw_devices xc7a200t_0] 0] if {$has_ltx} { set_property PROBES.FILE $ltx_file [get_hw_devices xc7a200t_0] set_property FULL_PROBES.FILE $ltx_file [get_hw_devices xc7a200t_0] } set_property PROGRAM.FILE $bit_file [get_hw_devices xc7a200t_0] program_hw_devices [get_hw_devices xc7a200t_0] refresh_hw_device [lindex [get_hw_devices xc7a200t_0] 0]