diff --git a/src/system/boot/platform/u-boot/debug.cpp b/src/system/boot/platform/u-boot/debug.cpp index 5b4e0acb42..0fc8a3df33 100644 --- a/src/system/boot/platform/u-boot/debug.cpp +++ b/src/system/boot/platform/u-boot/debug.cpp @@ -17,16 +17,29 @@ extern "C" void panic(const char* format, ...) { + const char hint[] = "*** PANIC ***"; + char buffer[512]; va_list list; + int length; platform_switch_to_text_mode(); - puts("*** PANIC ***"); + serial_puts(hint, sizeof(hint)); + serial_puts("\n", 1); + //fprintf(stderr, "%s", hint); + puts(hint); va_start(list, format); - vprintf(format, list); + length = vsnprintf(buffer, sizeof(buffer), format, list); va_end(list); + if (length >= (int)sizeof(buffer)) + length = sizeof(buffer) - 1; + + serial_puts(buffer, length); + //fprintf(stderr, "%s", buffer); + puts(buffer); + puts("\nPress key to reboot."); clear_key_buffer();