Board logo

标题: coldfire7.1 printf函数问题 [打印本页]

作者: zangqihappy    时间: 2008-12-2 09:10     标题: coldfire7.1 printf函数问题

在coldfire6.4环境下,RAM方式

/*
* File: main.c
* Purpose: sample program
*
*/
#include "support_common.h" /* include peripheral declarations and more */
#include <stdio.h>

int main(void)
{
printf("Hello World in C\n\r");

fflush(stdout);

while(1) {

printf("DEBUG");

}
}

串口正常输出

而在coldfire7.1下,INTERNEL_RAM方式

/*
* main implementation: use this sample to create your own application
*
*/
#include "support_common.h" /* include peripheral declarations and more */
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
/* Standard IO is only possible if Console or UART support is enabled. */
#include <stdio.h>
#endif

int main(void)
{
int counter = 0;
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
printf("Hello World in C from MCF52233 derivative on MCF52233 board\n\r");
fflush(stdout);
#endif
for(;;) {
counter++;

printf("DEBUG");
}
}

出现错误:

Link Error : Undefined : "InitializeUART"
Referenced from "__init_uart_console" in C_4i_CF_SZ_MSL.a

Link Error : Undefined : "WriteUARTN"
Referenced from "__write_console" in C_4i_CF_SZ_MSL.a

Link failed.

是何原因


作者: strongchen    时间: 2008-12-2 10:04

没有INCLUDE进stdio.h?
作者: zangqihappy    时间: 2008-12-3 09:22

跟踪变量的确是没有include stdio.h

但是问题不是出在这里






欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0