Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overwrite vart.conf if downloading custom xclbin #111

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pynq_dpu/dpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ def check_vart_config():
if '/usr/lib/dpu.xclbin' not in previous_firmware:
print("/etc/vart.conf file was modified, replacing contents '{}' with '{}'.".format(previous_firmware.strip('\n').split(' ')[1], '/usr/lib/dpu.xclbin'))

write_config("dpu.xclbin")

def write_config(xclbin_name):
""" Helper function to overwrite VART config file

Overwrites the /etc/vart.conf file with the firmware location of a given xclbin.
"""
with open('/etc/vart.conf', 'w') as txt:
txt.write('firmware: /usr/lib/dpu.xclbin')
txt.write(f'firmware: /usr/lib/{xclbin_name}')

def get_child_subgraph_dpu(graph: "Graph"):
""" Helper function for load_model
Expand Down Expand Up @@ -142,6 +149,8 @@ def copy_xclbin(self):
_ = subprocess.check_output(["cp", "-f",
abs_xclbin, XCL_DST_PATH])

write_config(self.overlay_basename.rstrip(".bit") + ".xclbin")

def load_model(self, model):
"""Load DPU models for VART.

Expand Down