我在做一本书上的实验,我加了CPU、clk、SDRAM、jtag_uart和uart5个器件,在NIOS II 运行了HELLO WORLD程序可以通过,但是下面的通过在键盘输入‘t’来检测是否连接,‘v’来关闭连接,在CONSOLE就没显示,连接和关闭的字符串,请问这是什么原因?还是我少加了什么东西?帮忙解答,谢谢! 下面是我NIOS II的源代码: #include <stdio.h> #include <string.h> int main() { char* msg = "Detected the character 't'.\n"; FILE* fp; char prompt = 0; fp = fopen("dev/jtag_uart","r+"); if (fp) { while(prompt != 'v') { prompt = getc(fp); if(prompt == 't') { fwrite(msg,strlen(msg),1,fp); } if(ferror(fp)) clearerr(fp); } fprintf(fp,"Closing the JTAG_UART file handle.\n"); fclose(fp); } printf("Hello Nios II!\n"); return 0; } |