- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 / MMFIOLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If 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
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page