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.

[参考译文] TMS320F28027:使用 printf 时会使中文字符变乱

Guru**** 2777235 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf

器件型号:TMS320F28027

大家好、

1. 当程序卷不大时,通常使用 printf 可以在串行端口助手上显示中文字符串

2. 随着程序数量的增加,中文字符串会使用 printf 变乱,英文字符会正常显示

谢谢、此致

耶鲁李

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    [引用 userid="514648" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf "]随着程序数量的增加[/quot]

    这到底意味着什么? 这是指代码的实际大小吗? 我不知道为什么只有中文字符会受到这种影响。 您使用哪个终端程序来查看串行端口的字符串?

    谢谢

    Ki

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Ki、

    感谢您的回复!

    [引用 userid="2210" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf/4205854 #4205854"]这是否指代码的实际大小?

    是的。

    [引用 userid="2210" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf/4205854 #4205854"]您正在使用哪个终端程序来查看串行端口的字符串?

    SSCOM v5.13.1

    谢谢、此致

    耶鲁李

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢。

    目标是如何运行的? 是使用 CCS 吗?

    如果您使用不同的终端程序、您是否看到相同的结果?

    谢谢

    Ki

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Ki、

    [引用 userid="2210" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf/4208224 #4208224"]它是否使用 CCS?

    是的。

    [引用 userid="2210" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf/4208224 #4208224"]如果您使用不同的终端程序,您是否会看到相同的结果?

    是的、问题仍然存在。  

    谢谢、此致

    耶鲁李

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我没有解释为什么代码大小的增加会影响序列上中文字符的 printf。  

    您是否能够通过 JTAG 尝试 printf 来查看它是否也受到影响?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Ki、

    很抱歉耽误你的回答。

    [引用 userid="2210" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf/4215601 #4215601"]您是否能够通过 JTAG 尝试 printf 以查看它是否也受到影响?[/quot]

    不、它不受影响。

    客户发现 他添加的 unit16 array[400]引起了问题。 出现此警告:  

    说明资源路径位置类型 #10247-D 创建输出段".CIO"、不包含段规范 F2803xHFSpwm3B C/C++问题

    当他从代码中删除数组时、一切都将正常。

    他怀疑堆栈问题是原因所在。

    谢谢、此致

    耶鲁李

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="514648" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1133291/tms320f28027-chinese-characters-are-garbled-when-using-printf/4371635 #4371635"]否,不受影响。

    感谢您的确认。

    该问题似乎是特定于通过 UART 实现 printf 的问题。 编译器 RTS 库仅支持通过 JTAG 进行 printf、因此我假设已经完成了一些自定义实现来使其正常工作?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Ki、

    谢谢。  是否有任何有关 JTAG printf 的材料?

    谢谢、此致

    耶鲁李

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    下面的文章是有关 printf 如何与 CCS 配合使用的良好入门知识:

    https://dev.ti.com/tirex/explore/node?node=A__AIwt8bIK1yTVvzbnfYL0gg__ccs_devtools__FUz-xrs__LATEST

    CCS 中 printf 的默认传输是 JTAG。 任何其他操作通常都需要自定义端口。