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:
parent
70ac17baab
commit
1cdb5905fc
@ -17,16 +17,29 @@
|
|||||||
extern "C" void
|
extern "C" void
|
||||||
panic(const char* format, ...)
|
panic(const char* format, ...)
|
||||||
{
|
{
|
||||||
|
const char hint[] = "*** PANIC ***";
|
||||||
|
char buffer[512];
|
||||||
va_list list;
|
va_list list;
|
||||||
|
int length;
|
||||||
|
|
||||||
platform_switch_to_text_mode();
|
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);
|
va_start(list, format);
|
||||||
vprintf(format, list);
|
length = vsnprintf(buffer, sizeof(buffer), format, list);
|
||||||
va_end(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.");
|
puts("\nPress key to reboot.");
|
||||||
|
|
||||||
clear_key_buffer();
|
clear_key_buffer();
|
||||||
|
Loading…
Reference in New Issue
Block a user