Forum Discussion
file io with NIOS II
- 5 years ago
Hi, Dong Wook
You are right.
However, there is another way, ie using a character-mode device like UART.
Below example is to write characters to a UART called uart1. You can find the device name (/dev/uart1) in the system.h
#include <stdio.h>
#include <string.h>
int main (void)
{
char* msg = "hello world";
FILE* fp;
fp = fopen ("/dev/uart1", "w");
if (fp!=NULL) { fprintf(fp, "%s",msg); fclose (fp);}
return 0;
}
Thanks.
Eric
Hi, Dong Wook
In the BSP Editor, under Software Packages, remember to enter /mnt/host in altera_hostfs->hostfs_name.
Thanks.
Eric
- euem7895 years ago
New Contributor
Appreciate for your reply again, Eric
I'm using JTAG-UART (USB -blaster)
and here is my Qsys diagram
Actually my final goal is performing 'edge dectection' with binary or hex file through FPGA board. That's why I was finding a way to read the file.
BTW, I found there are some ways to read file including the Host-Based-file system you mentioned, and I heard that it is only able to do in debuging mode....
thanks for reading