diff --git a/src/finn/transformation/fpgadataflow/make_deployment.py b/src/finn/transformation/fpgadataflow/make_deployment.py index a4c751b844a2796447930eb74adad6321454ac09..051e75cda6179d92c333626f1ae708076a93c29e 100644 --- a/src/finn/transformation/fpgadataflow/make_deployment.py +++ b/src/finn/transformation/fpgadataflow/make_deployment.py @@ -26,6 +26,7 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import warnings import os import subprocess from distutils.dir_util import copy_tree @@ -64,30 +65,34 @@ class DeployToPYNQ(Transformation): # get and copy necessary files # .bit and .hwh file - vivado_pynq_proj = model.get_metadata_prop("vivado_pynq_proj") - for file in os.listdir(vivado_pynq_proj): - if file.endswith(".bit"): - bitfile = os.path.join(vivado_pynq_proj, file) - copy(bitfile, deployment_dir) - elif file.endswith(".hwh"): - hwhfile = os.path.join(vivado_pynq_proj, file) - copy(hwhfile, deployment_dir) + bitfile = model.get_metadata_prop("bitfile") + hwh_file = model.get_metadata_prop("hw_handoff") + deploy_files = [bitfile, hwh_file] + + for dfile in deploy_files: + if dfile is not None: + copy(dfile, deployment_dir) # driver.py and python libraries pynq_driver_dir = model.get_metadata_prop("pynq_driver_dir") copy_tree(pynq_driver_dir, deployment_dir) model.set_metadata_prop("pynq_deploy_dir", deployment_dir) model.set_metadata_prop("exec_mode", "remote_pynq") + if self.password == "": + prefix = "" # assume we are using an ssh key + warnings.warn("Empty password, make sure you've set up an ssh key") + else: + prefix = "sshpass -p %s " % self.password + # create target directory on PYNQ board - cmd = 'sshpass -p {} ssh {}@{} -p {} "mkdir -p {}"'.format( - self.password, self.username, self.ip, self.port, self.target_dir + cmd = prefix + 'ssh {}@{} -p {} "mkdir -p {}"'.format( + self.username, self.ip, self.port, self.target_dir ) bash_command = ["/bin/bash", "-c", cmd] process_compile = subprocess.Popen(bash_command, stdout=subprocess.PIPE) process_compile.communicate() # copy directory to PYNQ board using scp and sshpass - cmd = "sshpass -p {} scp -P{} -r {} {}@{}:{}".format( - self.password, + cmd = prefix + "scp -P{} -r {} {}@{}:{}".format( self.port, deployment_dir, self.username, diff --git a/src/finn/transformation/fpgadataflow/make_zynq_proj.py b/src/finn/transformation/fpgadataflow/make_zynq_proj.py index 0aaf65f400ef9615e8f4b11589edd2c18969053f..82dba36f242b0d08d8e5c6c8ed44a05e44a267c1 100644 --- a/src/finn/transformation/fpgadataflow/make_zynq_proj.py +++ b/src/finn/transformation/fpgadataflow/make_zynq_proj.py @@ -260,6 +260,7 @@ class MakeZYNQProject(Transformation): raise Exception("Synthesis failed, no hardware handoff file found") deploy_hwh_name = vivado_pynq_proj_dir + "/resizer.hwh" copy(hwh_name, deploy_hwh_name) + model.set_metadata_prop("hw_handoff", deploy_hwh_name) # filename for the synth utilization report synth_report_filename = vivado_pynq_proj_dir + "/synth_report.xml" model.set_metadata_prop("vivado_synth_rpt", synth_report_filename) diff --git a/src/finn/transformation/fpgadataflow/synth_pynq_proj.py b/src/finn/transformation/fpgadataflow/synth_pynq_proj.py index 54c9c805c883c17a975a0f7252e853d49471191e..7f9bbaf5665f872d4393fa173b60b2cc3a6655e9 100644 --- a/src/finn/transformation/fpgadataflow/synth_pynq_proj.py +++ b/src/finn/transformation/fpgadataflow/synth_pynq_proj.py @@ -51,5 +51,6 @@ class SynthPYNQProject(Transformation): process_compile.communicate() # set bitfile attribute model.set_metadata_prop("bitfile", vivado_pynq_proj_dir + "/resizer.bit") + model.set_metadata_prop("hw_handoff", vivado_pynq_proj_dir + "/resizer.hwh") # TODO pull out synthesis statistics and put them in as attributes return (model, False)