printf() woes
Rick Mann
rmann@latencyzero.com
Wed Jan 30 21:44:00 GMT 2008
On Jan 30, 2008, at 11:10 AM, Jeff Johnston wrote:
> Rick Mann wrote:
>> Hi. I'm using newlib 1.14 on an Atmel ARM processor, and printf()
>> is behaving strangely.
>> The following code
>> printf("1. Hello worldCRLF1\r\n");
>> printf("2. Hello worldCRLF\r\n");
>> printf("3. Hello worldCRLF\r\nHello worldCRLF\r\n");
>> printf("4. Hello worldLF\nHello worldLF\n");
>> printf("5. Hello worldNULL");
>> printf("6. Hello worldLF\n");
>> prints:
>> 3. Hello worldCRLF1
>> 4. Hello worldLF
>> Hello worldLF6. Hello worldLF
>> Using snprintf() works just fine.
>
> Did you attempt to write the result out?
I'm not sure I understand what you mean. I put, in the original post,
the output of those lines of code. It fails to print many of them.
>> Newlib's printf() is doing something with newlines, and printf()
>> calls without newline, and not handling it the way I really want.
>> Perhaps it's a configuration things somewhere, but I don't really
>> know where to look.
>> Any suggestions?
>
> I would suggest upgrading to newlib 1.16.0 to see if any fixes were
> made that solve your problem. Looking through the ChangeLog, none
> are obvious, but it still helps to be current so others can better
> help you.
Is there a way to upgrade newlib without rebuilding all of gcc?
> Next, I would suggest debugging inside _sfvwrite() to see what it
> thinks it is doing. I would also suggest putting breakpoints inside
> the _write syscall to see what it is being called with each time.
> This should help you pinpoint the problem.
Sadly, I have no debugging capabilities right now (other than printf--
ha!).
--
Rick
More information about the Newlib
mailing list