Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 122b3b0

Browse files
author
whitequark
committedAug 2, 2015
Integrate libdyld and libunwind.
It is currently possible to run the idle experiment, and it can raise and catch exceptions, but exceptions are not yet propagated across RPC boundaries.
1 parent 6db93b3 commit 122b3b0

22 files changed

+401
-793
lines changed
 

Diff for: ‎artiq/coredevice/comm_generic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class _H2DMsgType(Enum):
1616
IDENT_REQUEST = 2
1717
SWITCH_CLOCK = 3
1818

19-
LOAD_OBJECT = 4
19+
LOAD_LIBRARY = 4
2020
RUN_KERNEL = 5
2121

2222
RPC_REPLY = 6
@@ -124,7 +124,7 @@ def switch_clock(self, external):
124124
raise IOError("Incorrect reply from device: {}".format(ty))
125125

126126
def load(self, kcode):
127-
self._write_header(len(kcode) + 9, _H2DMsgType.LOAD_OBJECT)
127+
self._write_header(len(kcode) + 9, _H2DMsgType.LOAD_LIBRARY)
128128
self.write(kcode)
129129
_, ty = self._read_header()
130130
if ty != _D2HMsgType.LOAD_COMPLETED:

Diff for: ‎soc/runtime/Makefile

+21-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
include $(MSCDIR)/software/common.mak
22

3-
OBJECTS := isr.o flash_storage.o clock.o rtiocrg.o elf_loader.o services.o session.o log.o test_mode.o kloader.o bridge_ctl.o mailbox.o ksupport_data.o net_server.o moninj.o main.o
4-
OBJECTS_KSUPPORT := ksupport.o exception_jmp.o exceptions.o mailbox.o bridge.o rtio.o ttl.o dds.o
3+
OBJECTS := isr.o clock.o rtiocrg.o flash_storage.o mailbox.o \
4+
session.o log.o moninj.o net_server.o bridge_ctl.o \
5+
ksupport_data.o kloader.o test_mode.o main.o
6+
OBJECTS_KSUPPORT := ksupport.o artiq_personality.o mailbox.o \
7+
bridge.o rtio.o ttl.o dds.o
58

6-
CFLAGS += -Ilwip/src/include -Iliblwip
9+
CFLAGS += -I$(MSCDIR)/software/include/dyld \
10+
-I$(MSCDIR)/software/unwinder/include \
11+
-I$(MSCDIR)/software/libunwind \
12+
-Ilwip/src/include -Iliblwip
713

814
all: runtime.bin runtime.fbi
915

@@ -19,7 +25,7 @@ all: runtime.bin runtime.fbi
1925

2026
runtime.elf: $(OBJECTS) libs
2127
$(LD) $(LDFLAGS) \
22-
-T linker.ld \
28+
-T runtime.ld \
2329
-N -o $@ \
2430
$(MSCDIR)/software/libbase/crt0-$(CPU).o \
2531
$(OBJECTS) \
@@ -29,24 +35,23 @@ runtime.elf: $(OBJECTS) libs
2935
-lbase -lcompiler-rt -llwip
3036
@chmod -x $@
3137

32-
ksupport.elf: $(OBJECTS_KSUPPORT)
38+
ksupport.elf: $(OBJECTS_KSUPPORT) libs
3339
$(LD) $(LDFLAGS) \
40+
--eh-frame-hdr \
3441
-T ksupport.ld \
3542
-N -o $@ \
3643
$(MSCDIR)/software/libbase/crt0-$(CPU).o \
37-
$^ \
44+
$(OBJECTS_KSUPPORT) \
45+
-L$(MSCDIR)/software/libbase \
3846
-L$(MSCDIR)/software/libcompiler-rt \
39-
-lcompiler-rt
47+
-L$(MSCDIR)/software/libunwind \
48+
-L$(MSCDIR)/software/libdyld \
49+
-lbase -lcompiler-rt -lunwind -ldyld
4050
@chmod -x $@
4151

42-
ksupport_data.o: ksupport.bin
52+
ksupport_data.o: ksupport.elf
4353
$(LD) -r -b binary -o $@ $<
4454

45-
service_table.h: ksupport.elf gen_service_table.py
46-
@echo " GEN " $@ && ./gen_service_table.py ksupport.elf > $@
47-
48-
services.c: service_table.h
49-
5055
main.o: main.c
5156
$(compile-dep)
5257

@@ -58,13 +63,15 @@ main.o: main.c
5863

5964
libs:
6065
$(MAKE) -C $(MSCDIR)/software/libcompiler-rt
66+
$(MAKE) -C $(MSCDIR)/software/libunwind
6167
$(MAKE) -C $(MSCDIR)/software/libbase
68+
$(MAKE) -C $(MSCDIR)/software/libdyld
6269
$(MAKE) -C liblwip
6370

6471
clean:
6572
$(MAKE) -C liblwip clean
6673
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) $(OBJECTS_KSUPPORT) $(OBJECTS_KSUPPORT:.o=.d)
6774
$(RM) runtime.elf runtime.bin runtime.fbi .*~ *~
68-
$(RM) service_table.h ksupport.elf ksupport.bin
75+
$(RM) ksupport.elf ksupport.bin
6976

7077
.PHONY: all main.o clean libs load

Diff for: ‎soc/runtime/artiq_personality.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ struct artiq_raised_exception {
246246
static struct artiq_raised_exception inflight;
247247

248248
void __artiq_raise(struct artiq_exception *artiq_exn) {
249-
EH_LOG("===> raise (name=%s)", artiq_exn->name);
249+
EH_LOG("===> raise (name=%s, msg=%s, params=[%lld,%lld,%lld])",
250+
artiq_exn->name, artiq_exn->message,
251+
artiq_exn->param[0], artiq_exn->param[1], artiq_exn->param[2]);
250252

251253
memmove(&inflight.artiq, artiq_exn, sizeof(struct artiq_exception));
252254
inflight.unwind.exception_class = ARTIQ_EXCEPTION_CLASS;

Diff for: ‎soc/runtime/bridge.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static void send_ready(void)
3232
struct msg_base msg;
3333

3434
msg.type = MESSAGE_TYPE_BRG_READY;
35-
mailbox_send_and_wait(&msg);
35+
mailbox_send_and_wait(&msg);
3636
}
3737

3838
void bridge_main(void)

Diff for: ‎soc/runtime/dds.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <generated/csr.h>
22
#include <stdio.h>
33

4-
#include "exceptions.h"
4+
#include "artiq_personality.h"
55
#include "rtio.h"
66
#include "log.h"
77
#include "dds.h"
@@ -179,7 +179,7 @@ static struct dds_set_params batch[DDS_MAX_BATCH];
179179
void dds_batch_enter(long long int timestamp)
180180
{
181181
if(batch_mode)
182-
exception_raise(EID_DDS_BATCH_ERROR);
182+
artiq_raise_from_c("DDSBatchError", "DDS batch error", 0, 0, 0);
183183
batch_mode = 1;
184184
batch_count = 0;
185185
batch_ref_time = timestamp;
@@ -191,7 +191,7 @@ void dds_batch_exit(void)
191191
int i;
192192

193193
if(!batch_mode)
194-
exception_raise(EID_DDS_BATCH_ERROR);
194+
artiq_raise_from_c("DDSBatchError", "DDS batch error", 0, 0, 0);
195195
rtio_chan_sel_write(RTIO_DDS_CHANNEL);
196196
/* + FUD time */
197197
now = batch_ref_time - batch_count*(DURATION_PROGRAM + DURATION_WRITE);
@@ -208,7 +208,7 @@ void dds_set(long long int timestamp, int channel,
208208
{
209209
if(batch_mode) {
210210
if(batch_count >= DDS_MAX_BATCH)
211-
exception_raise(EID_DDS_BATCH_ERROR);
211+
artiq_raise_from_c("DDSBatchError", "DDS batch error", 0, 0, 0);
212212
/* timestamp parameter ignored (determined by batch) */
213213
batch[batch_count].channel = channel;
214214
batch[batch_count].ftw = ftw;

Diff for: ‎soc/runtime/elf_loader.c

-240
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.