Store MQX web pages externally step by step

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Store MQX web pages externally step by step

Store MQX web pages externally step by step

Store web pages externally step by step


Web pages can be stored on any media accessible via MFS, such as USB memory stick, SD card. It is also possible to use FFS and store web pages on NAND flash. The following example is a step by step guide on how MQX can use nandflash on TWR-K70F120M, we start with the httpsrv demo.

1. Add FTP server  and nandflash flush support

This demo starts with default HTTPSRV example, Shell console is enabled in the default httpdsrv.c. Ping, ipconfig and help commands are enabled by default. We add ftpsrv application to support FTP protocol , and nandflash support.

pastedImage_10.png

2. Allow RTCS for more sockets

We will use two TCP servers. There is one socket need for HTTPSRV listening socket, second listening socket for FTP server. One socket for each connected client.

pastedImage_11.png

3 .Add MFS library to the HTTPSRV build project

By default, MFS library is not enabled in the HTTPSRV project. It uses only TFS for web pages storage. We add path to MFS library into HTTPSRV build project

  pastedImage_12.png

pastedImage_13.png

4. Add FFS support to the HTTPSRV build project

Ffs library is not enabled by default. We need to add path into HTTPSRV build library. Install FFS driver and open it.

5. Resolve build errors

When we try to build now the HTTPSRV example, we have compile errors. This is because by default the HTTPSRV example does not include MFS and FFS library head files. We need to add a path for MFS and FFS

pastedImage_14.png

pastedImage_15.png

6. Configure HTTPSRV root directory

Web pages of this demo are to be stored in nandflash within web_pages folder. We need to set rootdir and index

pastedImage_16.png

Before we can view the web page in browser, we need to copy web pages to nand flash. This is the purpose of FTP server, as one example how to copy files.

pastedImage_17.png

If you wish to be sure the web pages survive power cycle, make sure you flush the FFS file system after “web_pages” are copied.

7. Build, Download, Execute

As hardware we use TWR-K70F120M and TWR-SER. After you download the executable and run, start FTP server by issuing command “ftpsrv  start” on serial console; start FTP client; copy over files from PC host to TWR nandflash. Keep the folder structure of the copied files; now open your web browser (support for HTML5 is required); open Url http://192.168.1.202

pastedImage_18.png

Attachments
No ratings
Version history
Last update:
‎09-28-2014 07:23 PM
Updated by: