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/misoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d3c673599c50
Choose a base ref
...
head repository: m-labs/misoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 73e0c01cbf73
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Aug 16, 2016

  1. Rename compiler_rt to compiler-rt.

    Some external dependencies (Rust) hardcode -lcompiler-rt, which
    isn't unreasonable, given that it is the project's name, after all.
    whitequark committed Aug 16, 2016
    Copy the full SHA
    b527fdb View commit details
  2. libbase: implement a more verbose exception handler.

    whitequark committed Aug 16, 2016
    Copy the full SHA
    73e0c01 View commit details
Showing with 52 additions and 17 deletions.
  1. +1 −1 misoc/integration/builder.py
  2. +2 −2 misoc/software/bios/Makefile
  3. +45 −10 misoc/software/libbase/exception.c
  4. +4 −4 misoc/software/{libcompiler_rt → libcompiler-rt}/Makefile
2 changes: 1 addition & 1 deletion misoc/integration/builder.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@


misoc_software_packages = [
"libcompiler_rt",
"libcompiler-rt",
"libbase",
"libnet",
"bios"
4 changes: 2 additions & 2 deletions misoc/software/bios/Makefile
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@ bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
$(OBJECTS) \
-L../libnet \
-L../libbase \
-L../libcompiler_rt \
-lnet -lbase-nofloat -lcompiler_rt
-L../libcompiler-rt \
-lnet -lbase-nofloat -lcompiler-rt
chmod -x $@

main.o: $(BIOS_DIRECTORY)/main.c
55 changes: 45 additions & 10 deletions misoc/software/libbase/exception.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
#include <generated/csr.h>
#include <stdio.h>
#include <stdarg.h>

void isr(void);

#ifdef __or1k__

#define EXTERNAL_IRQ 0x8

static void emerg_printf(const char *fmt, ...)
{
char buf[128];
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);

char *p = buf;
while(*p) {
while(uart_txfull_read());
uart_rxtx_write(*p++);
}
}

void exception_handler(unsigned long vect, unsigned long *regs,
unsigned long pc, unsigned long ea);
void exception_handler(unsigned long vect, unsigned long *regs,
@@ -15,17 +31,36 @@ void exception_handler(unsigned long vect, unsigned long *regs,
if(vect == EXTERNAL_IRQ) {
isr();
} else {
char outbuf[128];
scnprintf(outbuf, sizeof(outbuf),
"\n *** Unhandled exception %d at PC 0x%08x, EA 0x%08x *** \n",
vect, pc, ea);

char *p = outbuf;
while(*p) {
while(uart_txfull_read());
uart_rxtx_write(*p++);
emerg_printf("\n *** Unhandled exception %d *** \n", vect);
emerg_printf(" pc %08x ea %08x\n",
pc, ea);
unsigned long r1 = (unsigned long)regs + 4*32;
regs -= 2;
emerg_printf(" r0 %08x r1 %08x r2 %08x r3 %08x\n",
0, r1, regs[2], regs[3]);
emerg_printf(" r4 %08x r5 %08x r6 %08x r7 %08x\n",
regs[4], regs[5], regs[6], regs[7]);
emerg_printf(" r8 %08x r9 %08x r10 %08x r11 %08x\n",
regs[8], regs[9], regs[10], regs[11]);
emerg_printf(" r12 %08x r13 %08x r14 %08x r15 %08x\n",
regs[12], regs[13], regs[14], regs[15]);
emerg_printf(" r16 %08x r17 %08x r18 %08x r19 %08x\n",
regs[16], regs[17], regs[18], regs[19]);
emerg_printf(" r20 %08x r21 %08x r22 %08x r23 %08x\n",
regs[20], regs[21], regs[22], regs[23]);
emerg_printf(" r24 %08x r25 %08x r26 %08x r27 %08x\n",
regs[24], regs[25], regs[26], regs[27]);
emerg_printf(" r28 %08x r29 %08x r30 %08x r31 %08x\n",
regs[28], regs[29], regs[30], regs[31]);
emerg_printf(" stack:\n");
unsigned long *sp = (unsigned long *)r1;
for(unsigned long spoff = 0; spoff < 16; spoff += 4) {
emerg_printf(" %08x:", &sp[spoff]);
for(unsigned long spoff2 = 0; spoff2 < 4; spoff2++) {
emerg_printf(" %08x", sp[spoff + spoff2]);
}
emerg_printf("\n");
}

for(;;);
}
}
Original file line number Diff line number Diff line change
@@ -8,15 +8,15 @@ OBJECTS=divsi3.o modsi3.o comparesf2.o comparedf2.o negsf2.o negdf2.o addsf3.o s
clzsi2.o ctzsi2.o udivdi3.o umoddi3.o moddi3.o ucmpdi2.o \
powidf2.o

all: libcompiler_rt.a
all: libcompiler-rt.a

libcompiler_rt.a: $(OBJECTS)
$(AR) crs libcompiler_rt.a $(OBJECTS)
libcompiler-rt.a: $(OBJECTS)
$(AR) crs libcompiler-rt.a $(OBJECTS)

%.o: $(MISOC_DIRECTORY)/software/compiler_rt/lib/builtins/%.c
$(compile)

.PHONY: all clean

clean:
$(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libcompiler_rt.a .*~ *~
$(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libcompiler-rt.a .*~ *~