Hi,
My target is TWR-K54F10M and I'm using KSDK1.2 and KSDK1.3 and DSK3.0.
I'm not able to print float values using PRINTF macro(debug_printf).
I have turned on the switch -u _printf_float and it shows up in the linking phase of the build.
However It does not work.
I would appreciate your help.
Regards,
Koorosh Hajiani
Hi Koorosh,
You do want the -u _printf_float and -u _scanf_float checked.
Try increasing your task stack size.
If still having issue please post your project.
Regards,
David
I found out you need to define a macro in Build setting:
Now however I'm having issues with using sprintf with floats.
Any Ideas,
Regards,
Koorosh Hajiani
Please also add the "SCANF_FLOAT_ENABLE" as you did with the "PRINTF_FLOAT_ENABLE".
Regards,
David
Hi David,
Regarding the sprintf not working with float, I noticed that in one of your posts regarding this issue that -u _printf_float switch under the Linker Miscellaneous option , needs to be checked.
When I do this my code hits a trap when it tries to execute sprintf.
So without that option I get all zeros and with those option turned on ,I hit a trap.
Regards,
Koorosh Hajiani
Hi Koorosh,
Please review these posts:
Regards,
David
Thanks much. Printf issue is resolved by the solution proposed by Jennie Zhang in the post you provided.
However now I'm having issue with sprintf :
sprintf(out_buff,"%f", flt_val); with the following:
char out_buff[50];
float flt_val;
when I look at out_buff using debugger it is all zeros with flt_val displaying a float as I expect it to.
Can't figure this one out. Is this the GCC arm or KDS.I've used GCC ARM before and never had any issues.
I need to covert a float number to string and I always used sprintf for this purpose successfully until now.
Any ideas?
Thanks,
Koorosh Hajiani