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.

[参考译文] TM4C123GH6PM:sprintf 和堆栈大小

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1065741/tm4c123gh6pm-sprintf-and-stack-size

器件型号:TM4C123GH6PM
Thread 中讨论的其他器件:CC3200

大家好、

我将从 CC3200迁移到 TM4C123GH6微控制器。

在 CC3200上、以下线路正常工作:

sprintf (cmd_cart_common5_m1、"内容长度:%d\r\n\r\n"、iContentLength);

(CMD_CAR_common5_M1是定义为 char[25]的全局变量、 iContentLength 是一个2位整数。)

在 Tiva 芯片上、当向 UART 发送 cmd_cart_common5_M1字符串时、我会收到 ISRFault (可能会导致我尝试发送损坏的字符串。)

除了增加堆栈大小之外、我还需要做其他事情吗?  (我需要为此芯片添加任何特定的 sprintf 库或编译器设置?)

谢谢、

Bob

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

    尊敬的 Bob:

     增加堆栈大小是正确的做法。 通常、我会将堆栈大小增加到大约1500。 我建议您不要使用 sprintf、而是使用 TivaWare 库提供的 usprintf。 要使用 usprintf(),只 需#include "utils/ustdlib.h"头文件即可。 它占用的堆栈尺寸要小得多。  

      

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

    谢谢、这将大有帮助。