From: Sebastien Bourdeauducq Date: Wed, 14 May 2014 13:01:38 +0000 (+0200) Subject: software: factorize exception_handler X-Git-Tag: 24jan2021_ls180~2717 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=13e74b8b4f7ff1dcefa3ad595229594f3c23642c;p=litex.git software: factorize exception_handler --- diff --git a/software/bios/isr.c b/software/bios/isr.c index 47d91542..c49d31d8 100644 --- a/software/bios/isr.c +++ b/software/bios/isr.c @@ -12,17 +12,3 @@ void isr(void) if(irqs & (1 << UART_INTERRUPT)) uart_isr(); } - -#ifdef __or1k__ -#define EXTERNAL_IRQ 0x800 -void exception_handler(unsigned long vect, unsigned long *sp); -void exception_handler(unsigned long vect, unsigned long *sp) -{ - if ((vect & 0xf00) == EXTERNAL_IRQ) { - isr(); - } else { - /* Unhandled exception */ - for(;;); - } -} -#endif diff --git a/software/libbase/Makefile b/software/libbase/Makefile index 124352c7..50291547 100644 --- a/software/libbase/Makefile +++ b/software/libbase/Makefile @@ -1,7 +1,7 @@ MSCDIR=../.. include $(MSCDIR)/software/common.mak -OBJECTS=setjmp-$(CPU).o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o time.o qsort.o strtod.o +OBJECTS=setjmp-$(CPU).o exception.o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o time.o qsort.o strtod.o all: crt0-$(CPU).o libbase.a libbase-nofloat.a diff --git a/software/libbase/exception.c b/software/libbase/exception.c new file mode 100644 index 00000000..0b3bae37 --- /dev/null +++ b/software/libbase/exception.c @@ -0,0 +1,17 @@ +void isr(void); + +#ifdef __or1k__ + +#define EXTERNAL_IRQ 0x800 + +void exception_handler(unsigned long vect, unsigned long *sp); +void exception_handler(unsigned long vect, unsigned long *sp) +{ + if ((vect & 0xf00) == EXTERNAL_IRQ) { + isr(); + } else { + /* Unhandled exception */ + for(;;); + } +} +#endif