Skip to content

Commit

Permalink
libbase: write to UART on unhandled exception.
Browse files Browse the repository at this point in the history
whitequark committed Feb 25, 2016
1 parent e4ffd99 commit 59a5ded
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion misoc/software/libbase/exception.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <generated/csr.h>
#include <stdio.h>

void isr(void);

#ifdef __or1k__
@@ -12,7 +15,17 @@ void exception_handler(unsigned long vect, unsigned long *regs,
if(vect == EXTERNAL_IRQ) {
isr();
} else {
/* Unhandled exception */
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++);
}

for(;;);
}
}

0 comments on commit 59a5ded

Please sign in to comment.