Other Parts Discussed in Thread: C2000WARE,
Tool/software:
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Part Number: TMS320F28P550SJ
Tool/software:
各位工程师好,我们正在使用F28P550制作其学习指南。但是在使用浮点型数据格式化字符串时发生了问题。
版本环境:win11, CSS 20.1.1.8__1.7.1 ,C2000Ware_5.04.0.00;
通过CCS创建的工程以及C2000Ware中的例程,都无法使用标准C库的%f格式化功能,涉及到浮点运算 %f 都会死机。
例如在代码中使用:
printf("%.2f\r\n",12.1);
sprintf(buf, "%.2f\r\n", 12.123);
通过XDS110调试器单步调试发现执行到以上代码时会直接卡死不执行任务,但是XDS110还可以控制芯片复位。
尝试过的解决方法:
1. 添加 include<stdio.h>、stdlib.h
2. 增加堆栈 0x400 0x400
3. 开启工程的 --printf-support = full
都失败了。
虽然在代码中可以使用其他自定义功能解决输出浮点型数据的问题,就是会比较繁琐。更希望使用 %f 直接格式化为字符串。
请问关于 %f 的使用有什么思路吗?
Hello, we can only support posts in English. Please repost your question in English or post to C2000︎ 微控制器论坛 - C2000 微控制器 - E2E 设计支持 (ti.com). Thank you.
Hello,
Thanks for your patience. Please allow another day for me to check with compiler team on this.
Best Regards,
Allison
You have already tried some of the suggestions in Tips for using printf. But I think it makes sense for you to go through them again. Especially the hello world example. Does that work?
Thanks and regards,
-George