Jan Wester wrote:
Hi
I'm not calling by myself, trying to enable standard debug output In debug.h it is declared as:
[snip]
And in lwipopts.h I try to declare:
#define LWIP_PLATFORM_DIAG(m) {sprintf(buffer, m); \
                               SioWriteString(2, buffer); \
                              }

SioWriteString() is my function to write to my serialport.
LWIP_DEBUGF(debug,(("foo\n"))); This works (only format string)
LWIP_DEBUGF(debug,(("foo=%d\n", foo))); This don't works

I can't use printf becuse of library use system calls for _write()

In that case it is best to write your own alternative function to do it in there, e.g.:

extern int my_printf(const char *fmt, ...);
#define LWIP_PLATFORM_DIAG(m) do {my_printf m;} while(0)

and elsewhere something like:
int my_printf(const char *fmt, ...)
{
  int ret;
  va_list ap;
  va_start(ap, fmt);
  ret = vsprintf(buffer, fmt, ap);
  va_end(ap);
  SioWriteString(2, buffer);
  return ret;
}

Jifl
--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine


_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to