mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-24 14:17:51 -04:00
[sw/bootloader] stall if unexpected exception
This commit is contained in:
parent
ef8432cdec
commit
9f158b7796
1 changed files with 3 additions and 4 deletions
|
@ -512,21 +512,20 @@ void __attribute__((__interrupt__)) bootloader_trap_handler(void) {
|
|||
system_error(ERROR_SIZE); // -> seems like executable is too large
|
||||
}
|
||||
|
||||
// Anything else (that was not expected); output exception notifier and try to resume
|
||||
// Anything else (that was not expected): FREEZE
|
||||
else {
|
||||
uint32_t epc = neorv32_cpu_csr_read(CSR_MEPC);
|
||||
#if (UART_EN != 0)
|
||||
if (neorv32_uart0_available()) {
|
||||
PRINT_TEXT("\n[EXC ");
|
||||
PRINT_XNUM(cause); // MCAUSE
|
||||
PRINT_PUTC(' ');
|
||||
PRINT_XNUM(epc); // MEPC
|
||||
PRINT_XNUM(neorv32_cpu_csr_read(CSR_MEPC)); // MEPC
|
||||
PRINT_PUTC(' ');
|
||||
PRINT_XNUM(neorv32_cpu_csr_read(CSR_MTVAL)); // MTVAL
|
||||
PRINT_TEXT("]\n");
|
||||
}
|
||||
#endif
|
||||
neorv32_cpu_csr_write(CSR_MEPC, epc + 4); // advance to next instruction
|
||||
while(1); // stall
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue