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.

TMS320F28P550SJ: Error using %f

Part Number: TMS320F28P550SJ
Other Parts Discussed in Thread: C2000WARE,

Tool/software:

Hello, engineers. We are currently working on creating a learning guide for the F28P550. However, we have encountered a problem when using the floating-point data format string.
Version environment: Windows 11, CSS 20.1.1.8__1.7.1, C2000Ware_5.04.0.00;
Neither the projects created through CCS nor the routines in C2000Ware can utilize the %f formatting function of the standard C library. Any floating-point operation involving %f will cause the system to freeze.
For example, in the code use:
printf("%.2f\r\n"12.1);
sprintf(buf, "%.2f\r\n"12.123);
Single-step debugging through the XDS110 debugger reveals that the program gets stuck and does not execute the task when it reaches the above code. However, the XDS110 can still control the chip to reset.
Tried solutions:
1. Add include<stdio.h>, stdlib.h
2. Increase stack 0x400 0x400
3. Enable the project's --printf-support = full
All failed.
Although other custom functions can be used in the code to solve the problem of outputting floating-point data, it would be rather cumbersome. It is more desirable to directly format it as a string using %f.
Could you please share any ideas about the usage of %f?
  • 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, engineers. We are currently working on creating a learning guide for the F28P550. However, we have encountered a problem when using the floating-point data format string.
    Version environment: Windows 11, CSS 20.1.1.8__1.7.1, C2000Ware_5.04.0.00;
    Neither the projects created through CCS nor the routines in C2000Ware can utilize the %f formatting function of the standard C library. Any floating-point operation involving %f will cause the system to freeze.
    For example, in the code use:
    printf("%.2f\r\n", 12.1);
    sprintf(buf, "%.2f\r\n", 12.123);
    Single-step debugging through the XDS110 debugger reveals that the program gets stuck and does not execute the task when it reaches the above code. However, the XDS110 can still control the chip to reset.
    Tried solutions:
    1. Add include<stdio.h>, stdlib.h
    2. Increase stack 0x400 0x400
    3. Enable the project's --printf-support = full
    All failed.
    Although other custom functions can be used in the code to solve the problem of outputting floating-point data, it would be rather cumbersome. It is more desirable to directly format it as a string using %f.
    Could you please share any ideas about the usage of %f?
  • 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