| Bootstrap VM Execution | Index |
Summary
Typically, a VM program is run manually from the console during the debugging phase. Once a VM program is complete, it may be downloaded and configured as a bootstrap program. The BrainStem can start up to 4 different VM programs at power-up reset. The cmdVAL_SET and cmdVAL_GET commands provide access to the 4 bootstrap file ID parameters. At power-up, the BrainStem checks these 4 parameters, in order, for valid file IDs. If it finds a valid file ID, it executes that file. Process slots are assigned sequentially to the valid files starting with process 0. A single boot program will always run as process 0.
A bootstrap VM program cannot take any input parameters. Otherwise, the syntax is identical to any other VM program. A bootstrap program may be a small stand-alone application, or it can configure I/O, initialize reflexes, and launch other VM programs.
Example
To configure TEA file 0 as a bootstrap program, enter the following two commands at the Console prompt:
The first is the cmdVAL_SET command for setting VM boot file 1 parameter (15) to 0. The second is cmdVAL_SAV command which saves all the system parameters to the EEPROM. When the BrainStem is turned off and on again, it will automatically run TEA program 0. To disable VM boot file 1, enter these two commands:
That just sets the VM boot file 1 parameter to an invalid number and disables it. When the BrainStem is turned off and on again, it will not run TEA program 0.
It is good practice to have a delay or require some external input in a boot program before it begins performing tasks. This provides an opportunity to safely power up the BrainStem, run the Console, and terminate or disable the boot program. This example has one boot program which will run as process 0. To terminate the program, enter this command:
That is the cmdVM_KILL command for terminating process 0. After killing the process running TEA file 0, a new file may be downloaded to that file slot.