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.

[参考译文] TM4C1233E6PZ:使用 sprintf 函数时、堆栈使用率增加约1200字节

Guru**** 2445440 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1173491/tm4c1233e6pz-stack-usage-increases-by-around-1200-bytes-on-using-sprintf-function

器件型号:TM4C1233E6PZ

您好!

我一直面临堆栈溢出问题、在堆栈使用选项卡中、它显示即使堆栈大小为4096字节、堆栈仍被100%使用。 我还观察到 sprintf 函数正在使用更多的堆栈、最终会挂起我的控制器或在全局变量中填充垃圾值。 我将附上屏幕截图链接供您参考。 请帮助我解决此问题。  

使用 sprintf 进行堆栈使用

不使用 sprintf 时的堆栈使用

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

    Shubham、您好!

    sprintf 使用大量堆栈、1200字节在其预期范围内。 通常、我们看到程序需要将堆栈扩展到1500字节才能使用它。 要解决这个问题、请使用  TivaWare 中通过   utils 文件夹中的 ustdlib.c/h 文件提供的 usprintf()函数。

    此致、

    Ralph Jacobi