Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21611 Discussions

Web Server example

Altera_Forum
Honored Contributor II
2,797 Views

Hi, 

 

With reference to the web server example available in Altera Wiki http://www.alterawiki.com/wiki/web_server_with_ajax_progress_bar, I tested the example project and it works fine ( it was tested on FPGA Cyclone III with flash memory on the development kit.  

 

I want to run the web server project on a kit that does not have flash memory, instead I used epcs controller to upload the ro_zipfs.zip file (of course I modified the base address of epcs controller accordingly) ......what I got on the web browser is: Can't open the 404 File Not Found error page. Have you programmed the filing system into flash? 

 

Is it possible to use epcs controller instead of flash memory,if yes, why am I receiving the above error message? 

 

Thanks
0 Kudos
17 Replies
Altera_Forum
Honored Contributor II
2,035 Views

I don't know the exact location but as far as i remember you have to modify the source-code to match the epcs controller instead of the flash.

0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Thanks for your hint. 

 

I looked for something related to the flash memory in the c code, however I could not find any thing!
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Hi abubaha, 

 

Did you get any further with this, i have also attempted to put the zip file in epcs as i was hoping to remove the flash from our board. I encountered a number of problems. One of which is being unable to easily locate (Offset within EPCS) the zip file in the EPCS using the flash programmer as the epcs controller is only 2kb in size i cannot add an offset. 

 

I tried to modify the Address and then use the srec parsing to add this to the correct offset. I can send the file but still no dice on accessing the file. 

 

Any ideas or anyone else who knows what to do this would be great. 

 

Cheers 

Tim
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Hi Drinkyfish, 

 

Unfortunately I did not reach to a solution for this problem yet! 

 

Regarding setting the offset, it is one of the modification that you have to made, however it is not the only one, there should be some modification in the C code that is responsible of "reading" and "writing" to the ecps (this part I did not work on it yet) 

 

Regarding the 2kb size, I also face this issue, however it does not make a sense! because the smallest epcs is 2MB.....but I do not know why it show 2kb 

 

In order to find the base address and offset for the epcs, do the following: 

 

1- From the flash programmer --> select New--> select the sopcinfo file 

2- Under epcs_controller tab --> add the zip file --> after that you can see the base address and offset. (see picture 01 in the attachment) 

3- Now right clich on the component folder --> Nios II --> BSP Editor --> select "Software Packages" tab 

4- Fill here the base address and offset accordingly (pic 02 attached) 

 

Good luck in your work and update me with any news!
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Hi abubaha, 

 

I know the reason for the 2Kb size, this is because the EPCS controller component only exposes some registers and is not the actual peripheral itself. I have tried to convert the flash file using the bin2flash command and setting the offset, this has worked and i can then use a modified setup with SrecParsing based on the altera design in the Alternative boot loading example (An458). This writes the file to the correct location in EPCS. But still no go on loading the files. I'll look into the Source files for the ro-zipfs must be something in there... 

 

I'll let you know if i find anything. 

 

Cheers 

Tim
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Hi abubaha, 

 

I have manged to get this working (or at least on my setup) What you'll need to do is change 3 sections within the altera_ro_zipfs.c file. 

 

static alt_u32 read_word(alt_u8* current_ptr) { if (ALTERA_RO_ZIPFS_BASE == EPCS_FLASH_CONTROLLER_BASE) { alt_u32 RetValue; alt_u32 Offset = (current_ptr - ALTERA_RO_ZIPFS_BASE); alt_flash_dev *dev = alt_flash_open_dev("/dev/epcs_flash_controller\0"); //Do EPCS Flash Read alt_epcs_flash_read(dev, Offset, (void*)&RetValue, 4); alt_flash_close_dev(dev); return RetValue; } else { As before }  

 

Same as above for the read_half_word (only replace the 4 with 2 for length) 

 

int alt_ro_zipfs_read(alt_fd* fd, char* ptr, int len) { ... if (ALTERA_RO_ZIPFS_BASE == EPCS_FLASH_CONTROLLER_BASE) { alt_u32 RetValue; alt_u32 Offset = (current - ALTERA_RO_ZIPFS_BASE); alt_flash_dev *fdev = alt_flash_open_dev("/dev/epcs_flash_controller\0"); //Do EPCS Flash Read alt_epcs_flash_read(fdev, Offset, (void*)current, amount_to_copy); alt_flash_close_dev(fdev); } memcpy(ptr, current, amount_to_copy);  

 

The code isnt very pretty at the minute as it should use the# defines from system.h etc. As far as i can make out the EPCS is not a memory mapped peripheral and as such you have to do the reading. I would really like to know if there is a better way to do this. It appears that normally it just dereferences the pointer to get the data. Perhaps one of the Gurus could better explain. (I'd really like to know if this is just a hack or legit!!!) 

 

Either way the answer is yes you can and the above works for me.... 

 

Cheers 

Tim
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Good job Drinkyfish, 

 

I am trying to test it on my setup, but it seems that altera_ro_zipfs.c file is different from what I have. can you attach the complete file, so I can check the differences.
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Attached is the source file, i made no changes to the header and you would probably want to get the correct includes at the minute its implicit declarations. 

 

Let me know how you get on. 

 

Cheers 

Tim
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

I copied your altera_ro_zipfs.c file completely, compile the project, and got the following error:  

error: 'EPCS_FLASH_CONTROLLER_BASE' undeclared 

 

Any idea?  

 

I already included:# include "altera_avalon_epcs_flash_controller.h"# include "epcs_commands.h"
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Have a look for something similar in your system.h file. Maybe its _0_base?? Or have you called it something different when adding it in qsys/sopc builder?

0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Running perfectly :) 

 

Good job Drinkyfish! YES you can do it 

 

Now, the next step is to make it independent of using# defines from system.h.
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

hello Drinkyfish, 

 

With reference to your solution for running webserver using epcs controller, the solution was tested by me using the same development board that already has a flash memory, and it works somehow. 

 

However when I test the solution on another development board "that does not has a flash memory on it", I got the following error (picture attached) 

 

From the picture, I can see that the webserver is running however the web pages were not uploaded! 

 

Any idea or advise? 

 

Best Regards'
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Has the file been overwritten when you re-generated your BSP? You would need to disable the auto-generation for "altera_ro_zipfs.c" in the bsp editor or it will trash your changes..  

 

Otherwise i'm not really sure what i advise i can give, I'm by no means an expert on the Altera Software. 

 

Sorry i cant help more at the minute. Our goal is similar to remove the flash so perhaps i'll run into the same problem. 

 

Cheers 

Tim
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

The file is not overwritten, and still web pages are not uploaded! 

 

If you faced the same problem, please let me know about it. 

 

Thanks for your time
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Hi Tim, 

 

I found that epcs_controller_name (system.h) differ from your altera_ro_zipfs file 

# define EPCS_CONTROLLER_NAME "/dev/epcs_controller" 

 

So I corrected it, and try it again. 

 

Result: I think I moved one step forward, I can see something displayed on the web browser (picture attached), but it seems that there is corruption in the received data (in the reading process) 

 

The size of ro_zipfs.zip is 242 KB, it is too small, so I can not say the file size is larger than EPCS available memory space (I am working on EPCS64 == 64Mbits = 8 Mb) 

 

Any idea?
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Hi, 

 

I am stuck with the problem mentioned in my previous post, is there somebody who can give me an advise?
0 Kudos
Altera_Forum
Honored Contributor II
2,035 Views

Tidy up post (multiple posts of the same issue).... 

 

This has been fixed here... 

http://www.alteraforum.com/forum/showthread.php?p=132498#post132498 

 

Additional Info... 

For BEMicro SDK - how to make the web server run from EPCS memory check this post out... 

http://www.alteraforum.com/forum/showthread.php?p=133158#post133158
0 Kudos
Reply