LoadProhibited on fprintf in function set by esp_log_set_vprintf

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

LoadProhibited on fprintf in function set by esp_log_set_vprintf

Postby f.h-f.s. » Mon Oct 09, 2017 2:19 pm

I am trying to split ESP logging to both the UART and a File on Wear-level, however I am getting a "LoadProhibited" when I try to call fprintf on the FILE* in the function set by esp_log_set_vprintf. I don't see any hints in the backtrace on what I am doing wrong.
fprintf works perfectly when I am not calling it inside LogDuplicate.

Any help would be appreciated.

Backtrace:

Code: Select all

Guru Meditation Error of type LoadProhibited occurred on core  0. Exception was unhandled.
Register dump:
PC      : 0x400014fd  PS      : 0x00060830  A0      : 0x80110a3c  A1      : 0x3ffebb00
0x400014fd: ?? ??:0

A2      : 0x0000000c  A3      : 0x00000008  A4      : 0x000000ff  A5      : 0x0000ff00
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x3ffebab0
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3ffebd44  A13     : 0x3ffce60c
A14     : 0x3ffebebf  A15     : 0x00000000  SAR     : 0x00000004  EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000000c  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff
0x400014fd: ?? ??:0

0x4000150d: ?? ??:0


Backtrace: 0x400014fd:0x3ffebb00 0x40110a39:0x3ffebb10 0x401059a9:0x3ffebe20 0x401036cb:0x3ffebe70 0x4008270d:0x3ffebea0 0x401056e1:0x3ffebef0 0x401051c5:0x3ffebf50

 0x401052a4:0x3ffebf70
0x400014fd: ?? ??:0

0x40110a39: _vfprintf_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vfprintf.c:1

529

0x401059a9: fprintf at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/fprintf.c:56

0x401036cb: LogDuplicate(char const*, __va_list_tag) at C:/IoT/BEASTv3/main/FSLog.cpp:34

0x4008270d: esp_log_write at C:/IoT/BEASTv3/esp-idf/components/log/log.c:202

0x401056e1: updateStats at C:/IoT/BEASTv3/main/Statistics.c:66

0x401051c5: Ping::Now() at C:/IoT/BEASTv3/main/Ping.cpp:55

0x401052a4: Ping::Task(void*) at C:/IoT/BEASTv3/main/Ping.cpp:69 (discriminator 1)
Function set with esp_log_set_vprintf

Code: Select all

int LogDuplicate(const char *format, va_list args)
{
	if (_logFile != NULL)
	{
		// Write to file
		fprintf(_logFile, format, args);
	}

	// Write to stdout
	return vprintf(format, args);
}

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: LoadProhibited on fprintf in function set by esp_log_set_vprintf

Postby ESP_igrr » Mon Oct 09, 2017 3:42 pm

Did you mean to call vfprintf instead?

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: LoadProhibited on fprintf in function set by esp_log_set_vprintf

Postby f.h-f.s. » Wed Oct 11, 2017 7:48 am

Wow ok, yes. distinct difference that I did not notice =/ Thanks.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 116 guests