Question

iam currently using NIOS II with Quartus II v12.0

Since Nios II uses Language C, it would be allowed to open files, but the command fopen("filename","readmode"); is not avaiable for using, cause its not located on stdio.h from Nios, so my doubt is, how can I open a file in Nios? would I need to use a new library? will I have to change my codeblocks stdio.h to my Nios one?

Thanks for now.

Was it helpful?

Solution 2

I have used the Demonstration project from DE2-115 DVD and got an FAT library, now I can open files.

OTHER TIPS

I just took a look at the Nios II Software Developers Handbook, and see that uses the Newlib C library, and the developer manual refers to fopen() so I can only assume that you are incorrect. Newlib is open-source, so you could investigate for yourself.

Even then Newlib library does not implement a file-system in any case - stdio is not a filesystem; rather it provides a standard interface to any stream I/O device. The file-system itself is normally provided by an operating-system or third-party library.

Even if you have a file-system, you still have to provide the low-level interfacing between it and stdio in any case, via the Newlib syscalls stubs in this case.

NiosII defines only the processor architecture, any file system hardware would be entirely proprietary, so it is not possible to have file-system support that works out of the box in any case - it would have to be adapted to your hardware.

What kind of device are you intending on creating a file-system on? You might use a third-party library such as EFSL or ELM FatFs. You could use them stand-alone or integrate them into stdio by implementing appropriate syscalls.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top