Serving Pages from ROM

To enable GoAhead to be used on embedded systems without file systems, GoAhead supports the compilation of web pages and configuration files into C code that can be stored in Read-Only-Memory (ROM) and fetched by GoAhead to respond to relevant requests.

GoAhead has a virtual file system interface that allows the run-time switching between serving web pages on a disk-based file system and a compiled ROM based store of web pages. This ROM facility may also be used to enhance security by preventing the modification of web documents, or in performance critical situations were the serving of web pages from memory may be an effective optimization.

Configuring GoAhead

To build GoAhead with support for ROM based file systems, you need to run configure with the --rom option. For example:

./configure --rom

With the --rom option, configure will set the ME_ROM compiler definition to 1 and will enable the ROM file system.

Compiling Web Pages

The GoAhead webcomp program is used to compile web documents, configuration files, and any other files that you would like to be compiled into C code. The webcomp program will parse the files and convert them into C data structures which can then be compiled by your C/C++ compiler and linked into your application. For example:

find *.txt web -print >fileList webcomp filelist >rom.c

This will create a list of all the web files and then convert these files into C structures in the file rom.c.

The webcomp program takes one options:

Switch Description
--strip Specifies a prefix to strip from each of the compiled file names.

© Embedthis Software. All rights reserved.