Software utility to compile static web pages.
Software utility to compile static web pages.
The FCARM file converter reformats all web files into a single C-file which is then included and compiled into the project. All files are stored in the Virtual ROM File System.
If configured accordingly, FCARM is called automatically during a project build. In a csolution project, this is possible with the help of a cmake-script or a cmake-project. The main difference lies in how the web content resources are provided. In an FCARM call with a cmake-script, the web resource files are listed in the csolution project file cproject.yml
, whereas in an FCARM call with a cmake-project, only the web resource container directory is specified in the csolution project file. The cmake project then searches the resource directory and adds all files found there to the web resources.
To setup the CMake script, create a file fcarm.cmake
in the local csolution project directory with the following content:
In the csolution project file cproject.yml
add a list of all web resources under executes:
node.
input:
specifies the location of the cmake script file.To setup the CMake project, create a file CMakeLists.txt
in the local csolution project's subdirectory FCARM with the following content:
In the csolution project file cproject.yml
add command and parameters to invoke the FCARM file converter.
For setup, go to Project -> Options for Target and select the Utilities tab. At the bottom, you can configure how FCARM compiles the image files. Here's an example:
FCARM can also be invoked from the command line. You will find the executable in your MDK installation's sub-directory \ARM\BIN
. FCARM has the following syntax:
Where
commandfile
is the name of a command file that can contain an inputlist, outputfile, and directives. (See below.)If you do not wish to use the command file, you can invoke FCARM like this:
Where
inputlist
is a comma-separated list of files. The files get converted into one output file. File names must be specified with the file extension, but without the path information.outputfile
is the name of the output C-file containing the converted web files.directives
are commands and parameters that control the operation of the file converter. Available directives are:Directive | Description |
---|---|
Specifies the name of the listing file. Default is the base name of the output C-file with the extension *.LST. | |
NOPRINT | Disables the generation of the listing (LST) file. |
PAGEWIDTH | Specifies the number of characters on a line in the listing file. |
PAGELENGTH | Specifies the number of lines on a page in the listing file. |
ROOT | Specifies the root path where web files are located relative to the project directory path. |
FCARM integrates a file optimization algorithm to compress files and creates more compact and smaller executable images. FCARM decides on the file extension which kind of compression is used. Each file group has a different compression and optimization flavor.
When the filename has the tilde prefix (for example, ~doStuff.js) then compression or certain compression optimizations are disabled. This is useful when debugging a file. It is hard to trace code compacted to a single line with no spaces, no comments, and no line feeds.
Compression and optimization is performed in two iterations. In a 2nd pass, further optimization is performed resulting in better code density.
Group | Extension | Optimization | ~Optimization (disabled) |
---|---|---|---|
HTML | html htm inc | HTML compression Performs the following optimizations:
| no compression |
CGI | cgi cgx | CGI compression Optimizes scripts for maximum performance on embedded web server:
| white space removal but without grouping of small t-commands |
CSS | css | CSS compression Parses and removes redundant information:
| no optimization |
JS | js | JS compression Parses and removes redundant information:
| no optimization |
others | .* | not affected | not affected |
The following command line converts and optimizes index.htm, creates the output C-file index.c, and creates the listing file index.lst.
The following command line converts and optimizes a list of files, creates the output C-file web.c, and creates the listing file web.lst.
The following command line converts and optimizes a list of files, creates the output C-file Web.c, and suppresses the creation of the listing file (nopr - directive). The files are located in the project's sub-folder Web. This command reflects the settings from the configuration dialog as shown here.
The following command line converts and optimizes a list of files, creates the output C-file web.c, and creates the listing file web.lst. The file doStuff.js is excluded from optimization.
The following command line uses a command file.