arm-linux-*和 arm-elf-*,兩者區別主要在於使用不同的C庫文件。arm-linux-*使用
GNU的Glibc,而arm-elf-*壹般使用 uClibc/uC-libc或者使用REDHAT專門為嵌入式系統
的開發的C庫newlib.Glibc。uClibc/uC-libc以及 newlib都是C語言庫文件,只是所應
用的領域不同而已,Glibc是針對PC開發的,uClibc/uC-libc是與Glibc API兼容的小型
化C語言庫,實現了Glibc部分功能。
關於uClibc/uC-libc的說明,詳見如下:
There are two libc libraries commonly used with uClinux. uC-libc and
uClibc. They are quite different despite their similar names. Here is a
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 Kenneth 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) architectures. 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有兩個經常使用的libc庫:uC-libc和uClibc。雖然兩者名字很相似,其實有差
別,下面就簡單的介紹壹下二者的不同之處。uC -libc是最早為uClinux開發的庫,是
Jeff Dionne和Kenneth Albanowski為在EKLs項目中支持m68000在Linux-8086 C庫源碼
上移植的。uC-libc是壹個完全的libc實現,但其中有壹些api是非標準的,有些libc的
標準也沒有實現。uC-libc穩定地支持 m68000,ColdFire和沒有MMU的ARM。其主要設計
目標是“小”、"輕",並盡量與標準壹致,雖然它的API和很多libc兼容,但是似乎並
不像它期望的那樣和所有標準壹致。
uClibc就是為了解決這個問題從uC-libc中發展出來的。它的所有API都是標準的(正確
的返回類型,參數等等),它彌補了uC-libc中沒有實現的libc標準,現在已經被移植到
多種架構中。壹般來講,它盡量兼容glibc以便使應用程序用uClibc改寫變的容易。
uClibc能夠在標準的 VM linux和uClinux上面使用。為了應用程序的簡潔,它甚至可以
在許多支持MMU的平臺上被編譯成***享庫。Erik Anderson在uClibc背後做了很多的工
作。uClibc支持許多系列的處理器:m68000,Coldfire,ARM,MIPS,v850, x86,
i960,Sparc,SuperH,Alpha,PowerPC和Hitachi 8。不斷增加的平臺支持顯示uClibc
能夠很容易的適應新的架構。uClinux發行版提供了環境能夠讓妳選擇使用uC-libc或是
uClibc編譯。對於m68000和Coldfire平臺來說,選擇uC-libc還是稍微好壹點,因為它
支持***享庫,而***享庫是這些cpu經常使用的 libc.uClibc也幾乎和所有的平臺都能很
好的工作。選擇哪種libc取決於妳的需求。
newlib 是壹個用於嵌入式系統的開放源代碼的C語言程序庫,由libc和libm兩個庫組
成,特點是輕量級,速度快,可移植到很多CPU結構上。newlib實現了許多復雜的功
能,包括字符串支持,浮點運算,內存分配(如malloc)和I/O流函數(printf,fprinf()
等等)。其中libc提供了c 語言庫的實現,而libm提供了浮點運算支持。
在為ARM交叉編譯gcc編譯器時,對gcc指定不同的配置選項時,使用的C語言庫就不同,
gcc編譯器默認使用Glibc,也可以使用 uClibc/uC-libc(基本兼容Glibc API),當使用
--with-newlib時,gcc編譯器不使用Glibc。當沒有交叉編譯Glibc時,可以使用
--with-newlib禁止連接Glibc而編譯bootstrap gcc編譯器。從gcc源目錄下的
config/arm中的t-linux和t-arm-elf中可以看出,不同的--target也影響gcc連接C語言
庫,t-linux(--target=arm-linux)默認使用Glibc,-arm-elf(--target=arm-elf)使用
- Dinhibit_libc禁止連接Glibc,這時我們就可以使用newlib等其他C語言庫編譯GCC工
具鏈。
雖然GCC工具鏈配置了不同的的C語言庫,但由於這些C語言庫都可以用來支持GCC,它們
對核心數據的處理上不存在較大出入。因而arm-linux-* 和 arm-elf-*區別主要表現在
C語言庫的實現上,例如不同系統調用,不同的函數集實現,不同的ABI\啟動代碼以及
不同系統特性等微小的差別。
arm-linux-*和 arm-elf-*的使用沒有壹個絕對的標準,排除不同庫實現的差異,gcc可
以編譯任何系統。arm-linux-*和 arm-elf-*都可以用來編譯裸機程序和操作系統,只
是在遵循下面的描述時系統程序顯得更加協調:
arm-linux-*針對運行linux的ARM機器,其依賴於指定的C語言庫Glibc,因為同樣使用
Glibc的linux而使得arm-linux-*在運行linux的ARM機器上編譯顯得更加和諧。
arm-elf-*則是壹個獨立的編譯體系,不依賴於指定的C語言庫Glibc,可以使用newlib
等其他C語言庫,不要求操作系統支持,當其使用為嵌入式系統而設計的壹些輕巧的C語
言庫時編譯裸機程序(沒有linux等大型操作系統的程序),如監控程序,bootloader等
能使得系統程序更加小巧快捷。
Linaro prebuilt toolchain does support both hard and soft floating
point. You can get it from /linaro-toolchain-binaries/+milestone/2012.08 try: ./arm-linux-gnueabihf-gcc -print-multi-lib
The default configure is --with-arch=armv7-a --with-tune=cortex-a9
--with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb
To use soft floating, you need options: -marm -march=armv4t -mfloat-abi=soft.
In your case, please try to change -march=armv5 to "-march=armv4t"
If you want to change to configure to cortex-a8 and armv5. You need
* Change cortex-a9 to cortex-a8 in
samples/linaro-arm-linux-gnueabihf/crosstool.config
* Change armv4t to armv5 in
contrib/linaro/patches/gcc/linaro-4.7-2012.08/multilib.patch,
Then follow the instructions to rebuild the toolchain
(contrib/linaro/doc/README.txt)
BTW: crosstool-ng-linaro does not support multilib for eglibc. It uses
the prebuilt sysroot from Ubuntu Precise. If it does not work for you,
please use the latest crosstool-ng from http://crosstool-ng.org/.