forked from M-Labs/artiq
1
0
Fork 0

artiq_run: fix ELF handling

This commit is contained in:
Sebastien Bourdeauducq 2021-11-12 19:57:48 +08:00
parent 75dad8090f
commit 38e554fe98
1 changed files with 1 additions and 24 deletions

View File

@ -23,40 +23,17 @@ from artiq.tools import *
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class StubObject:
def __setattr__(self, name, value):
pass
class StubEmbeddingMap:
def __init__(self):
stub_object = StubObject()
self.object_forward_map = defaultdict(lambda: stub_object)
self.object_forward_map[1] = lambda _: None # return RPC
self.object_current_id = -1
def retrieve_object(self, object_id):
return self.object_forward_map[object_id]
def store_object(self, value):
self.object_forward_map[self.object_current_id] = value
self.object_current_id -= 1
class FileRunner(EnvExperiment): class FileRunner(EnvExperiment):
def build(self, file): def build(self, file):
self.setattr_device("core") self.setattr_device("core")
self.file = file self.file = file
self.target = self.core.target_cls()
def run(self): def run(self):
kernel_library = self.compile() kernel_library = self.compile()
self.core.comm.load(kernel_library) self.core.comm.load(kernel_library)
self.core.comm.run() self.core.comm.run()
self.core.comm.serve(StubEmbeddingMap(), self.core.comm.serve(None, None, None)
lambda addresses: self.target.symbolize(kernel_library, addresses), \
lambda symbols: self.target.demangle(symbols))
class ELFRunner(FileRunner): class ELFRunner(FileRunner):