急救,为什么说fopen,getc,fwrite,fclose没有定义呀
- UID
- 120104
- 性别
- 男
|
急救,为什么说fopen,getc,fwrite,fclose没有定义呀
我试一个最简单的程序,也就是打开串口,发几个字符,但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;
} |
|
|
|
|
|
- UID
- 84596
- 性别
- 男
|
不应该。你生成工程的时候先选择helloword的那个工程,然后把它改称你上面的。你再试试。 |
|
|
|
|
|
- UID
- 120104
- 性别
- 男
|
谢谢指教,不选'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。 |
|
|
|
|
|
- UID
- 119307
- 性别
- 男
|
EPCS 是存储程序的 并不是跑程序的
RAM 才是跑程序的么,你的片上RAM 空间不够大
当然跑不了了 |
soso I was born to love you |
|
|
|
|
|
- UID
- 120104
- 性别
- 男
|
那我用SRAM的话,怎么把程序调到它里面跑呀,偶是菜鸟,谢谢大家指教。 |
|
|
|
|
|
- UID
- 122517
- 性别
- 男
|
To:yzhyyq, 你的程序存在FLASH中的时候,你程序跑起来的时候,程序会自动COPY to ram中. |
|
|
|
|
|
- UID
- 122517
- 性别
- 男
|
I have compiled your program,No any problem. There are probably problem in your nios IDE setting. |
|
|
|
|
|
- UID
- 120104
- 性别
- 男
|
To gsjdan: 你能不能告诉我该在IDE里怎么设置呀,小弟在您前面回复的贴里也说了,谢谢您指教。 |
|
|
|
|
|