Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

Problem about the NIOS II IDE c code

Altera_Forum
Honored Contributor II
1,700 Views

I don't know, dose anyone have the same problem with me?? 

MY problem is this... 

I want to printf the data from my NIOS II IDE to the *.txt file 

I try to use the "fopen" like this... 

--------------------------------------------------------------- 

FILE *fpl; 

fpl=fopen("..\\qq.txt","w"); 

fprintf(fpl,"111 %d\n",velocity); 

fclose(fpl); 

--------------------------------------------------------------- 

But, it is not workable. 

Should I have to set anything in the SOPC builder or NIOS II IDE?? 

So, Does anyone could help me?? 

Thank you very much...
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
797 Views

Take a look at the host filing system for Nios II. It only works when debugging and is quite slow, but might suit your needs. 

 

-slacker
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

right click on project,  

 

System Library Properties->Software Components->Altera Host Based File System , check "Add this software component" 

 

File will be created in chosen mount point.
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

 

--- Quote Start ---  

right click on project,  

 

System Library Properties->Software Components->Altera Host Based File System , check "Add this software component" 

 

File will be created in chosen mount point. 

--- Quote End ---  

 

 

Thank you for your suggest. 

But, How to assign the mount-point?? 

Does that mean the file that I creat??
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

 

--- Quote Start ---  

Take a look at the host filing system for Nios II. It only works when debugging and is quite slow, but might suit your needs. 

 

-slacker 

--- Quote End ---  

 

Thank you for your suggest, but could you tell me how to use this method?? 

or  

Do you have any document,  

could you give me some advice??
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

Choose a writable mount point (user folder), folder must exist, and run your Application 

 

FILE *fpl; fpl=fopen("qq.txt","w"); fprintf(fpl,"111 %d\n",velocity); fclose(fpl);  

 

File qq.txt should reside there.
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

 

--- Quote Start ---  

Choose a writable mount point (user folder), folder must exist, and run your Application 

 

FILE *fpl; fpl=fopen("qq.txt","w"); fprintf(fpl,"111 %d\n",velocity); fclose(fpl);  

 

File qq.txt should reside there. 

--- Quote End ---  

 

Thank you. 

I have to try this code, but it seill doesn't work. 

May I ask some question, Should I have to set up anything in NIOS II or file?? 

MY verisonal is NIOS II 9.0v, and I try that code directly. 

I write in my c file of NIOS II, But it doesn't work. 

and I try to Build the *.txt file first. 

It sill doesn't work . Could you help me other advice. Thanks
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

Did you activate the host file system? 

 

right click on project, 

 

System Library Properties->Software Components->Altera Host Based File System , check "Add this software component" 

 

After running your program file will be created in chosen mount point.
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

 

--- Quote Start ---  

Did you activate the host file system? 

 

right click on project, 

 

System Library Properties->Software Components->Altera Host Based File System , check "Add this software component" 

 

After running your program file will be created in chosen mount point. 

--- Quote End ---  

 

 

I just find the file of Host file system. 

Because my NIOS II IDE is 9.0v 

So, I never used that you said. 

And, may I ask you?? 

Do you have any example? 

I try to find the example,but I didn't find that. 

and I try to use the Host file system. 

that open another project file. 

Dose that mean I have to write my c-code to the Host file system file??? 

Or, I can build blank project and include the Host file system project or write the Host file into the function?  

And then, call the function in main function? 

 

Thank you for your help, Thank you.
0 Kudos
Altera_Forum
Honored Contributor II
797 Views

Just activate Host File System in your project as I explained. After this, your program should work.

0 Kudos
Reply