Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Discussions

HOL filesystem does not seem to work.

Altera_Forum
Honored Contributor II
2,330 Views

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 Ebbesen
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
1,138 Views

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&#39;t much help here. 

And the nios2-flash-programmer won&#39;t work with me :o) 

 

Hope someone can give me a hand 

 

Regards 

GreateWhite.DK
0 Kudos
Altera_Forum
Honored Contributor II
1,138 Views

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&#39;t be found unless it is properly programmed into flash... the &#39;mount point&#39; 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&#39;re having with the flash programmer I&#39;ll try to provide some insight, otherwise I&#39;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.
0 Kudos
Altera_Forum
Honored Contributor II
1,138 Views

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&#39;t work that&#39;s not much help :o) 

 

Hope you can give me some more help. 

 

Regards 

GreateWhite.DK
0 Kudos
Altera_Forum
Honored Contributor II
1,138 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,138 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,138 Views

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&#39;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.
0 Kudos
Altera_Forum
Honored Contributor II
1,138 Views

Did this get solved?

0 Kudos
Reply