diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-16 15:03:22 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-16 15:03:22 -0700 |
commit | 9a29506823896c53b4334c5ee202ce01306d921f (patch) | |
tree | a21d6fc0d583a25e087841df80984b5c7079cff4 /include/exc.c | |
parent | 7b1008111baa95b4a8c3195f9f5a94bfdbe8d7d2 (diff) | |
download | ch573-9a29506823896c53b4334c5ee202ce01306d921f.tar.gz ch573-9a29506823896c53b4334c5ee202ce01306d921f.tar.bz2 ch573-9a29506823896c53b4334c5ee202ce01306d921f.zip |
Fix exception handlers not being included during linking.
Diffstat (limited to 'include/exc.c')
-rw-r--r-- | include/exc.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/include/exc.c b/include/exc.c deleted file mode 100644 index 707d3b0..0000000 --- a/include/exc.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <stdio.h> - -#include "isr_vector.h" -#include "panic.h" - -#include "ch573/gpio.h" - -#define GPIO_PORT_A ch573_gpio__gpio_port_a -#define GPIO_PORT CH573_GPIO__GPIO_PORT_T_INTF - -void delay(); - -IRQ(exc) -{ - uint32_t mcause, mepc, mtval, *sp; - - asm volatile("csrr %0, mcause" : "=r"(mcause)); - asm volatile("csrr %0, mepc" : "=r"(mepc)); - asm volatile("csrr %0, mtval" : "=r"(mtval)); - - printf("Hardware Exception Caught:\n"); - printf(" mcause: 0x%80x\n", mcause); - printf(" mepc: 0x%80x\n", mepc); - printf(" mtval: 0x%80x\n", mtval); - - panic(mcause); -} - -IRQ(nmi) -{ - uint32_t mcause, mepc, mtval, *sp; - - asm volatile("csrr %0, mcause" : "=r"(mcause)); - asm volatile("csrr %0, mepc" : "=r"(mepc)); - asm volatile("csrr %0, mtval" : "=r"(mtval)); - - printf("Unhandled NMI Caught:\n"); - printf(" mcause: 0x%80x\n", mcause); - printf(" mepc: 0x%80x\n", mepc); - printf(" mtval: 0x%80x\n", mtval); - - panic(mcause); -} |