|Log In | Not a Member?||Contact ADC|
ADC Home > Reference Library > Technical Notes > Hardware & Drivers > Open Firmware >
One machine Open Firmware debugging versus two machine debugging
Since the introduction of the PowerBook 3400 (introduced in early 1997), all Macintoshes enter the Open Firmware user interface in one machine mode. In one machine mode, the user can type Open Firmware commands on the keyboard and see the results on the main display. One machine mode has its advantages and disadvantages.
The primary advantage of one machine mode is that it is quick and easy to use. Just start your Macintosh while pressing the Command-Option-O-F keys. Once in Open Firmware, you can view the device tree, add a property to a node, or try a new colon definition. However, when you shut down the machine, anything that was entered at the keyboard is lost, and that's a big disadvantage.
More complex work, such as debugging your device's expansion ROM Forth code, routinely requires you to save and review your work. There are real problems with one machine debugging such as the lack of scroll bars (to let you view past history of commands and results) and the inability to save your session.
Two machine Mode:
Two machine mode refers to an editing and debugging environment in which the target machine runs Open Firmware and a second, or client machine acts as your keyboard and display. Two machine mode is preferred to one machine mode because it allows you to save all or part of your session on the client machine. This allows you to Copy and Paste commands instead of retyping them. This is especially useful for restoring your operand stack after an interpreter error (which clears the stack).
Two machine mode originally involved connecting the client machine, running a terminal application, to the target machine via a serial cable. However, beginning with the iMac, traditional serial ports have been removed from the logic board, making it difficult to use two machine mode.
This document describes a method of using Ethernet and telnet to connect client and target machines in order to regain the benefits of two machine mode debugging. This method requires firmware functionality first introduced in some computers announced in the summer of 2000.
Gathering your tools
The tools needed for two machine telnet debugging are as follows:
Determining telnet capability
To determine if your target machine is telnet ready, do the following:
At the Open Firmware user interface, go to the packages node in the device tree by typing
followed by a carriage return. The packages node is a
support node that can be used by device nodes. In our case
Using the correct Ethernet connection
Occasionally, sending Open Firmware commands over an Ethernet network can be slowed down by Internet traffic and unwanted broadcast messages. To avoid Internet traffic and allow a point to point connection between two 10BaseT Ethernet devices without using a hub, a crossover cable is recommended. Crossover cables can be either constructed or purchased.
A crossover cable reroutes the
transmit lines from one RJ45 Ethernet connector to
the receiving lines of another RJ45 Ethernet connect.
Information about constructing and connecting a crossover
cable between two Macintosh computers is summarized in the
Tech Info Library Article:
Crossover cables can be purchased at almost any outlet that sells or supplies computers or computer peripherals. The following web site is one of those sites.
Setting up your machines
You will need to connect the client and target machines to a functional Ethernet network using the appropriate cables. As discussed above, Internet traffic can complicate communications between the client and target machines and it is therefore recommended that you use a crossover cable between the two machines. The rest of this discussion assumes the use of the crossover cable.
Having obtained the items in the Gathering your tools section above, take the following steps to establish communications between the client and target machines:
Once the telnet client application has established communication with the target machine, the Open Firmware user interface is moved to the client machine running the telnet client application. This means you have scrolling, editing, and saving capabilities. Editing and debugging on the target machine can be continued on the client machine without losing information or data.
Debugging any code during the boot sequence can be difficult. This is due to system resources not being available while the sequence is in progress. This is especially true for any Forth code embedded in a peripheral device. The Open Firmware user interface in one machine mode can limit a developer's ability to save information and therefore, slow the debugging process.
Using telnet as a two machine mode connection is just one more tool that may be of help during the development cycle. It adds the ability to scroll, copy and paste, and save your session.