mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-23 13:47:33 -04:00
[sw/bootloader] improved user console
more detailed messages
This commit is contained in:
parent
6e245464e0
commit
a64f8cc48f
1 changed files with 19 additions and 6 deletions
|
@ -144,6 +144,16 @@ enum ERROR_CODES {
|
|||
ERROR_FLASH = 3 /**< 3: SPI flash access error */
|
||||
};
|
||||
|
||||
/**********************************************************************//**
|
||||
* Error messages
|
||||
**************************************************************************/
|
||||
const char error_message[4][24] = {
|
||||
"exe signature fail",
|
||||
"exceeding IMEM capacity",
|
||||
"checksum fail",
|
||||
"SPI flash access failed"
|
||||
};
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* SPI flash commands
|
||||
|
@ -170,7 +180,7 @@ enum NEORV32_EXECUTABLE {
|
|||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Valid executable identification signature.
|
||||
* Valid executable identification signature
|
||||
**************************************************************************/
|
||||
#define EXE_SIGNATURE 0x4788CAFE
|
||||
|
||||
|
@ -521,13 +531,13 @@ void __attribute__((__interrupt__)) bootloader_trap_handler(void) {
|
|||
register uint32_t epc = neorv32_cpu_csr_read(CSR_MEPC);
|
||||
#if (UART_EN != 0)
|
||||
if (neorv32_uart0_available()) {
|
||||
PRINT_TEXT("\n[ERR ");
|
||||
PRINT_TEXT("\n[ERROR - Unexpected exception! mcause=");
|
||||
PRINT_XNUM(cause); // MCAUSE
|
||||
PRINT_PUTC(' ');
|
||||
PRINT_TEXT(" mepc=");
|
||||
PRINT_XNUM(epc); // MEPC
|
||||
PRINT_PUTC(' ');
|
||||
PRINT_TEXT(" mtval=");
|
||||
PRINT_XNUM(neorv32_cpu_csr_read(CSR_MTVAL)); // MTVAL
|
||||
PRINT_TEXT("]\n");
|
||||
PRINT_TEXT("] trying to resume...\n");
|
||||
}
|
||||
#endif
|
||||
neorv32_cpu_csr_write(CSR_MEPC, epc + 4); // advance to next instruction
|
||||
|
@ -702,12 +712,15 @@ uint32_t get_exe_word(int src, uint32_t addr) {
|
|||
/**********************************************************************//**
|
||||
* Output system error ID and stall.
|
||||
*
|
||||
* @param[in] err_code Error code. See #ERROR_CODES.
|
||||
* @param[in] err_code Error code. See #ERROR_CODES and #error_message.
|
||||
**************************************************************************/
|
||||
void system_error(uint8_t err_code) {
|
||||
|
||||
PRINT_TEXT("\a\nERROR_"); // output error code with annoying bell sound
|
||||
PRINT_PUTC('0' + ((char)err_code));
|
||||
PRINT_PUTC(':');
|
||||
PRINT_PUTC(' ');
|
||||
PRINT_TEXT(error_message[err_code]);
|
||||
|
||||
neorv32_cpu_dint(); // deactivate IRQs
|
||||
#if (STATUS_LED_EN != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue