I found, that printf_P (and other xxprintf_P) is not reenterable. 
(I am using some sort of thread switching library)

problem is in this lines:
stdout->flags |= __SPGM;
stdout->flags &= ~__SPGM;

I've solve this by adding this function body in program:

int printf_P(const char *fmt, ...)
{
  va_list ap;
  int i;

  va_start(ap, fmt);
  //stdout->flags |= __SPGM;
  i = vfprintf(stdout, fmt, ap);
  //stdout->flags &= ~__SPGM;
  va_end(ap);

  return i;
}

and initialization of stdout (I'm not using other then _P versions of printf):

stdout->flags |= __SPGM;


_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to