| Red Hat Documentation |
|
Debugging on MIPS targets The following documentation discusses debugging with MIPS. GDB needs to know the following things to talk to your MIPS target.
To run a program on the board, start up GDB with the name of your program as the argument. host$ mips-elf-gdb prog GDB is free software and... (gdb) target mips /dev/ttyb ... (gdb) load ... (gdb) run You can specify a TCP/IP connection instead of a serial port, using the syntax hostname: portnumber (assuming your board is connected so that this makes sense; for instance, to a serial line managed by a terminal concentrator). You can see some debugging information about communications with the board by setting the remotedebug variable. If you set it to 1 using set remotedebug 1, every packet will be displayed. If you set it to 2, every character will be displayed. You can check the current value at any time with the command show remotedebug. Linking MIPS with the GOFAST library The GOFAST library is available with two interfaces; gcc -msoft-float output places all arguments in registers, which (for subroutines using double arguments) is compatible with the interface identified as “Interface 1: all arguments in registers” in the GOFAST documentation. For full compatibility with all GOFAST subroutines, you need to make a slight modification to some of the subroutines in the GOFAST library. If you purchase and install the GOFAST library, you can link your code to that library in a number of different ways, depending on where and how you install the library. To focus on the issue of linking, the following examples assume you’ve already built object modules with appropriate options (including -msoft-float). This is the simplest case; it assumes that you’ve installed the GOFAST library as the file, fp.a, in the same directory where you do development, as shown in the GOFAST documentation. mips-idt-ecoff-gcc -o prog prog.o...-lc fp.aIn a shared development environment, the following example may be more realistic; it assumes you’ve installed the GOFAST library as ‘uss-dir/libgofast.a’, where ‘ussdir’ is any convenient directory on your development system. mips-idt-ecoff-gcc -o program program.o... \ -lc -Lussdir -lgofastFinally, you can eliminate the need for a -L option with a little more setup, using an environment variable like the following example (the example assumes you use a command shell compatible with the Bourne shell): LIBRARY_PATH= ussdir; export LIBRARY_PATH mips-idt-ecoff-gcc -o program program.o...-lc -lgofastAs for the previous example, the GOFAST library is installed in the directory, uss-dir/libgofast.a. The environment variable, LIBRARY_PATH, instructs GCC to look for the library in ussdir. (The syntax shown here for setting the environment variable is the Unix Bourne Shell, /bin/sh, syntax; adjust as needed for your system.) Notice that all the variations on linking with the GOFAST library explicitly include -lc before the GOFAST library. -lc is the standard C subroutine library; normally, you don’t have to specify this subroutine, since linking with the GOFAST library is automatic. When you link with an alternate software floating-point library, however, the order of linking is important. In this situation, specify ‘-lc’ to the left of the GOFAST library, to ensure that standard library subroutines also use the GOFAST floating-point code. Full compatibility with the GOFAST library for MIPS The GCC calling convention for functions whose first and second arguments have type float is not completely compatible with the definitions of those functions in the GOFAST library, as shipped. The following functions are affected. fpcmp fpadd fpsub fpmul fpdiv fpfmod fpacos fpasin fpatan fpatan2 fppowSince the GOFAST library is normally shipped with source, you can make these functions compatible with the gcc convention by adding the following instruction to the beginning of each affected function, then rebuilding the library. move $5,$6 |
|
© 2001 Red Hat, Inc. All rights reserved. About Red Hat : Legal statement : Privacy statement : Y2K statement : Contact Red Hat |