Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f37bfef2758f
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e9a3e5642e5f
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on May 17, 2016

  1. flash: close files (c.f. #256)

    jordens authored and sbourdeauducq committed May 17, 2016
    5
    Copy the full SHA
    7bdf373 View commit details
  2. flash: use the handle

    jordens authored and sbourdeauducq committed May 17, 2016
    Copy the full SHA
    b81b40d View commit details
  3. flash: tcl-quote paths (c.f. #256)

    jordens authored and sbourdeauducq committed May 17, 2016
    Copy the full SHA
    e9a3e56 View commit details
Showing with 10 additions and 9 deletions.
  1. +8 −8 artiq/frontend/artiq_flash.py
  2. +2 −1 artiq/frontend/bit2bin.py
16 changes: 8 additions & 8 deletions artiq/frontend/artiq_flash.py
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ def main():
"/usr/local/share/migen", "/usr/share/migen"]:
proxy_ = os.path.join(p, proxy_base)
if os.access(proxy_, os.R_OK):
proxy = "jtagspi_init 0 {}".format(proxy_)
proxy = "jtagspi_init 0 {{{}}}".format(proxy_)
break
if not proxy:
raise SystemExit(
@@ -97,22 +97,22 @@ def main():
elif action == "gateware":
bin = os.path.join(opts.dir, "top.bin")
if not os.access(bin, os.R_OK):
bin = tempfile.mkstemp()[1]
bin_handle, bin = tempfile.mkstemp()
bit = os.path.join(opts.dir, "top.bit")
conv = True
prog.append("jtagspi_program {} 0x{:x}".format(
prog.append("jtagspi_program {{{}}} 0x{:x}".format(
bin, config["gateware"]))
elif action == "bios":
prog.append("jtagspi_program {} 0x{:x}".format(
prog.append("jtagspi_program {{{}}} 0x{:x}".format(
os.path.join(opts.dir, "bios.bin"), config["bios"]))
elif action == "runtime":
prog.append("jtagspi_program {} 0x{:x}".format(
prog.append("jtagspi_program {{{}}} 0x{:x}".format(
os.path.join(opts.dir, "runtime.fbi"), config["runtime"]))
elif action == "storage":
prog.append("jtagspi_program {} 0x{:x}".format(
prog.append("jtagspi_program {{{}}} 0x{:x}".format(
opts.storage, config["storage"]))
elif action == "load":
prog.append("pld load 0 {}".format(
prog.append("pld load 0 {{{}}}".format(
os.path.join(opts.dir, "top.bit")))
elif action == "start":
prog.append(config["start"])
@@ -121,7 +121,7 @@ def main():
prog.append("exit")
try:
if conv:
bit2bin(bit, bin)
bit2bin(bit, bin_handle)
subprocess.check_call([
"openocd",
"-f", os.path.join("board", opts.target + ".cfg"),
3 changes: 2 additions & 1 deletion artiq/frontend/bit2bin.py
Original file line number Diff line number Diff line change
@@ -60,7 +60,8 @@ def bit2bin(bit, bin, flip=False):
d = bitfile.read(l)
if flip:
d = flip32(d)
open(bin, "wb").write(d)
with open(bin, "wb") as f:
f.write(d)
else:
d = bitfile.read(*struct.unpack(">H", bitfile.read(2)))
print("Unexpected key: ", key, d)