1 / 11

UQC122S3 Real-Time and Embedded Systems

UQC122S3 Real-Time and Embedded Systems. GCC as a cross compiler. GCC. Long standing compiler development Developed an editor emacs , compiler suite gcc and UNIX-like OS Hurd . Plus many other tools and utilities.

sahara
Download Presentation

UQC122S3 Real-Time and Embedded Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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. 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. 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. 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. gcc passes gcc Language Specific Front end RTL code Assembler Code

  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. 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. 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. 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. A gcc cross compiler Library files ccc compiler Generated code Binary output Startup code Host binary Target binary

More Related