Dear all
I use spritntf() in my code and compile with AVR32-gcc in AVR32Studio. But there is a problem when the program reaches to its end. when i eliminate sprintf() line inmy code, the wrong occurances be eliminated too.
Please say what is the wrong thing i did.
What is the solution?
Who can i use the sprintf() safely?
The avr-gcc C library, avr-libc, provides the printf() family of functions. You can use them after some preparation. General details are in the avr-libc documentation for file stdio.h.
"These notes are specific to the Arduino development environment."
You probably didn't include the correct library, you have to
include <stdio.h>
add the libprintf_mil.a
ans also add to the linker -Wl,-u,vfprintf -lprintf_min
If you are trying to use it for float then ypu have to use the math library too
Dear Alex and Jody
Thanks for your attentions.
I refered to AVR-libC befor and i know the syntaxes.
I have included <stdio.h> too.
The sprintf() did the job correct, But my problems seems due to that the printf() writes illegal data to part of memory which related to one of the other AVR periferals and causes malfanction.
To use the sprintf() you have to add the linker options and object file as well, did you add them?
To solve your problem you have to post your code or even better the AVR studio project in case the problem is related to settings.
We can't solve the problem in a theoretical level, we need the code
How can I add Linkeroption and object file.
I added the -Wl,-u,vfprintf -lprintf_min to Mscellaneus subsection under AVR32/GNU C Compiler in "other flag" field.
But the problem remained unfixed.