How to get printf() output?
Toralf Lund
toralf@procaptura.com
Thu Sep 25 13:13:00 GMT 2003
>
>> Toralf Lund wrote:
>>
>>> Can someone repeat for me what I should do to get printf() to work
>>> when linking with newlib, but not libgloss? I was under the
>>> impression that write() would be called eventually, but it looks
>>> like it isn't. I've tried step-tracing the printf execution via the
>>> ROM monitor to find out what is going on, but it's a bit hard to
>>> follow...
>>>
>>> Just to make it clear: I have provided custom version all routines
>>> necessary to link the application correctly, including read(),
>>> write(), open() and close(). I'm linking with libc, libm and crt0.o,
>>> but not libgloss or similar.
>>
[ And so on ]
I just discovered something purely by accident: printf() behaves like
sprintf() on my setup - if I do
char buffer[1024];
printf(buffer, "string\n");
write(0, buffer, strlen(buffer));
then "string" will appear on the TTY (not when calling printf(), but
after write().) Any idea why this happens? How can I change the behaviour?
My first thought when I discovered this was that I must have
#define printf sprintf
somewhere, but that's not it, as the function call is still printf(),
not sprintf(), after preprossing.
- Toralf
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list