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++
12606 Discussions

File access in uCLinux on NIOS II

Altera_Forum
Honored Contributor II
963 Views

I have sort of an elementary question. If I build a program that runs on uCLinux which is running on NIOS II, how can use file I/O? I mean where should the file be stored so it can be accessed at run-time? Obviously, you have to specify the path to the file in the source code or get in from the user at run-time, but how do I get the file to the FPGA, and where should it be stored? 

 

Thank you.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
225 Views

regarding user space, NIOS Linux is not different from any other Linux, so you can consult any Linux literature available on this.  

 

A nice booting strategy for Linux NIOS (I suppose it's the default in the distr) is to use the INITRAMFS and just keep it up. With that, when starting, the Kernel creates a RAM based file system and initializes it from a compressed data stream that is stored within the Kernel-executable (and freed when not needed any more). Thus the booting strategy is just loading the Kernel-executable int RAM and start it.  

 

The distr provides means to create files in the INITRAMFS when designing the Kernel. The "vendor" directory is used to hold definitions for that, you might want to create your own subdirectory within "vendor" for your purposes. 

 

As INITRAMFS can be written to at runtime, you in many cases don't need another file system. If you want to store data permanently, you should use an additional FLASH based file system such as JFFS2. 

 

-Michael
0 Kudos
Altera_Forum
Honored Contributor II
225 Views

Is there a tutorial showing how to use INITRAMFS for linux nios2? 

 

EDIT: Can I simply copy over the files from the NIOS II command line?
0 Kudos
Altera_Forum
Honored Contributor II
225 Views

INITRAMFS:  

 

http://www.nioswiki.com/special:search?search=initramfs&type=fulltext&go=find 

 

You can't copy files from your debug hist to the NIOS device using just the command line. A way to copy files over at runtime is using FTP. You can either activate an FTP server in the NIOS device or on your debug host. 

 

-Michael
0 Kudos
Reply