Specifications

32 www.xilinx.com Embedded System Tools Guide (EDK 6.2i)
1-800-255-7778 UG111 (v1.4) January 30, 2004
Chapter 1: Embedded System Tools Architecture
R
GNU Compiler Tools
XPS calls GNU compiler tools for compiling and linking application executables for each
processor in the system.
Given a set of C source files, a Microprocessor executable is created as follows.
MicroBlaze
mb-gcc file1.c file2.c
This command compiles and links the files into an executable that can run on the
MicroBlaze processor. The output executable is in a.out. The -o flag can be used to specify
a different file name for the output file.
In order to initialize memories in the hardware bitstream with this executable, the file
name should have an elf extension.
For further information on compiler options, mb-gcc -help can be run on the command
line. See Chapter 11, “GNU Compiler Tools” for more information.
PowerPC
powerpc-eabi-gcc file1.c file2.c
This command compiles and links the files into an executable that can run on the PowerPC
processor. The output executable is in a.out. The -o flag can be used to specify a different
file name for the output file.
In order to initialize memories in the hardware bitstream with this executable, the file
name should have an elf extension.
For further information on compiler options, powerpc-eabi-gcc -help can be run on the
command line. See Chapter 11, “GNU Compiler Tools” for more information.
Compiling with Optimization
Once you are satisfied that your program is correct, recompile your program with
optimization turned on. This will reduce the size of your executable, and reduce the
number of cycles it needs to execute. This is achieved by the following:
mb-gcc -O3 file1.c file2.c
Setting the Stack Size
By default, the EDK tools build the executable with a default stack size of 0x100 (256) bytes.
The stack size can be set at compile time by using:
mb-gcc file1.c file2.c -Wl,defsym -Wl,_STACK_SIZE=0x400
This will set the stack size to 0x400 (1024) bytes.
Software Debugging
You can debug your program in software (using a simulator, available for MicroBlaze
only), or on a board which has a Xilinx FPGA loaded with your hardware bitstream. See
Chapter 13, “Xilinx Microprocessor Debugger (XMD),” for more information.