Running from Flash or ROM
Lightfoot applications can be run from ROM/Flash or run from RAM.
During development, almost all of your applications will be run from
RAM and downloaded from your development PC to the development board
using the lfdownload tool and the monitor on the
development board.
When you are ready to deploy the system, you will not have a
development PC to download from, now will you have a monitor running on
your target system to initiaite a download.
Converting to a Flash/ROM based application
Running from ROM or Flash is a simple matter of changing a
configuration value in config.xml, rebuilding your
application, storing in Flash or blowing into a PROM.
Edit config.xml and add the following entry into the target
section.
<bootconstants mode="ROM"/>
When you remake your application, the end result is no longer a .bin
file, but is a .raw file. This raw file is an exact image
of how your application will be in Flash can be downloaded using the flash
downloading tool.
Behind the scenes
The simple adding of the bootconstants line to the XML
configuration file causes the linker to read in a different command
file. This command file causes the linker to work with 3 memory areas,
ROM, Program RAM and Data RAM.
ROM memory area
The ROM memory area stores the following information:
- Bootstrap code used to boot the system and setup the board.
- All application code, library code and the majority of runtime
code.
- All constant pools.
- All readonly data structures.
Program RAM memory area
The program RAM memory area stores the following information:
- interrupt handlers
- trap handlers
- soft byte codes
- flash-writing code
Data RAM memory area
The data RAM memory area stores the following information:
- constants accessible via
cnsti instructions
- All mutable data structures.
Raw memory image
The raw memory image is basically the ROM memory area followed by the
two the two RAM areas with relocation information. When the system is
booted, the relocatable RAM areas are copied into the correct location,
memory areas to be initialised are initialised and the application
starts running normally.