Forum Discussion
Altera_Forum
Honored Contributor
16 years agofopen - Memory Mapped Files
Is there a way to have fopen read a file whose contents reside in flash/ram (i.e. not from stdin/stdout rs232/jtag)? Using the nios-ide, I flashed a file into Flash where I have plenty of space...
Altera_Forum
Honored Contributor
16 years agoIf your file resides in CFI flash then would it work to just cast it as a char array? You'd have nice access for reads, but you'd have to manage the sector-at-a-time issues of flash when writing (erasing/programming).
If not, then if it's read-only access you're after, rozip_fs might be enough. Otherwise, you're looking at more work to emulate filesystem-like behavior and/or porting an existing filesystem to Nios II HAL. Of course, none of this applies if you're using uClinux/Linux running on Nios II. Cheers, - slacker