Arm-Linux-GCC arm-elf-GCC differences

Source: Internet
Author: User

In ARM-based embedded system development, there are two GCC tool chains that often use cross-Compilation:
The main difference between ARM-Linux-* and arm-elf-* is that they use different C-library files. Arm-Linux-* use
While arm-elf-* generally uses uclibc/UC-libc or RedHat for embedded systems.
Newlib. glibc. Both uclibc, UC-libc, and newlib are C language library files.
Glibc is developed for PC, and uclibc/UC-libc is a small size compatible with glibc APIs.
The C Language Library provides some glibc functions.

For details about uclibc/UC-libc, refer to the following:

There are two libc libraries commonly used with uCLinux. UC-libc and
Uclibc. They are quite different despite their similar names. Here is
Quick overview of how they are different.

UC-libc is the original library for uClinux. It was based on sources
From the Linux-8086 C library which was part of the Elks project with m68000
Support added by Jeff Dionne and kenth albanowski. It is a fairly complete
Libc implementation, however, some of the API's are a little non-standard
And quite a few common libc routines are not present. Currently it has
Stable support for m68000, ColdFire and arm (non-MMU) ubuntures. It was
Primary design goal is to be small and light weight. It does try to conform
To any standards, although its API tries to be compatible with most libcs,
It is not always exactly the same.

The uClinux distribution provides an environment that can compile using
Either UC-libc or uclibc depending on your needs. For m68000 and ColdFire
Platforms it is generally better to chose UC-libc as it supports shared
Libraries and is the most commonly used libc For These CPUs. uclibc also
Works quite well with almost all platforms supported by the distribution.
Which libc you choose to use will be decided by your requirements

UClinux has two frequently used libc libraries: UC-libc and uclibc. Although the two names are similar, they are actually different.
Don't, let's briefly introduce the differences between the two. UC-libc is the first library developed for uClinux.
Jeff Dionne and kenth albanowski provide support for m68000 in the Linux-8086 C library source code in the ekls Project
. UC-libc is a complete libc implementation, but some of its APIs are non-standard and some of its libc
The standard is not implemented either. UC-libc stably supports m68000, ColdFire, and arm without MMU. Its main design
The goal is "small" and "light", and try to be consistent with the standard. Although its API is compatible with many libc APIs
Unlike what it expects to be consistent with all standards.

Uclibc is developed from UC-libc to solve this problem. All its APIs are standard (correct
), It makes up for the libc standard that is not implemented in UC-libc, and has now been ported
Multiple Architectures. Generally, it is compatible with glibc as much as possible to make it easier for applications to rewrite with uclibc.
Uclibc can be used in standard VM Linux and uClinux. For the simplicity of the application, it can even
It is compiled into a shared library on many platforms that support MMU. Erik Anderson has done a lot of work behind uclibc
. Uclibc supports many series of processors: m68000, ColdFire, arm, MIPS, v850, x86,
I960, iSCSI, superh, Alpha, PowerPC, and Hitachi 8. Increasing platform support for displaying uclibc
It is easy to adapt to the new architecture. The uClinux release provides an environment for you to choose to use UC-libc or
Uclibc compilation. For m68000 and ColdFire platforms, it is better to choose UC-libc because it
Shared libraries are supported, and the shared libraries are the libc. uclibc that are frequently used by these CPUs. They are also very similar to almost all platforms.
Good job. Depending on your needs.

Newlib is an open-source C language library for embedded systems. It consists of two library groups: libc and libm.
Is lightweight, fast, and can be transplanted to many CPU Structures. Newlib implements many complex functions
Yes, including String Support, floating point operations, memory allocation (such as malloc) and I/O flow functions (printf, fprinf ()
And so on ). Among them, libc provides the implementation of the C language library, while libm provides floating point operation support.

The C language library used is different when you specify different configuration options for GCC when cross-compiling GCC for arm,
By default, the GCC compiler uses glibc, or uclibc/UC-libc (basically compatible with glibc APIs ).
-- With-newlib, the GCC compiler does not use glibc. You can use
-- With-newlib: do not connect to glibc and compile the bootstrap GCC compiler. From the GCC source directory
In config/ARM, T-Linux and T-arm-elf show that different -- targets also affect GCC connection to C language.
Library, T-Linux (-- target = arm-Linux) uses glibc by default,-arm-elf (-- target = arm-elf) Uses
-Dinhibit_libc: do not connect to glibc. In this case, we can use other C language libraries such as newlib to compile GCC engineers.
Chain.

Although different C language libraries are configured in the GCC tool chain, these C language libraries can be used to support GCC.
There is no major difference in processing core data. Therefore, the differences between ARM-Linux-* and arm-elf-* are mainly manifested in
C language library implementation, such as different system calls, different function sets implementation, different Abi/startup code and
Minor differences in different system features.

There is no absolute standard for the use of arm-Linux-* and arm-elf-* To eliminate implementation differences between different libraries. GCC can
To compile any system. Both arm-Linux-* and arm-elf-* Can be used to compile bare metal programs and operating systems.
The system program looks more harmonious when following the descriptions below:

Arm-Linux-* for an arm machine running Linux, it depends on the specified C language library glibc, because it also uses
Glibc Linux makes the compilation of arm-Linux-* on the arm machine running Linux more harmonious.

Arm-elf-* is an independent compilation system and does not rely on the specified C language library glibc. newlib can be used.
Other C language libraries, such
Compile bare metal programs (without programs in large operating systems such as Linux) in the library, such as monitoring programs and bootloader.
It makes the system program more compact and fast.

Related Article

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.