Success! Subscription added.
Success! Subscription removed.
Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your profile.
This wiki entry is dedicated towards using tcl scripts to automatically generate cdf files and a executable file to program Altera devices within a JTAG Chain. The example uses the Cyclone V GX ATSO3 board with 2 Cyclone V GX C9 parts on the board and in the chain.
The tcl file contents are as follows:
# From a NIOS II command shell
#
# Use the quartus_sh command as follows:
# quartus_sh -t ./program_chain_arg_cdf.tcl 0 1
# to program on USB0 device 1
# quartus_sh -t ./program_chain_arg_cdf.tcl 0 2
# to program on USB0 device 2
# quartus_sh -t ./program_chain_arg_cdf.tcl 0 ALL
# to program on USB0 all devices
#
# After running this script, run the following command to program your device(s)
# ./program_chain1.tcl
set fileout [open "LED_Test.cdf" "w"]
set USB_num [lindex $argv 0]
set device_num [lindex $argv 1]
puts $fileout "\/\* Quartus II 64-Bit Version 12.1 Build 240 01\/16\/2013 Service Pack 1 SJ Full Version \*\/"
puts $fileout "JedecChain;"
puts $fileout " FileRevision\(JESD32A\);"
puts $fileout " DefaultMfr\(6E\);"
puts $fileout ""
if {$device_num == "ALL"} {
for {set i 1} {$i <= 2} {incr i} {
puts $fileout " P ActionCode\(Cfg\)"
puts $fileout " Device PartName\(5CGXFC9E6F31\) Path\(\"C\:\/altera\/kits\/CycloneV_ATSO3\/LPDDR2_HMC_CTRL\/\") File(\"LPDDR2_HMC_LED_Test.sof\"\) MfrSpec\(OpMask\(1\)\);"
}
} else {
for {set i 1} {$i <= 2} {incr i} {
if {$i == $device_num} {
puts $fileout " P ActionCode\(Cfg\)"
puts $fileout " Device PartName\(5CGXFC9E6F31\) Path\(\"C\:\/altera\/kits\/CycloneV_ATSO3\/LPDDR2_HMC_CTRL\/\") File(\"LPDDR2_HMC_LED_Test.sof\"\) MfrSpec\(OpMask\(1\)\);"
} else {
puts $fileout " P ActionCode\(Ign\)"
puts $fileout " Device PartName\(5CGXFC9E6F31\) MfrSpec\(OpMask\(0\) FullPath\(\"C\:\/altera\/kits\/CycloneV_ATSO3\/LPDDR2_HMC_CTRL\/LPDDR2_HMC_LED_Test.sof\"\)\);"
}
}
}
puts $fileout ""
puts $fileout "ChainEnd;"
puts $fileout ""
puts $fileout "AlteraBegin;"
puts $fileout " ChainType\(JTAG\);"
puts $fileout "AlteraEnd;"
puts $fileout ""
close $fileout
set fileout2 [open "program_chain1.tcl" "w"]
puts $fileout2 "quartus_pgm -c \"USB-Blaster \[USB-$USB_num\]\" LED_Test.cdf"
close $fileout2
exit
The above script can be adjusted for the your device and sof file location.
To run the script: Start up NIOS II command shell. Then,
$quartus_sh -t ./program_chain_arg_cdf.tcl 0 ALL
$./program_chain1.tcl
The above will program all devices on USB Blaster hooked up to USB0 on the PC (2 devices on the CV ATSO3 card).
$quartus_sh -t ./program_chain_arg_cdf.tcl 0 1
$./program_chain1.tcl
The above will program device 1 on USB Blaster hooked up to USB0 on the PC (2 devices on the CV ATSO3 card).
A user should adjust the loop length at line 25 and 30 depending on the number of devices in their chain. For instance, if you have 50 devices in your chain:
for {set i 1} {$i <= 50} {incr i} {
The script can be enhanced to bound the input arguments. Also, another script could be created to monitor the progress of the program_chain1.tcl file for successful programming results.
Community support is provided during standard business hours (Monday to Friday 7AM - 5PM PST). Other contact methods are available here.
Intel does not verify all solutions, including but not limited to any file transfers that may appear in this community. Accordingly, Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.
For more complete information about compiler optimizations, see our Optimization Notice.