f78
Contents | Index | Previous | Next

PowerPC development 

The following documentation discusses cross-development with the PowerPC targets.
Cross-development tools in the GNUPro Toolkit are normally installed with names that reflect the target machine, so that you can install more than one set of tools in the same binary directory. The target name, constructed with the '--target' option to configure , is used as a prefix to the program name. For example, the compiler for the PowerPC (gcc in native configurations) is called, depending on which configuration you have installed, by powerpc-eabi-gcc.
 
The following processors are supported for the PowerPC targets.
 
403Gx 
603(e) 
505 
604 
601 
604(e) 
602 
821 
603 
860 

Compiling for PowerPC tar ffb gets

The PowerPC target family toolchain controls variances in code generation directly from the command line.
 
When you run gcc, you can use command-line options to choose whether to take advantage of the extra PowerPC machine instructions, and whether to generate code for hardware or software floating point.
 
When you run gcc , you can use command-line options to choose machine-specific details.
 
The following -m options are defined for the PowerPC. 
 

Floating-point subroutines for PowerPC

Preprocessor macro for PowerPC targets

Assembler options for PowerPC targets

To use the GNU assembler, gasto assemble gcc output, configure gcc with the --with-gnu-as switch or with the -mgas option.
 
Use the f ffb ollowing listing-control assembler directives to control the appearance of the listing output (if you do not request listing output with one of the '-a' options, the following listing-control directives have no effect).

Debugging PowerPC targets

The powerpc -configured gdb is called by powerpc-eabi-gdb.
gdb needs to know the following specifications to talk to PowerPC targets.
Use the following gdb commands to specify the connection to your target board.
 
(gdb) target powerpc com1 
... 
breakinst () ../sparc-stub.c:975 
975     } 
(gdb) s 
main    ()   hello.c:50 
50       writer(1,    "Got to here\n"); 
(gdb) 
 

The stack frame

The following information applies to the stack frame for the PowerPC.
Stack frames for functions taking a fixed number of arguments use the definitions in the following chart. FP points to the same location as SP.
 
 
Stack frames for functions that take a variable number of arguments use the following definitions.
 
 

Argument passing

The following table shows the general purpose registers, floating point registers, and the stack frame offset.
 
 
General Purpose Registers
Floating-Point Registers
Stack Frame Offset 
r3: c
f1: ff
08: ptr to t
r4: d
f2: gg
0c: (padding)
r5: e
f3: hh
10: nn(lo)
r6: f
f4: ii
14: nn(hi)
r7: g
f5: jj
r8: h
f6: kk
r9: ptr to ld
f7: ll
r10: ptr to s
f8: mm

Function return values

Integers, floating point values, and aggregates of 8 bytes or less are returned in register 'r0' (and 'r1' if necessary).
Aggregates larger than 8 bytes are returned by having the caller pass the address of a buffer to hold the value in 'r0' as an invisible first argument. All arguments are then shifted down by one. The address of this buffer is returned in 'r0'.
0