mirror of https://github.com/m-labs/artiq.git
artiq_flash: explicitly pass path within conda env to openocd datarootdir.
By default, openocd searches for scripts in DATAROOTDIR/openocd/scripts. This of course makes it not relocatable. Conda has a flag to try to detect and fix such hardcoded paths, but it does not work on openocd (likely because the .rodata contains an already concatenated path, which cannot be padded with zeroes from the right). So, we pass the path explicitly instead.
This commit is contained in:
parent
6db96f81d5
commit
57be065c15
|
@ -5,6 +5,7 @@ import argparse
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import site
|
||||||
|
|
||||||
from artiq import __artiq_dir__ as artiq_dir
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
from artiq.frontend.bit2bin import bit2bin
|
from artiq.frontend.bit2bin import bit2bin
|
||||||
|
@ -76,6 +77,12 @@ def main():
|
||||||
raise SystemExit("Binaries directory '{}' does not exist"
|
raise SystemExit("Binaries directory '{}' does not exist"
|
||||||
.format(opts.dir))
|
.format(opts.dir))
|
||||||
|
|
||||||
|
conda_prefix_path = site.getsitepackages()[0]
|
||||||
|
if os.name == "nt":
|
||||||
|
scripts_path = os.path.join(conda_prefix_path, "Library", "share", "openocd", "scripts")
|
||||||
|
else:
|
||||||
|
scripts_path = os.path.join(conda_prefix_path, "share", "openocd", "scripts")
|
||||||
|
|
||||||
conv = False
|
conv = False
|
||||||
|
|
||||||
prog = []
|
prog = []
|
||||||
|
@ -124,6 +131,7 @@ def main():
|
||||||
bit2bin(bit, bin_handle)
|
bit2bin(bit, bin_handle)
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
"openocd",
|
"openocd",
|
||||||
|
"-s", scripts_path,
|
||||||
"-f", os.path.join("board", opts.target + ".cfg"),
|
"-f", os.path.join("board", opts.target + ".cfg"),
|
||||||
"-c", "; ".join(prog),
|
"-c", "; ".join(prog),
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue