TI中文支持网
TI专业的中文技术问题搜集分享网站

为什么在IAR和CCS下将printf()重定向到uart区别很大?CCS很残疾啊?

1、代码几乎一样

#include "msp430.h"
#include "stdio.h"

float a=10.5;

/**
* main.c
*/
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
while(1)
{
printf("%f",a);
}
}

int fputc(int _c, register FILE *_fp)
{
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = _c;
return(_c);
}

2、print_support都选最大的

3、编译后代码量差别很大

4、将代码下载到MSP430芯片,CCS编译的大体积代码却只支持printf("%s")不支持printf("%f")printf("%d"),而IAR编译的小体积代码却支持全功能的printf();

5、哪里出了问题?

Susan Yang:

首先建议您详细看一下下面的wiki页面说明

processors.wiki.ti.com/…/Printf_support_for_MSP430_CCSTUDIO_compiler

full: Supports all format specifiers. This is the default.
nofloat: Excludes support for printing floating point values. Supports all format specifiers except %f, %F, %g, %G, %e, and %E.
minimal: Supports the printing of integer, char, or string values without width or precision flags. Specifically, only the %%, %d, %o, %c, %s, and %x format specifiers are supported

灰小子:

不能单纯比较代码量的。

两个开发环境差别还是很大的

赞(0)
未经允许不得转载:TI中文支持网 » 为什么在IAR和CCS下将printf()重定向到uart区别很大?CCS很残疾啊?
分享到: 更多 (0)