rom.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {
  2. title: 'Serving from ROM',
  3. crumbs: [
  4. { "Developer's Guide": '../developers/' },
  5. ],
  6. }
  7. <h1>Serving Pages from ROM</h1>
  8. <p>To enable GoAhead to be used on embedded systems without file systems, GoAhead supports the compilation of
  9. web pages and configuration files into C code that can be stored in Read-Only-Memory (ROM) and fetched by
  10. GoAhead to respond to relevant requests.</p>
  11. <p>GoAhead has a virtual file system interface that allows the run-time switching between serving web pages
  12. on a disk-based file system and a compiled ROM based store of web pages.
  13. This ROM facility may also be used to enhance security by preventing the modification of web documents,
  14. or in performance critical situations were the serving of web pages from memory may be an effective
  15. optimization.</p>
  16. <h2>Configuring GoAhead</h2>
  17. <p>To build GoAhead with support for ROM based file systems, you need to run configure with the <em>--rom</em>
  18. option. For example:</p>
  19. <pre class="ui code segment">./configure --rom</pre>
  20. <p>With the --rom option, configure will set the ME_ROM compiler definition to <em>1</em> and will enable
  21. the ROM file system.</p>
  22. <h2>Compiling Web Pages</h2>
  23. <p>The GoAhead <b>webcomp</b> program is used to compile web documents, configuration files, and any other
  24. files that you would like to be compiled into C code. The webcomp program will parse the files and convert
  25. them into C data structures which can then be compiled by your C/C++ compiler and linked into your
  26. application. For example:</p>
  27. <pre class="ui code segment">find *.txt web -print &gt;fileList webcomp filelist &gt;rom.c</pre>
  28. <p>This will create a list of all the web files and then convert these files into C structures in the file
  29. rom.c.</p>
  30. <p>The <b>webcomp</b> program takes one options:</p>
  31. <table title="Switches" class="ui table width">
  32. <thead>
  33. <tr>
  34. <th>Switch</th>
  35. <th>Description</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. <tr>
  40. <td>--strip</td>
  41. <td>Specifies a prefix to strip from each of the compiled file names.</td>
  42. </tr>
  43. </tbody>
  44. </table>