Specifications

Embedded System Tools Guide (EDK 6.2i) www.xilinx.com 165
UG111 (v1.4) January 30, 2004 1-800-255-7778
Compiler Usage and Options
R
This section discusses the common features of both the MicroBlaze as well as PowerPC
compiler. Figure 11-1 shows the GNU tool flow. The GNU compiler is named mb-gcc for
MicroBlaze and powerpc-eabi-gcc for PowerPC. The GNU compiler is a wrapper which
in turn calls four different executables:
1. Pre-processor: (cpp0)
i This is the first pass invoked by the compiler.
i The pre-processor replaces all macros with definitions as defined in the source
and header files.
2. Machine and Language specific Compiler (cc1)
i The compiler works on the pre-processed code, which is the output of the first
stage.
a. C Compiler (cc1)
i The compiler is responsible for most of the optimizations done on the input C
code and generates an assembly code.
b. C++ Compiler (cc1plus)
i The compiler is responsible for most of the optimizations done on the input C++
code and generates an assembly code.
3. Assembler (mb-as [For MicroBlaze] and powerpc-eabi-as [for PowerPC])
i The assembly code has mnemonics in assembly language.The assembler converts
these to machine language.
i The assembler also resolves some of the labels generated by the compiler.
i The assembler creates an object file, which is passed on to the linker
4. Linker (mb-ld [For MicroBlaze] and powerpc-eabi-ld [for PowerPC])
i The linker links all the object files generated by the assembler.
i If libraries are provided on the command line, the linker resolves some of the
undefined references in the code, by linking in some of the functions from the
assembler.
Options for all these executables in discussed in this chapter.
Note: Any reference to gcc in this chapter indicates reference to both MicroBlaze compiler (mb-
gcc) as well as PowerPC compiler (powerpc-eabi-gcc)
Compiler Usage and Options
Usage
GNU Compiler usage is as follows
Compiler_Name [options] files...
Where Compiler_Name is powerpc-eabi-gcc or mb-gcc
Quick Reference
Table 11-1 briefly describes the commonly used compiler options. These options are
common to both the compilers, i.e MicroBlaze and PowerPC.
Please note that the
compiler options are case sensitive.