Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (377 KB)
Chapter 5 Loading and Executing ProgramsThe User Interface provides several methods for loading and executing a program on the machine. These methods load a file into memory from Ethernet, a hard disk, a floppy disk, or a serial port, and support the execution of Forth, FCode and binary executable programs. Most of these methods require the file to have a Client program header; see IEEE 1275.1-1994 Standard for Boot (Initialization Configuration) Firmware for a description. This header is similar to the a.out header used by many UNIX systems. Sun's FCode tokenizer generates files with the Client program header. OpenBoot commands for loading files from various sources are listed in Table 5-1. Table 5-1 File Loading Commands and Extensions
Using bootAlthough boot is normally used to boot the operating system, it can be used to load and execute any client program. Although booting usually happens automatically, the user can also initiate booting from the User Interface. The boot process is as follows:
boot has the following general format: boot [device-specifier] [arguments] where device-specifier and arguments are optional. For a complete discussion of the use of the boot command, see "Booting for the Expert User". Using dl to Load Forth Text Files Over Serial Port AForth programs loaded with dl must be ASCII files. To load a file over the serial line, connect the test system's serial port A to a machine that is able to transfer a file on request (in other words, a server). Start a terminal emulator on the server, and use that terminal emulator to download the file using dl. The following example assumes the use of the Solaris terminal emulator tip. (See Appendix A, Setting Up a TIP Connection", for information on this procedure.)
Using loadThe syntax and behavior of load are similar to boot except that the program is only loaded and not executed. load also does not do a machine reset prior to loading as may.boot The general form of the load command is: load [device-specifier] [arguments] The parsing of the load command's parameters is affected by the same configuration variables as boot, and load's device-specifier and arguments are identified by the same process. (See "Booting for the Expert User" for the details.) Once the device-specifier and arguments are identified, loading proceeds as follows:
Using dlbin to Load FCode or Binary Executables Over Serial Port AFCode or binary programs loaded with dlbin must be Client program header files. dlbin loads the files at the entry point indicated in the Client program header. Link binary files for 4000 (hex). Recent versions of the FCode Tokenizer create a Client program header file with entry point 4000. To load a file over the serial line, connect the test system's serial port A to a machine that is able to transfer a file on request ( i.e. a server). Start a terminal emulator on the server, and use that terminal emulator to download the file using dlbin. The following example assumes the use of the Solaris terminal emulator tip. (See Appendix A, Setting Up a TIP Connection", for information on this procedure.) In the tip window of the server, type: ~c to obtain a command line with which to issue a Solaris command on the server. Note - The C is case-sensitive and must be capitalized. Note - tip will only recognize the ~ as a tip command if it is the first character on the command line. If tip fails to recognize the ~C, press Return in the tip window and repeat ~C again.
When tip completes the download, it displays a message of the form (Away n seconds), and the ok prompt reappears on the screen of the test system. To execute an FCode program, type: ok 4000 1 byte-load To execute the downloaded program, type: ok go Using dload to Load From Ethernetdload loads files over Ethernet at a specified address, as shown below. ok 4000 dload filename In the above example, 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 ProgramsForth programs loaded with dload must be ASCII files beginning with the two characters "\ " (backslash and space). To execute the loaded Forth program, type: ok 4000 file-size @ eval In the above example, file-size contains the size of the loaded image. FCode ProgramsFCode programs loaded with dload must be Client program header files. To execute the loaded FCode program, type: ok 4000 1 byte-load 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. Binary Executablesdload requires binary programs to be in Client program header. Executable binary programs loaded must be either linked to dload's input address (e.g., 4000) or be position independent. To execute the binary program, type: ok go To run the program again, type: ok init-program go dload does not use intermediate booters (unlike the boot command). Thus, any symbol information included in the Client program header file is available to the User Interface's symbolic debugging capability. (See Chapter 6, Debugging for more information on symbolic debugging.) Using ?goOnce a program has been loaded into the system, ?go can be used to execute that program regardless of the type of the program. ?go examines the start of the loaded image. If the image begins with the string "\ " (backslash and space), the image is assumed to be Forth text. The Forth interpreter is invoked to interpret the image. |
|||||||||||||||||||||||||||||||||||||||