U-Boot: Print the panic message also to the serial port

It seems puts() currently hangs when used in panic(), will need some more work.
This commit is contained in:
François Revol 2011-11-21 03:00:07 +01:00
parent 70ac17baab
commit 1cdb5905fc

View File

@ -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();