open-story-teller/software/cpu/gigadevice-gd32vf103/RISCV/env_Eclipse/handlers.c
2023-04-18 16:20:41 +02:00

37 lines
666 B
C
Executable file

//See LICENSE for license details.
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include "riscv_encoding.h"
#include "n200_func.h"
__attribute__((weak)) uintptr_t handle_nmi()
{
for(;;);
// write(1, "nmi\n", 5);
// _exit(1);
return 0;
}
__attribute__((weak)) uintptr_t handle_trap(uintptr_t mcause, uintptr_t sp)
{
if(mcause == 0xFFF) {
handle_nmi();
}
for(;;);
// write(1, "trap\n", 5);
//printf("In trap handler, the mcause is %d\n", mcause);
//printf("In trap handler, the mepc is 0x%x\n", read_csr(mepc));
//printf("In trap handler, the mtval is 0x%x\n", read_csr(mbadaddr));
// _exit(mcause);
return 0;
}