cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
troelsfr
Observer
Observer
27,145 Views
Registered: ‎10-23-2014

Programming FPGA from command line

Jump to solution

Hi everyone,

 

How do I download a bitstream to the FPGA from the command line? It is fairly easy to do in Project mode, but in non-project mode I am somehow stuck with a bitstream and no clue of how to program my FPGA, so any hints would really be appreciated.

 

Thanks,

Troels

0 Kudos
1 Solution

Accepted Solutions
pulim
Xilinx Employee
Xilinx Employee
41,912 Views
Registered: ‎02-16-2014

Hi,

 

Here is a example script to do that, if you are looking to program the HW from command line.

 

# Connect to the Digilent Cable on localhost:3121


connect_hw_server -url localhost:3121
current_hw_target [get_hw_targets */xilinx_tcf/Digilent/12345]
open_hw_target


# Program and Refresh the XC7K325T Device


current_hw_device [lindex [get_hw_devices] 0]
refresh_hw_device -update_hw_probes false [lindex [get_hw_devices] 0]
set_property PROGRAM.FILE {C:/design.bit} [lindex [get_hw_devices] 0]
set_property PROBES.FILE {C:/design.ltx} [lindex [get_hw_devices] 0]

 

program_hw_devices [lindex [get_hw_devices] 0]
refresh_hw_device [lindex [get_hw_devices] 0]

 

Please refer to the document refered by others for more info.

 

 

 

 

View solution in original post

0 Kudos
10 Replies
troelsfr
Observer
Observer
27,144 Views
Registered: ‎10-23-2014

Please note that I am using Vivado and not ISE.

0 Kudos
vemulad
Xilinx Employee
Xilinx Employee
27,138 Views
Registered: ‎09-20-2012

Hi,

 

Open Vivado and Open Hardware manager from Flow --> Open hardware Manager.

 

Now connect to the board and load the bit file generated in non-project mode.

 

In case if you are looking for command line method to dump the bit file on board refer to page-83 of http://www.xilinx.com/support/documentation/sw_manuals/xilinx2014_1/ug908-vivado-programming-debugging.pdf

 

Thanks,

Deepika.

Thanks,
Deepika.
--------------------------------------------------------------------------------------------
Google your question before posting. If someone's post answers your question, mark the post as answer with "Accept as solution". If you see a particularly good and informative post, consider giving it Kudos (the star on the left)
0 Kudos
vuppala
Xilinx Employee
Xilinx Employee
27,137 Views
Registered: ‎04-16-2012

Hello

 

Check this user guide: http://www.xilinx.com/support/documentation/sw_manuals/xilinx2014_4/ug908-vivado-programming-debugging.pdf

 

It will help you with different switches and commands.

 

Thanks,

Vinay

--------------------------------------------------------------------------------------------
Have you tried typing your question in Google? If not you should before posting. Also, MARK this is as an answer in case it helped resolve your query/issue.Give kudos to the post that helped you to find the solution.
0 Kudos
ashishd
Xilinx Employee
Xilinx Employee
27,120 Views
Registered: ‎02-14-2014

Hello,

In non-project mode, you need to take special care about some commands. You need to specify them explicitly. For an example, in project mode the ILA probe file is automatically created during the implementation process. But in non-project mode you need to create it separately with below command

write_debug_probes filename.ltx

These and such differences you can figure out by going through UG pointed by Vinay and Deepika.

Regards,
Ashish
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
pulim
Xilinx Employee
Xilinx Employee
41,913 Views
Registered: ‎02-16-2014

Hi,

 

Here is a example script to do that, if you are looking to program the HW from command line.

 

# Connect to the Digilent Cable on localhost:3121


connect_hw_server -url localhost:3121
current_hw_target [get_hw_targets */xilinx_tcf/Digilent/12345]
open_hw_target


# Program and Refresh the XC7K325T Device


current_hw_device [lindex [get_hw_devices] 0]
refresh_hw_device -update_hw_probes false [lindex [get_hw_devices] 0]
set_property PROGRAM.FILE {C:/design.bit} [lindex [get_hw_devices] 0]
set_property PROBES.FILE {C:/design.ltx} [lindex [get_hw_devices] 0]

 

program_hw_devices [lindex [get_hw_devices] 0]
refresh_hw_device [lindex [get_hw_devices] 0]

 

Please refer to the document refered by others for more info.

 

 

 

 

View solution in original post

0 Kudos
aher
Xilinx Employee
Xilinx Employee
27,106 Views
Registered: ‎07-21-2014

hi,

 

you can once program the fpga using project mode and generate all the tcl command in the tcl console.

make your own script and see if it is working.

for example first few commands are

open_hw

connect_hw_server

 

thank,

Shreyas

 

----------------------------------------------------------------------------------------------
Try to search answer for your issue in forums or xilinx user guides before you post a new thread.

Kindly note- Please mark the Answer as "Accept as solution" if information provided solves your query.
Give Kudos (star provided in left) to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------
Try to search answer for your issue in forums or xilinx user guides before you post a new thread.

Kindly note- Please mark the Answer as "Accept as solution" if information provided solves your query.
Give Kudos (star provided in right) to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
troelsfr
Observer
Observer
27,104 Views
Registered: ‎10-23-2014

Thanks for all of your answers - this is very helpful.

0 Kudos
sachiniisc
Observer
Observer
19,193 Views
Registered: ‎11-14-2016

How to run the tcl commands from command line?

I tried putting commands in a file and tried "xsim <filename>" which says simulation snapshot missing from command line.

 

I have a bitfile which needs to be burned. I don't want to load any project.

0 Kudos
muzaffer
Teacher
Teacher
19,165 Views
Registered: ‎03-31-2012
@sachiniisc
please don't revive 2 year old threads. Create a new one.

As to your question, xsim is for simulation. Programming the bit file is an entirely different process which is actually described in the current thread. The only piece of info missing is that the command you need to run the scripts shown is "xmd" not "xsim"
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
jyri_artec
Visitor
Visitor
3,688 Views
Registered: ‎09-28-2015

Command line Vivado script for programming FPGA, Impact.exe replacement. Save to program_fpga.tcl.
Programs first fpga device connected to local machine hw server. Both bin and bit files can be used.
Run in Windows > vivado  -mode tcl -nolog -nojournal -source path\to\program_fpga.tcl -tclargs path\to\bitfile
Run in Linux       $ vivado  -mode tcl -nolog -nojournal -source path/to/program_fpga.tcl -tclargs path/to/bitfile

set bitfile [lindex $argv 0]
if { [file exists $bitfile] != 1 } {
    puts "No bitfile $bitfile"
    quit
} else {
    puts "Using bitfile $bitfile"
}
load_features labtools
open_hw
connect_hw_server -url TCP:localhost:3121
set targu [get_hw_targets *]
current_hw_target $targu
open_hw_target
set first_hw_device [lindex [get_hw_devices] 0]
current_hw_device $first_hw_device
set_property PROGRAM.FILE $bitfile $first_hw_device
# if ila included: set_property PROBES.FILE {C:/design.ltx} $first_hw_device

program_hw_devices $first_hw_device
# in case of "ERROR: [Labtools 27-3165] End of startup status: LOW"
# check that bitstream file is for target FPGA

# if ila included: refresh_hw_device $first_hw_device
quit

0 Kudos