EmbDev.net

Forum: ARM programming with GCC/GNU tools iprintf problems


Author: Mike Betz (mikebetz)
Posted on:

Rate this post
0 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

Author: Mike Betz (mikebetz)
Posted on:

Rate this post
0 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

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 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...
)

Thanks for the information.

Martin Thomas

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.