lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SV: [lwip-users] Re: LWIP_PLATFORM_DIAG


From: Jonathan Larmour
Subject: Re: SV: [lwip-users] Re: LWIP_PLATFORM_DIAG
Date: Thu, 10 Jan 2008 12:50:45 +0000
User-agent: Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]