Serving Pages from ROM

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

Appweb 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 Appweb

To build Appweb 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 Appweb makerom program is used to compile web documents, configuration files, and any other files that you would like to be compiled into C code. The makerom 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 appweb.conf *.crt *.key web -print | xargs makerom --mount /rom >rom.c

This will create a list of all files and then convert these files into C structures in the file rom.c. The compiled files will have a virtual filename that begins with /rom. The generated code will contain a function mprGetRomFiles that will be called by Appweb to resolve the ROM file system data.

The makerom program takes these options:

Switch Description
--mount path Specifies the mount point for the ROM file system. All files in the rom file system will have this path prepended.
--strip prefix Specifies a prefix to strip from the start of each of the compiled file names.

Running Appweb

When you run Appweb, you will need to specify the ROMed version of appweb.conf to configure Appweb. Use the --conf option.

appweb --conf /rom/appweb.conf

Changing the Mount Path

By default, the ROM file system mount path is set to /rom. This is configured from the mpr.romMount property in main.me. This is convered to the ME_MPR_ROM_MOUNT configuration setting when configure is run.

© Embedthis Software, 2003-2015. All rights reserved.