Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

NIOS2 Print to FIle

Altera_Forum
Honored Contributor II
1,179 Views

Hi,  

 

I was wondering if there is a way to print to output file from NIOS2. I have a program that generates 64K worth of data, and I wanted to print them out for comparison. I am using Nio2 and Quartus 7.2 with sp3.  

 

Thanks.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
373 Views

 

--- Quote Start ---  

Hi,  

 

I was wondering if there is a way to print to output file from NIOS2. I have a program that generates 64K worth of data, and I wanted to print them out for comparison. I am using Nio2 and Quartus 7.2 with sp3.  

 

Thanks. 

--- Quote End ---  

 

 

Yes. "Altera Host-Based File System" provides this facility. It is available in "Software Components" in the "System Library Properties" of the project. By default it is not enabled, so you must enable it. Also, it can only be used in the Debug mode.
0 Kudos
Altera_Forum
Honored Contributor II
373 Views

nice, thank you very much!

0 Kudos
Altera_Forum
Honored Contributor II
373 Views

 

--- Quote Start ---  

Yes. "Altera Host-Based File System" provides this facility. It is available in "Software Components" in the "System Library Properties" of the project. By default it is not enabled, so you must enable it. Also, it can only be used in the Debug mode. 

--- Quote End ---  

 

 

Thank you for your post. I have enabled "Altera Host-Based File System" in NIOS2 and tried to debug the following code to generate some output: 

 

FILE *fp; fp = fopen("log.txt", "w"); int i = 0; for (i = 0; i < 65536; i++) { fprintf(fp, "%d\n", i); } fclose(fp); And then I tried to find the log.txt file at the mount point. However, it doesn't matter if I explicitly or implicitly specified the path of the log, ie. "/mnt/host/log.txt" or "log.txt" or used differnet paths "/home/lc2454/Documents/log.txt", I wasn't able to find the generated file. I even tried to create the log.txt file myself and made it chmod a+rw but still it wasn't written. Therefore, I was wondering if you can elaborate on how we can use this or point out a tutorial of some sort. Thanks in advance!
0 Kudos
Reply