hekate/nyx: improve exceptions reporting

- Do not report HOS panic if status is 0
- Do not report LP0/MTC libs missing if failed to mount sd
- Rename panics to be explicit of their source
This commit is contained in:
CTCaer 2022-01-16 01:33:07 +02:00
parent 864ec50a2d
commit 06e7af150e
2 changed files with 16 additions and 11 deletions

View file

@ -1111,7 +1111,7 @@ static void _show_errors()
PMC(APBDEV_PMC_SCRATCH37) = 0; PMC(APBDEV_PMC_SCRATCH37) = 0;
} }
if (hw_rst_reason == PMC_RST_STATUS_WATCHDOG && if (hw_rst_reason == PMC_RST_STATUS_WATCHDOG && panic_status &&
panic_status <= 0xFF && panic_status != 0x20 && panic_status != 0x21) panic_status <= 0xFF && panic_status != 0x20 && panic_status != 0x21)
h_cfg.errors |= ERR_PANIC_CODE; h_cfg.errors |= ERR_PANIC_CODE;
@ -1125,19 +1125,24 @@ static void _show_errors()
display_backlight_brightness(150, 1000); display_backlight_brightness(150, 1000);
if (h_cfg.errors & ERR_SD_BOOT_EN) if (h_cfg.errors & ERR_SD_BOOT_EN)
WPRINTF("Failed to mount SD!\n"); {
WPRINTF("Failed to init or mount SD!\n");
// Clear the module bits as to not cram the error screen.
h_cfg.errors &= ~(ERR_LIBSYS_LP0 | ERR_LIBSYS_MTC);
}
if (h_cfg.errors & ERR_LIBSYS_LP0) if (h_cfg.errors & ERR_LIBSYS_LP0)
WPRINTF("Missing LP0 (sleep mode) lib!\n"); WPRINTF("Missing LP0 (sleep) lib!\n");
if (h_cfg.errors & ERR_LIBSYS_MTC) if (h_cfg.errors & ERR_LIBSYS_MTC)
WPRINTF("Missing or old Minerva lib!\n"); WPRINTF("Missing Minerva lib!\n");
if (h_cfg.errors & (ERR_LIBSYS_LP0 | ERR_LIBSYS_MTC)) if (h_cfg.errors & (ERR_LIBSYS_LP0 | ERR_LIBSYS_MTC))
WPRINTF("\nUpdate bootloader folder!\n\n"); WPRINTF("\nUpdate bootloader folder!\n\n");
if (h_cfg.errors & ERR_EXCEPTION) if (h_cfg.errors & ERR_EXCEPTION)
{ {
WPRINTFARGS("An exception occurred (LR %08X):\n", *excp_lr); WPRINTFARGS("hekate exception occurred (LR %08X):\n", *excp_lr);
switch (*excp_type) switch (*excp_type)
{ {
case EXCP_TYPE_RESET: case EXCP_TYPE_RESET:
@ -1161,7 +1166,7 @@ static void _show_errors()
if (h_cfg.errors & ERR_L4T_KERNEL) if (h_cfg.errors & ERR_L4T_KERNEL)
{ {
WPRINTF("A kernel panic occurred!\n"); WPRINTF("Kernel panic occurred!\n");
if (!sd_save_to_file((void *)PSTORE_ADDR, PSTORE_SZ, "L4T_panic.bin")) if (!sd_save_to_file((void *)PSTORE_ADDR, PSTORE_SZ, "L4T_panic.bin"))
WPRINTF("PSTORE saved to L4T_panic.bin"); WPRINTF("PSTORE saved to L4T_panic.bin");
pstore_buf_t *buf = (pstore_buf_t *)(PSTORE_ADDR + PSTORE_LOG_OFFSET); pstore_buf_t *buf = (pstore_buf_t *)(PSTORE_ADDR + PSTORE_LOG_OFFSET);
@ -1184,7 +1189,7 @@ static void _show_errors()
b = (b << 0) | (b << 4); b = (b << 0) | (b << 4);
u32 color = r | g | b; u32 color = r | g | b;
WPRINTF("A panic error occurred!\n"); WPRINTF("HOS panic occurred!\n");
gfx_printf("Color: %k####%k, Code: %02X\n\n", color, 0xFFCCCCCC, panic_status); gfx_printf("Color: %k####%k, Code: %02X\n\n", color, 0xFFCCCCCC, panic_status);
} }

View file

@ -299,11 +299,11 @@ static void _show_errors()
{ {
gfx_clear_grey(0); gfx_clear_grey(0);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
display_backlight_brightness(100, 1000); display_backlight_brightness(150, 1000);
display_activate_console(); display_activate_console();
WPRINTFARGS("An exception occurred (LR %08X):\n", *excp_lr); WPRINTFARGS("Nyx exception occurred (LR %08X):\n", *excp_lr);
switch (*excp_type) switch (*excp_type)
{ {
case EXCP_TYPE_RESET: case EXCP_TYPE_RESET:
@ -319,7 +319,7 @@ static void _show_errors()
WPRINTF("DABRT"); WPRINTF("DABRT");
break; break;
} }
WPRINTF("\n"); gfx_puts("\n");
// Clear the exception. // Clear the exception.
*excp_lr = 0; *excp_lr = 0;
@ -328,7 +328,7 @@ static void _show_errors()
WPRINTF("Press any key..."); WPRINTF("Press any key...");
msleep(2000); msleep(1500);
btn_wait(); btn_wait();
reload_nyx(); reload_nyx();