我试一个最简单的程序,也就是打开串口,发几个字符,但bulid project时,总告诉我fopen,getc,fwrite,fclose函数没有定义,怎么回事呀,不是Nios II 兼容标准C函数吗,那位大侠帮忙呀,郁闷死了,先说谢谢啦.
#include
#include
int main ()
{
char *msg = "Detected the character 't'.\n";
FILE *fp;
char prompt = 0;
fp = fopen("/dev/uart1", "r+"); //Open file for reading and writing
if (fp)
{
while (prompt != 'v')
{ // Loop until we receive a 'v'.
prompt = getc(fp); // Get a character from the UART.
if (prompt == 't')
{ // Print a message if character is 't'.
fwrite(msg, strlen (msg), 1, fp);
}
}
fprintf(fp, "Closing the UART file.\n");
fclose (fp);
}
return 0;
}作者: ytiger 时间: 2005-9-7 22:29
谢谢指教,不选'small c library'可以解决问题,可能是选了后C 库太小的原因吧。但是不选,又来新问题,我build project,总提示说region onchip_memory_0 is full (serial_communications.elf section .text). Region needs to be 34320 bytes larger.我系统里面已经用了EPCS64,但好像没取作用呀,哪位大侠指点一下该怎么做,我没用片外SRAM。作者: admiral1 时间: 2005-9-11 09:54