Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 UQC122S3 Real-Time and Embedded Systems GCC as a cross compiler.

Similar presentations


Presentation on theme: "1 UQC122S3 Real-Time and Embedded Systems GCC as a cross compiler."— Presentation transcript:

1 1 UQC122S3 Real-Time and Embedded Systems GCC as a cross compiler

2 2 GCC Long standing compiler development –Developed an editor emacs, compiler suite gcc and UNIX-like OS Hurd. Plus many other tools and utilities. –emacs and gcc have been the most successful and central to many developments – BSD, Linux –Developed by Richard Stallman and the Free Software Foundation

3 3 The GCC suite The development tools are made up of –gcc, a set of compilers for C, C++, Ada, Java –The gnu linker, ld and assembler, as –Binutils, a collection of useful code development tools ar, nm, objcopy, objdump, ranlib, size, strings, strip, addr2line

4 4 GCC The gcc compiler has front ends to provide different language capabilities It also has a gcc core which allows it to generate the actual code The code generation is done through an intermediate language called RTL –Register Transfer Language – a LISP variant

5 5 RTL The front end generates a parse tree which checks the syntax for the target language and any supporting data structures This tree is then used to generate RTL which expresses the structure of the code –The RTL code is then used to do optimisation Finally assembler code is generated from the RTL

6 6 gcc passes gcc Language Specific Front end RTL code Assembler Code

7 7 gcc output formats Although the gcc compiler can be installed on one host it can create outputs for many targets and formats The normal situation is that the host and the target are the same. –A Intel 686 running Linux with ELF output would generate ELF 686 binaries that would run under Linux

8 8 BFD In order to allow the compiler to create a number of different formats gcc use Binary File Definitions – BFD BFD allows the compiler and linker to have descriptions of different file and machine formats This then means that object files can be converted from one format to another

9 9 BFD When gcc is created it will, by default, use the host machine as the basis for its target code generation. –The format is CPU-MACHINE-SYSTEM i386-sun-sunos4 –So host and target might be m68k-hp-netbsdelf Conversion between formats may lose information or not be possible

10 10 Using gcc as a cross compiler gcc is popular as a cross compiler This requires the installation to distinguish between the system the compiler run upon and the code it generates for another system More care is required when configuring and installing

11 11 A gcc cross compiler ccc compiler Generated code Library files Startup code Binary output Host binary Target binary


Download ppt "1 UQC122S3 Real-Time and Embedded Systems GCC as a cross compiler."

Similar presentations


Ads by Google