Next: , Previous: , Up: Extending DejaGnu  

4.3 Adding a new target

DejaGnu has some additional requirements for target support, beyond the general-purpose provisions of a configure script. DejaGnu must actively communicate with the target, rather than simply generating or managing code for the target architecture. Therefore, each tool requires an initialization module for each target. For new targets, you must supply a few Tcl procedures to adapt DejaGnu to the target.

Usually the best way to write a new initialization module is to edit an existing initialization module; some trial and error will be required. If necessary, you can use the --debug option to see what is really going on.

When you code an initialization module, be generous in printing information using the verbose procedure. In cross-development environments, most of the work is in getting the communications right. Code for communicating via TCP/IP networks or serial lines is available in a DejaGnu library files such as lib/telnet.exp.

If you suspect a communication problem, try running the connection interactively from Expect. (There are three ways of running Expect as an interactive interpreter. You can run Expect with no arguments, and control it completely interactively; or you can use expect -i together with other command-line options and arguments; or you can run the command interpreter from any Expect procedure. Use return to get back to the calling procedure (if any), or return -tcl to make the calling procedure itself return to its caller; use exit or end-of-file to leave Expect altogether.) Run the program whose name is recorded in $connectmode, with the arguments in $targetname, to establish a connection. You should at least be able to get a prompt from any target that is physically connected.

Next: , Previous: , Up: Extending DejaGnu