Skip to content
Snippets Groups Projects
Commit b597c4c1 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[PYNQ] make deployment work for VitisBuild too

parent ec56e4bb
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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)
......
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment