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.

[参考译文] TMS320F280049C:can't 当设置 printf_support = full 时使用 printf

Guru**** 2411080 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1543428/tms320f280049c-can-t-use-printf-when-set-printf_support-full

器件型号:TMS320F280049C


工具/软件:

大家好、 我使用 printf 通过 SCI 接口发送数据。 根据下面链接的帖子中的建议,我简单地推翻了 write () 函数,如下所示:


int write(int dev_fd, const char *buf, unsigned count) {
  unsigned i;

  /*-----------------------------------------------------------------------*/
  /* Output character-by-character                                         */
  /*-----------------------------------------------------------------------*/
  for (i = 0; i < count; i++) SCI_writeCharBlockingFIFO(mySCIA_BASE, buf[i]);

  return count;
}

但是,当我设置时printf_support = full,即使是简单的printf()调用也无法打印字符串puts(),但仍然有效。

切换到printf_support = nufloat恢复基本的字符串输出通过printf(),我认为可能是与堆栈或堆空间有关的问题。 为了测试这一点、我增加了栈和堆以占用整个 RAM 部分:

与建议的堆大小 0x400 相比、这应该足够了。 但是、它仍然不起作用。 栈使用情况如下所示:

程序卡在这个函数上:

当使用 nofloat 模式时、大小会小得多:

最后、我的目标是使用printf输出浮点‑点数据。 如有任何帮助、将不胜感激。

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

    我禁用了很多代码并printf再次开始工作、因此问题可能是栈/堆溢出。 如何增加堆栈或堆的大小? 这是因为 不允许对栈/堆段进行拆分运行放置。

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

    首先、如果您的优化设置低于 3、我一定会再次检查并将其增大。 其次、请参阅以下文档以获取有关使用 printf 的建议:

    https://software-dl.ti.com/ccs/esd/documents/sdto_cgt_tips_for_using_printf.html

    希望这能有所帮助!

    此致、
    Jason Osborn