5th lesson Embedded C language Compiler

Source: Internet
Author: User

1. GCC and gcc

(1)GCC: (GNU Compiler Collection)

GNU   Compiler collection that contains compilers for many languages, such as C, C + +, Java, D, Objective-c, and so on

(2)gcc: specifically the C language compiler in GCC

(3) GCC and embedded: Most embedded operating systems are based on GCC for source code compilation. such as Linux, VxWorks, Android and so on.

(4) in the actual development, the kernel development generally uses GCC, the application development general uses the GCC/G++/GDC

2. Cross- compiling

(1) Background

① embedded devices tend to be resource constrained

② can not directly program the processor on the embedded

(2) Solutions

① compiling the source code on the development host (PC)

② an executable program that eventually generates a target host (embedded device)

(3) How does gcc cross-compile?

① Configuring the target host's compilation Toolchain (for example: Arm-linux)

② the specific version of the Configuration tool chain (select the appropriate toolchain version according to the specific target code and use the special compilation options about the hardware architecture correctly)

(4) Case: Enterprise Embedded development environment

3. Initial knowledge of compilers

(1) Compiler composition

(2) Compilation process

(3) Extension problem: Multi-language mixed development

① Development Mode 1: from language to language (e.g.. Netframe frame)

② Development Method 2: From language to executable binary code (such as development of QQ)

③ Development Mode 3:

4. GCC key compilation Options

(1) Preprocessing directive: gcc- e file.c-o file.i

(2) compiler directive: gcc- s file.i-o file.s

(3) Assembly instructions: gcc- c file.s–o FILE.O

(4) Generate mapping file: gcc -wl,-mp=test.map file.c

(5) macro definition: gcc- d ' test= "TEST" ' file.c

(6) Get System header file path: gcc- v file.c

(7) Generate dependencies:

① get the full dependency of the target: gcc- m test.c

② get a partial dependency on a target: gcc -mm test.c

(8) Specify the library file and library file search path:

①GCC test.c- l. - Lfunc//. Indicates the current directory

② Where-l option specifies the search path for the library file, the-l option specifies the library file

"Instance Analysis" GCC compilation options

5th lesson Embedded C language Compiler

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.