Forum: ARM programming with GCC/GNU tools sprintf %f float problem-YAGARTO

von Kamil B. (kamil51)

Rate this post
0 useful
not useful

I am using yagarto 4.4.2 version. if i use sprintf with %f the program 
seems to be halts!! but no any problem in &d %x....

anybody have the same problem???



von Alexander (Guest)

Rate this post
0 useful
not useful
Hello Kamil,

i have also problems using %f with this version of the toolchain. I am 
using sprintf to print a float number into a string. What i have found 
is that the sprintf with %f prints float numbers that are nearly 200 
chars long. So i got a overflow of my char array. Now im using an older 
version of gnuarm that works without errors.
What type of CPU are you using? Has it hardware float support? Im using 
an AT91RM9200 without float support. I'm using soft float and that works 
well, with the exeption of the printf function.



von kamil bahadir (Guest)

Rate this post
0 useful
not useful
Hello Alexander,

I am using LPC 2138. it has no float hardw.
i found a solution by using float2str() function.

but no any solution by using "syscall" functions.



von Martin Thomas (Guest)

Rate this post
0 useful
not useful
A few thinks you may try to test:

- if enabled: disable thumb/thumb-interwork during tests. Options can be 
enabled later when problem has been located.

- check if the linker uses the correct libc and libm (no -L options 
poiting into the toolchain installation-directory, arm-*-gcc used for 
linking - not arm-*-ld)

- check the defintion of the heap-start address  (linker-script, 
map-file, symbol-table) and the sbrk syscall are correct

- make sure dynamic memory allocation works (use malloc and free for 
tests). I suggest to allocate at least 8KB during the tests which should 
lead to 3 calls to sbrk (with a newlib that has been configured without 
SMALL_MEMORY, AFAIK M. Fischer does not configure with SMALL_MEMORY for 

- check if the math-library is linked (option -lm for linkage, library 
name libm-a)

- try with the latest version of Yagarto or with Codesourcery G++ lite 
for ARM EABI (both arm-eabi)

von Kamil B. (kamil51)

Rate this post
0 useful
not useful
Hello Martin,

Very thanks for your suggestions. after testing i will be back to you.

Best Regards



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.