From 0650b69b5a334dfc460c3782ea686396e961e642 Mon Sep 17 00:00:00 2001 From: Markus Sattler Date: Thu, 9 Jul 2015 19:22:39 +0200 Subject: [PATCH] send postmortem infos to Serial1 to. --- cores/esp8266/core_esp8266_postmortem.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/core_esp8266_postmortem.c b/cores/esp8266/core_esp8266_postmortem.c index 2d749108a..f5ede6c76 100644 --- a/cores/esp8266/core_esp8266_postmortem.c +++ b/cores/esp8266/core_esp8266_postmortem.c @@ -30,7 +30,10 @@ extern void __real_system_restart_local(); extern cont_t g_cont; + +static void uart_write_char_d(char c); static void uart0_write_char_d(char c); +static void uart1_write_char_d(char c); static void print_stack(uint32_t start, uint32_t end); static void print_pcs(uint32_t start, uint32_t end); @@ -46,7 +49,7 @@ void __wrap_system_restart_local() { return; } - ets_install_putc1(&uart0_write_char_d); + ets_install_putc1(&uart_write_char_d); if (rst_info.reason == REASON_EXCEPTION_RST) { ets_printf("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n", @@ -120,6 +123,11 @@ static void print_pcs(uint32_t start, uint32_t end) { ets_printf("<<> USTXC) & 0xff) >= 0x7e) { } @@ -128,3 +136,12 @@ void uart0_write_char_d(char c) { } USF(0) = c; } + +void uart1_write_char_d(char c) { + while (((USS(1) >> USTXC) & 0xff) >= 0x7e) { } + + if (c == '\n') { + USF(1) = '\r'; + } + USF(1) = c; +}