- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I have tried to follow the exsample in the tutorial how to use a HOL filesystem(the one where you include your filesystem as a ZIP file). my code: # include <stdio.h> int main() { printf("Hello from Nios II!\n"); FILE *fileHandle = fopen("/mnt/rozipfs/MTABootloader", "r"); if(fileHandle != NULL) { printf("File is found in FS\n"); } else { printf("There was no file by that name\n"); fileHandle = fopen("/mnt/rozipfs/MTABootloader.srec", "r"); if(fileHandle != NULL) { printf(" 2: File has been found in FS\n"); } else { printf(" 2: There was no file by that name\n"); } } return 0; } Hope you can help. Regards Michael EbbesenLink Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have tried "Run as -> NIOSII hardware" of the test program showed above. But the file cannot be found. It is properly because the filesystem image has not been burnt into the flash. But how do I do that?
The Flash programmer utility ain't much help here. And the nios2-flash-programmer won't work with me :o) Hope someone can give me a hand Regards GreateWhite.DK- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi GreatWhite,
Your code looks okay (you can check the web server example design for an example of the code used to access the file system, http.c in http_find_file() and http_send_file_chunk(), but again, your code looks OK). The problem is that the file system won't be found unless it is properly programmed into flash... the 'mount point' is defined OK, and points off into flash memory (to the device & offset you specified in the ROZIPFS GUI), but unless that memory is programmed there will be no valid file system in place showing the various files present, etc. If you write back with what sorts of problems you're having with the flash programmer I'll try to provide some insight, otherwise I'd reccomend checking out the flash programmer literature and giving it a try -- the flash programmer GUI in Nios II IDE will program flash with your filesystem automatically, assuming that you compiled your project with the zip file system enabled.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Trogdor_the_Burninator ( and others )
When I use the flash utility within the IDE it says that it programs the filling system. But when I try to acces my file afterwards it is not there. How can I verify that the filesystem has been written to the flash??? Must I use the "alt_flash_open_dev" and "alt_read_flash" rutines to verify on a bitpatternlevel or is there a more simple way??? It is really beginning to bug me this filesystem. The WOSFS from NIOS1 was much more straightforward. But this ZIP filesystem sounds in teory to be better but if it won't work that's not much help :o) Hope you can give me some more help. Regards GreateWhite.DK- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello GreateWhite.DK,
You can read out some bytes from the flash where your files are stored to verify the flash process. This could be done with a pointer and printf or with the debugger. Perhaps there is a limitation with the length of the filename. Short the filenames and try it again. Good luck, niosIIuser- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It was not the filenames http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ohmy.gif )
Will try with the flash now. F****** filesystem arrggghhhh. GreateWhite.DK- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi GreatWhite,
OK thank you for the clarification! NiosIIuser was right in that its easy to just use printf() to show the contents of flash. You can also view flash by running the debugger and examining memory in the flash address region. This method can be really useful.. see my explanation below: A very quick way to have a look at the file system vs. flash content is to open the .zip file into a text editor that shows hex & ASCII side-by-side (I use ultra-edit). A big note that I did not mention earlier: your .zip file must be un-compressed! Now, run the debugger and download any software (hello world is fine) into the HW system that you're having trouble with (I am assuming that as you report, you have programmed flash successfully). Now, in the Nios II IDE debugger, use the memory examination feature (there is a "memory" tab in addition to variables, breakpoints, etc.), and type in the hex offset to the start of the file system that you typed into the zip FS GUI. What you see at this memory address should match what you see in the text editor viewing your zip file. Right now I am looking at the web-server content that we ship on the board, and I see index.html and the HTML to go with it as the first thing in flash... so I suppose a further hint is to program some easily readable content into the file system.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did this get solved?

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