-->
Page 1 of 1

FreeRTOS using vsnprintf

PostPosted: Sat Jan 17, 2015 10:48 am
by hreintke
LS,
Working on a ESP8266/Arduino combination.
I will be redirecting the "normal" printf output to NULL or telnet for debug output.
That then leaves the uart0 clean for communication to the arduino.
I saw a nice implementation of printf functionality in the frankenstein implementation.
This is my slightly adapted version.
Code: Select allint uart0_printf(const char *fmt, ...)
{

   int ret;
   va_list ap;
   char p[256];
   va_start(ap, fmt);

    ret = vsnprintf(p,256,fmt,ap);

    va_end(ap);
    for (int i = 0;i<ret;i++){
       uart0_write_char(p[i]);
    }
   return ret;
}


This compiles OK but at linking I get the error
user/firmware/eagle/debug/lib/libuser.a(app_utils.o):(.text+0x0): undefined reference to `vsnprintf'

Tried to add -lc (libc ?) to the link command in makefile but that gives a lot of other errors.
Is there an easy way to include the vsnprintf into a RTOS SDK project ?
Regards,
Herman

Re: FreeRTOS using vsnprintf

PostPosted: Wed Jan 21, 2015 5:29 pm
by hreintke
LS,
On the bbs.expressif forum there is an item on vsnprintf too.: http://bbs.espressif.com/viewtopic.php?f=7&t=142

There is mentioned that one can use ets_vsnprintf but trying that I also need ets_str which I cannot locate.

Does anyone (from expressif ?) can explain how to use vsnprintf or ets_vsnprintf in FreeRTOS SDK ?

Herman