Altera_Forum
Honored Contributor
15 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, but at runtime I need to perform FILE type operations on it. If I just pass the (flash) memory address as the handle and cast it as FILE, it doesn't work, the typedef FILE has a host of elements, but the memory address contains just the data. How is this generally done? Is there a way to mount a pointer that points to data such that fopen/fgetc/etc work? Since I'm low on ram, I'd hate to have to copy the same data just to serialize it! type=memory, memmapfile / MMFIO