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: 88ad4fbf236c
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: 7110f3640e19
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Oct 14, 2014

  1. Copy the full SHA
    cbf915c View commit details

Commits on Oct 15, 2014

  1. Copy the full SHA
    0c9632d View commit details
  2. Copy the full SHA
    7110f36 View commit details
Showing with 39 additions and 3 deletions.
  1. +7 −1 artiq/devices/runtime.py
  2. +28 −0 frontend/runelf
  3. +4 −2 soc/runtime/exceptions.c
8 changes: 7 additions & 1 deletion artiq/devices/runtime.py
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
from llvm import target as lt

from artiq.py2llvm import base_types
from artiq.language import units


lt.initialize_all()
@@ -138,12 +139,17 @@ def _debug_dump_obj(obj):

class Environment(LinkInterface):
def __init__(self, ref_period):
self.cpu_type = "or1k"
self.ref_period = ref_period
# allow 1ms for all initial DDS programming
self.initial_time = int(Fraction(1, 1000)/self.ref_period)

def emit_object(self):
tm = lt.TargetMachine.new(triple="or1k", cpu="generic")
tm = lt.TargetMachine.new(triple=self.cpu_type, cpu="generic")
obj = tm.emit_object(self.llvm_module)
_debug_dump_obj(obj)
return obj

def __repr__(self):
return "<Environment {} {}>".format(self.cpu_type,
str(units.Hz/self.ref_period))
28 changes: 28 additions & 0 deletions frontend/runelf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3

import argparse
from artiq.devices import corecom_serial


def main():
parser = argparse.ArgumentParser(description="Core device ELF loading tool")
parser.add_argument("-e", default=False, action="store_true",
help="show environment")
parser.add_argument("-f", default="run",
help="function to run")
parser.add_argument("file",
help="ELF binary to load")
args = parser.parse_args()

with open(args.file, "rb") as f:
binary = f.read()
with corecom_serial.CoreCom() as com:
runtime_env = com.get_runtime_env()
if args.e:
print(runtime_env)
com.load(binary)
com.run(args.f)
com.serve(dict(), dict())

if __name__ == "__main__":
main()
6 changes: 4 additions & 2 deletions soc/runtime/exceptions.c
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@ void exception_raise(int id)
if(ec_top > 0) {
stored_id = id;
exception_longjmp(exception_contexts[--ec_top].jb);
} else
corecom_log("WARNING: uncaught exception, ID=%d\n", id);
} else {
corecom_log("ERROR: uncaught exception, ID=%d\n", id);
while(1);
}
}