| Red Hat Documentation |
|
Cross-development
environment
A cross-development configuration
can develop software for a different target machine than the development
tools themselves (which run on the host)--for example, a SPARCstation can
generate and debug code for a Motorola Power PC-based board.
Using GNUPro Toolkit in one of the cross-development configurations usually requires some attention to setting up the target environment. For our tools to work with a target environment (except for real-time operating systems, which provide full operating system support), set up the tools by using the following documentation.
To link and
run C or C++ programs, you need to define a small module (usually written
in assembler as 'crt0.s') that makes
sure the hardware is initialized for C conventions before calling main.
There are some
examples of crt0.s code (along with examples of system call stub
code) available in the source code for GNUPro Toolkit. Look
in the following path.
installdir /gnupro-98r1/src/newlib/libc/sys For example,
look in '.../sys/h8300hms' for Hitachi H8/300 bare boards, or
in '.../sys/sparclite' for the Fujitsu SPARClite board.
installdir /gnupro-98r1/src/newlib/stub
Execution begins at this symbol. It is largely up to you to choose where to store your stack within the constraints of your target's memory map. Perhaps the simplest choice is to choose a fixed-size area somewhere in the uninitialized data section (often called 'bss'). Remember that whether you choose the low address or the high address in this area depends on the direction your stack grows. The easiest way to do this is with the help of a linker script (see Linker scripts in Using ld in GNUPro Utilities). Use a linker script to define symbols such as 'bss_start ' and 'bss_end' to record the boundaries of this section; then you can use a 'for' loop to initialize all memory between them in the 'crt0.s' module. Nothing else will!
This is the C name; in your assembler code. Use the label, __exit, with two leading underbars. Its precise behavior depends on the details of your system, and on your choice. Possibilities include trapping back to the boot monitor, if there is one; or to the loader, if there is no monitor; or even back to the symbol, start. See The gdb remote serial protocol in Debugging with GDB in GNUPro Debugging Tools for details on how to use the gdb generic remote-target facilities for this purpose. For example, initialize an mmu or an auxiliary floating-point chip. For example, the 'crt0.s' module is a convenient place to define the minimal assembly-level routines described in System calls in GNUPro C Library in GNUPro Libraries. |
|
© 2001 Red Hat, Inc. All rights reserved. About Red Hat : Legal statement : Privacy statement : Y2K statement : Contact Red Hat |