[原创] LM3S9B96 下网页转换——Web Filesystem Generator

hansonhe   2012-3-20 12:21 楼主

Web Filesystem Generator


安装ti的例程包以后,在c:\stellarisware\tools\bin路径下有makefsfile.exe,dos环境下使用
stellarisware\docs\SW-DK-LM3S9B96-UG-xxxx.pdf 里的第4章中Web Filesystem Generator,介绍了makefsfile的用法,使用方法:WIN键+R,键入cmd,进入dos命令行,使用cd..到达makefsfile.exe所在目录,makefsfile -i html -o fsdata.h,这样即可将网页变成代码;修改网页可以使用Dreamweaver等软件或直接编辑html文件。
将需要转换的网页文件的文件夹和makefsfile.exe放在一个文件夹,makefsfile -i html -o fsdata.h,html表示文件夹的名称,比如TI的网页文件夹为fs,输入的文件为fsdata.h,需要的命令就是:makefsfile -i fs -o fsdata.h

 

Web Filesystem Generator的用法

 

makefsfile [OPTION]...
Description:
Generates a file system image for the lwIP web server. This is loosely based upon the makefsdata Perl script that is provided with lwIP, but does not require Perl and has several
enhancements. The file system image is produced as a C source file that contains an image of all the files contained within a subtree of the development system’s directory structure. This source file is then built into the application and served via HTTP by the lwIP web server.
By default, the file system image embeds the HTTP headers associated with each file in the file system image data itself. This is the default assumption of the lwIP web server implementation and is sensible if using an internal file system image containing a small number of files. If also serving files from a file system which does not embed the headers (for example the FAT file system on a microSD card) dynamic header generation must be used and internal file system images should be built using the -h option. In these cases, ensure that DYNAMIC_HTTP_HEADERS is also defined in the lwipopts.h file to correctly configure the web server.
The -x option allows an “exclude file” to be specified. This exclude file contains the names of files and directories within the input directory tree that are to be skipped in the conversion process. If this option is not present, a default set of file excludes is used. This list contains typical source code control metadata directory names (“.svn” and “CVS”) and system files such as “thumbs.db”. To see the default exclude list, run the tool with the -v option and look in the output.
Each file or directory name in the exclude file must be on a separate line within the file. The exclude list must contain individual file or directory names and may not include partial paths. For example images_old or .svn would be acceptable but images_old/.svn would not. In addition to generating multi-file images, the tool can also be used to dump a single file in the form of a C-style array of unsigned characters. This mode of operation is chosen using the -f command line option. The source code for this utility is contained in tools/makefsfile, with a pre-built binary contained in tools/bin.
Arguments:
-b generates a position-independent binary image.
-f dumps a single file as a C-style hex character array.
-h excludes HTTP headers from files. By default, HTTP headers are added to each file in the output.
-i NAME specifies the name of the directory containing the files to be included in the image or the name of the single file to be dumped if -f is used.
-o FILE specifies the name of the output file. If not specified, the default of fsdata.c will be used.
-q enables quiet mode.
-r overwrites the the output file without prompting.
-v enables verbose output.
-x FILE specifies a file containing a list of filenames and directory names to be excluded from the generated image.
-? displays usage information.
Example:
The following will generate a file system image using all the files in the html directory and place the results into fsdata.h:
makefsfile -i html -o fsdata.h

回复评论 (6)

写得不错,顶

http://shop34182318.taobao.com/ https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
点赞  2012-3-20 13:25
这个似乎还是有点麻烦。我以前用过一个工具,可以直接转换整个目录。不过那个工具是用在Microchip的协议栈里的
点赞  2012-3-26 10:29
引用: 原帖由 hansonhe 于 2012-3-20 12:21 发表 Web Filesystem Generator 安装ti的例程包以后,在c:\stellarisware\tools\bin路径下有makefsfile.exe,dos环境下使用stellarisware\docs\SW-DK-LM3S9B96-UG-xxxx.pdf 里的第4章中Web Filesystem Generator,介绍了 ...
我把TI自带的fs文件内的网页修改成自己的网页,可是会出现图片显示不出的情况?不知道这是什么情况
点赞  2012-4-5 12:19

回复 4楼 jxndcl301 的帖子

直接打开可以打开吗?
仔细检查各 HTML 文件中是否有无效的链接。
点赞  2012-4-5 12:22

回复 5楼 Study_Stellaris 的帖子

我用的是Dreamweaver 8编辑的网页,“仔细检查各 HTML 文件中是否有无效的链接”你的这句话不是很明白?我在自己编辑好所有HTML文件之后并在PC上测试,所有链接和显示是没有问题的。
点赞  2012-4-5 19:20

回复 6楼 jxndcl301 的帖子

比如在 HTML 中某些个图片的路径不对,但是在 PC 上又可以显示出来,但在 MCU 内部就不一定能找到了。
点赞  2012-4-6 14:40
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复