C H A P T E R 5 |
Loading and Executing Programs |
The User Interface provides several methods for loading and executing a program. These methods load a file into memory from Ethernet, a hard disk, a floppy disk, and serial port A, and support the execution of Forth, FCode and binary executable programs.
lists commands for loading files from various sources.
dload loads files over Ethernet at a specified address, as shown below.
In the example above, filename must be relative to the server's root. Use 4000 (hex) as the address for dload input. dload uses the trivial file transfer protocol (TFTP), so the server may need to have its permissions adjusted for this to work.
Forth programs loaded with dload must be ASCII files beginning with the two characters "\ " (backslash and blank). To execute the loaded Forth program, type:
In the above example, file-size contains the size of the loaded image.
FCode programs loaded with dload must be a.out files. To execute the loaded FCode program, type:
byte-load is used by OpenBoot to interpret FCode programs on expansion boards such as SBus. The 1 in the example is a specific value of a parameter that specifies the separation between FCode bytes in the general case. Since dload loads into system memory, 1 is the correct spacing.
Executable binary programs loaded with dload are a.out files and must be linked to run dload 's input address (4000) or be position independent. To execute the binary program, type:
To run the program again, type:
dload does not use intermediate booters (unlike the boot command). Thus, any symbol information included in the a.out file is available to the User Interface's symbolic debugging capability. (See Chapter 6 '' for more information on symbolic debugging.)
You can also load and execute a program with boot , the command normally used to boot the operating system. boot has the following format:
device-specifier is either a full device path name or a device alias. (See Chapter 1 for information on device path names and aliases.)
For a hard disk or floppy partition, filename is relative to the resident file system. (See Appendix B ", for information on creating a bootable floppy disk.) For Ethernet, filename is relative to the system's root partition on its root server. In both cases, the leading / must be omitted from the file path.
The -h flag specifies that the program should be loaded, but not executed.
boot uses intermediate booters to accomplish its task. When loading from a hard disk or floppy disk, OpenBoot first loads the disk's boot block, which in turn loads a second-level booter. When loading over Ethernet, the firmware uses TFTP to load the second-level booter. filename and -h are passed to these intermediate booters.
Forth programs are ASCII source files that must be converted to the file format required by the secondary boot program. A utility called fakeboot is available from the SBus Support Group at Sun to perform this conversion. After the file is loaded into memory, it can be executed using the command eval .
For instance, if the file is loaded to address 0x4010, and runs for 934 bytes, type:
FCode programs produced by a Tokenizer (which creates FCode programs) may need to be converted to the file format of the secondary boot program. fakeboot may be useful in this process. Once the file is in memory, execute it using the byte-load command.
For example, assuming the file is loaded to address 0x4030, type:
A binary program other than the operating system can also be loaded and executed as follows:
go is needed since the boot command includes -h .
Forth programs loaded with dl must be ASCII files.
To load the file over the serial line, connect the system-under-test's serial port to a machine that is able to transfer a file on request, and start a terminal emulator on that system. The terminal emulator is then used to download the file using dl .
The following example assumes the use of the Unix terminal emulator tip . (See Appendix A ", for information on this procedure.)
2. In the tip window of the other system, send the file, and follow it with a Control-D to signal the end of the file.
The file is automatically interpreted after it is loaded, and the ok prompt re-appears on the screen of the system to which the file was loaded.
FCode and binary programs loaded with dlbin must be a.out files. dlbin loads the files at the entry point indicated in the a.out header. Link binary files for 4000 (hex). Recent versions of the FCode Tokenizer create an a.out file with entry point 4000.
To load the file over the serial line, connect the system's serial port A to a machine that is able to transfer a file on request. The following example assumes a tip window setup. (See Appendix A ", for information on this procedure.)
2. In the TIP window of the other system, send the file:
The ok prompt appears on the screen of the system to which the file is loaded.
To execute an FCode program, type: