Skip to content

Commit 59a5ded

Browse files
author
whitequark
committedFeb 25, 2016
libbase: write to UART on unhandled exception.
1 parent e4ffd99 commit 59a5ded

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed
 

‎misoc/software/libbase/exception.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#include <generated/csr.h>
2+
#include <stdio.h>
3+
14
void isr(void);
25

36
#ifdef __or1k__
@@ -12,7 +15,17 @@ void exception_handler(unsigned long vect, unsigned long *regs,
1215
if(vect == EXTERNAL_IRQ) {
1316
isr();
1417
} else {
15-
/* Unhandled exception */
18+
char outbuf[128];
19+
scnprintf(outbuf, sizeof(outbuf),
20+
"\n *** Unhandled exception %d at PC 0x%08x, EA 0x%08x *** \n",
21+
vect, pc, ea);
22+
23+
char *p = outbuf;
24+
while(*p) {
25+
while(uart_txfull_read());
26+
uart_rxtx_write(*p++);
27+
}
28+
1629
for(;;);
1730
}
1831
}

0 commit comments

Comments
 (0)