iprintf problems

OP #1170986
Rate this post
• ▲ useful
▼ not useful
Hi Martin,

To start with - thanks for WinARM. Certainly has got me going on my
at91sam7s256 quicker than expected.

Problem though - I have taken the syscalls.c file from one of your
examples and changed the write function from supporting the usart0 to
supporting my lcd. i.e. I have a lcdputchar function which prints a
character on the lcd. If I call iprintf with a \n at the end of the
format string, iprintf works, if I remove the \n, I get no output. The
same applies for printf etc.

My lcdputchar function is extremely simply - it just outputs the
received character to the lcd.

Any ideas anybody?

Thanks
Mike
OP #1170987
Rate this post
• ▲ useful
▼ not useful
Mike Betz wrote:
> Hi Martin,
>
> To start with - thanks for WinARM. Certainly has got me going on my
> at91sam7s256 quicker than expected.
>
> Problem though - I have taken the syscalls.c file from one of your
> examples and changed the write function from supporting the usart0 to
> supporting my lcd. i.e. I have a lcdputchar function which prints a
> character on the lcd. If I call iprintf with a \n at the end of the
> format string, iprintf works, if I remove the \n, I get no output. The
> same applies for printf etc.
>
> My lcdputchar function is extremely simply - it just outputs the
> received character to the lcd.
>
> Any ideas anybody?
>
> Thanks
> Mike

Problem solved. 'setvbuf' is the answer.

TTFN
Mike
Guest #1170988
Rate this post
• ▲ useful
▼ not useful
Mike Betz wrote:

> Problem solved. 'setvbuf' is the answer.

Yes, as far as I know the output for the newlib's (i)printf is buffered
by default. IRC I once used fflush(stdout) to work around this but
setvbuf seems to be a better solution.

I usualy use a smaller but not very universal "rprintf" for my projects,
so I can not say too much about the newlib's implementation. If you are
interested: I have included this small version in the
efsl-ARM-interfaces (efsl_dbg_printf_arm.c in the zip-archive from
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/efsl_arm/index.html
)

Thanks for the information.

Martin Thomas

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.