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.
#include "stdio.h"
int main(void){
char sf[23];
float s = 0.1243;
sprintf(sf,"%f",s);
printf ("helloworld");
return 0;
}
目前使用CCS7.0,编译已经通过,仅用两个警告如下:
Description Resource Path Location Type
#10210-D creating ".esysmem" section with default size of 0x400; use the -heap option to change the default size EVC_SYSTEM C/C++ Problem
#10247-D creating output section ".cio" without a SECTIONS specification EVC_SYSTEM C/C++ Problem。
烧写到28377s lanchpad中,代码执行到sprintf(sf,"%f",s);语句后就终止了。在printf ("helloworld");处设置断点执行不到,请问这是什么原因造成的?
尝试加大stack, heap:http://processors.wiki.ti.com/index.php/Tips_for_using_printf
另外这边帖子可参考下:http://www.deyisupport.com/question_answer/microcontrollers/tiva_arm_cortex/f/96/t/72208.aspx
您好!
根据您的提示,做了如下修改:
1 修改heap和stack大小
2 修改cmd文件,增加.cio section
3 主程序如下:
int main(void) {
float s = 0.0234;
char sf[30];
sprintf(sf, "%f", s);
printf("Hello World!\n");
printf("helloworld\n");
return 0;
}
运行结果:
在printf("Hello World!\n");语句处设置断点,程序运行不能到达该断点处。sprintf(sf, "%f", s);语句运行没有结束,似乎进入了某种死循环状态(个人猜测)。求解释!