Author Topic: Web pages and FTP upload  (Read 8680 times)

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Web pages and FTP upload
« on: September 13, 2007, 07:13:24 PM »
 Hi, I uploaded the web pages in the /WebPagesM5223X and everything works OK.
When I uploaded the 5emailsetup page in /alternativepages I noticed it has the same
prefix as admin page, 5. When you click on admin the email setup page overrides the admin page. When I refresh the FTP page in IE I see that all the files are
shortened to 1 char plus an extension, ie 1.HTM b.GIF etc.
 I modified Omenu.HTM, and added a email setup menu link,changed the target to Eemailsetup.htm and renamed 5emailsetup.HTM to Eemailsetup.htm. When I did this I nocticed when I click on the LAN config that the IO config pops up with some uninterpreted text at the top. When I tried uploading the  Eemailsetup.htm it appears that some of the files disappear. I believe the demo project allocates 98K for code and the rest for files and params and each file takes up at least 2K. It seems we can only upload 9 files at a time.


 Thanks,
 John
 
« Last Edit: September 13, 2007, 07:15:34 PM by johnr »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Web pages and FTP upload
« Reply #1 on: September 13, 2007, 07:40:26 PM »
Hi John

I think that this behaviour can be explained. The operation of the uFileSystem - a very small file system implementation but with some rules to follow - is fully explained in http://www.utasker.com/docs/uTasker/uTaskerFileSystem.PDF.
In addition you can see the file system use in the demo project in the document in the project folder:
\Applications\uTaskerV1.3\WebPages\WebPagesM5223X\FileSystem\FileSystemM5223X.doc

The demo project is designed to run on both the smaller and larger M5223X chips. For this reason it only uses 28k of file system space for the web pages (the whole project will then run on a device with only 128k FLASH).
The document
\Applications\uTaskerV1.3\WebPages\WebPagesM5223X\FileSystem\FileSystemM5223X_160k.doc shows how the file system is however really set up for use by chips with 256k (which is also necessary to do SW uploads into internal FLASH!!).

You will find that when you added more lines to the file 0memu.html you made the file longer than the 2k space allocated for it. This causes it to 'bulldoze space for itself by deleting the file 1Lan.html.
Since you had a link to 1Lan.html (which is no longer valid) the browser will see the end of the first file and so display something strange.

With more file system space it is of course useful to have the SMTP configuration in the menu and to have the set up page always loaded. This is also done in some uTasker demo projects (eg. the STR91Xf which has 512k FLASH and so there is bags of space - see the STR91XF project including SMTP setup intergrated in menu at http://84.79.5.2 ).
The reasons for not doing this in the M5223X project are:

1. The project will run on the smallest device, as explained above.
2. It illustrates a technique of temporary HTML page swapping which can be useful in projects with limited file system space:
The SMTP set up side has the same 'name' as the administration side so 'overwrites' the admin side when loaded via FTP. When the SMTP set up has been completed and the settings saved, the original administration html page can be loaded - it overwrites the 'temporary' configuration side which is no longer needed.
This requires no additional FLASH space for the SMTP page at all!
Such a technique is, for example, impossible when web pages are compiled into code.
Another example would be uploading a development page allowing viewing and manipulating critical variables and such - this can temporarily overwrite a production page until the work is finished. Then the origianal page is replaced again. Remote debugging support is thus possible without having to integrate it into the project, but rather borrow a bit of file space when needed. Also the remote debugging is not available to 'normal' web viewers.


In summary: the uFileSystem is simple and efficient to allow a good level of comfort and useful techniques as explained above. It does however have some rules and the exact use of the file system needs to be 'designed' for the project in hand.

Good luck

Regards

Mark

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: Web pages and FTP upload
« Reply #2 on: September 14, 2007, 04:58:29 PM »
 Thanks, Mark, it makes sense now. I modifiled 0menu.htm and made sure it was < 2048 bytes and copyed it up via FTP. When I tried to access 1Lan.htm, I got a 404 error. I then erased all the files via FTP and recopyed them up and everything worked OK. I'll play around with this more. I guess you have to erase the old file before copying over a new one with the same name.

 John
« Last Edit: September 14, 2007, 05:02:07 PM by johnr »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Web pages and FTP upload
« Reply #3 on: September 14, 2007, 07:05:45 PM »
Hi John

The uFileSystem uses a 'bulldozer' technique so will automatically make way for new files. This means that simply transferring a new version of an existing file will result in it being overwritten / updated.
If you experiment some more you should find that this is always the case with the Colfire project (I say with the Coldfire project because there are some devices which have a large FLASH granularity requiring a slightly different method - see the STR91XF file system description to find out more http://www.utasker.com/docs/STR91XF/FileSystemSTR91X.PDF ).

Since individual files often occupy multiple sectors in FLASH a file delete results in all affected FLASH sectors being deleted. Therefore overwriting an old version of 0menu.html which occupied more FLASH sectors than the new one results in all previous sectors belonging to the file to be deleted. In your specific case it would have also cleared the 1LAN.html file space since it was being occupied by the 'oversized' 0menu.html. If you then tried to access 1LAN.html it would not exist and so give a 404 error. Just reloading 1LAN.htm should in fact have completed the demo files again. Of course deleting and reloading all would result in the same state, but shouldn't have been absolutely necessary.

Regards

Mark