Quantcast
Channel: MSP 低功耗微控制器论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 3634

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

$
0
0

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、哪里出了问题?


Viewing all articles
Browse latest Browse all 3634

Trending Articles