Forum: ARM programming with GCC/GNU tools newlib behaviour no printf!

Author: Bangla B. (Company: Bangla) (bangla)
Posted on:

Rate this post
0 useful
not useful
Hi All,
I am trying to use the printf (and all the IO functions of the stdlib) 
unsuccessfully. My set-up is gcc 4.6.0 (patched), binutils 2.21 
(patched) and newlib 1.19.0. I have a kernel, so the tools are created 
to be reentrant. I have noticed that when I use printf, putc, etc. the 
libc.a didn't call my routines (i.e _write_r, etc.). In the link I have 
eliminated the reference to my syscall to verify that they were demanded 
by the libc.a; It is the case. I have also noticed that libc.a call only 
once one of my routine, the "void __malloc_lock(reent_t *reent)". Any 
suggestion to fix this printf problem? Here is more information:
- cpu STM32
- stack lenght 8k
- Flags I used for building the newlib:

./configure --target=${TARGET} --prefix=${prefix} --enable-multilib \
  --enable-target-optspace --disable-nls   --enable-interwork \
  --enable-thumb --enable-newlib-multithread \
  --enable-newlib-io-long-long \
  --disable-libssp \
  --disable-libgloss \
  --disable-newlib-supplied-syscalls \

make -j 4 "CFLAGS=-Wno-error" \
make install
make clean

I have also tried the Yagarto build with the same behavior.
Thank you for your help.
 Regards, Bangla

Author: Oliver (Guest)
Posted on:

Rate this post
0 useful
not useful
Well, I don't know how to help you. The only thing I can say that I 
successfully got it to work without big issues using Yagarto and newlib 
1.19.0, although in the non-reentrant version.

Maybe you step through the code, to figure out where something goes 
wrong, using either your Programmer or gdb in arm simulation mode.



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.