1.arm-linux-gcc å arm-elf-gcc çåºå«
arm-linux-gcc å arm-elf-gcc çåºå«
å¨åºäºARMçåµå ¥å¼ç³»ç»å¼åä¸ï¼å¸¸å¸¸ç¨å°äº¤åç¼è¯çGCCå·¥å ·é¾æ两ç§ï¼
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ç说æï¼è¯¦è§å¦ä¸ï¼
ããThe语言c语言编译器博客 开源 源码下载re 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- C library which was part of the ELKs project with m
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 m, 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 m 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项ç®ä¸æ¯æmå¨Linux- Cåºæºç
ä¸ç§»æ¤çãuC-libcæ¯ä¸ä¸ªå®å ¨çlibcå®ç°ï¼ä½å ¶ä¸æä¸äºapiæ¯éæ åçï¼æäºlibcç
æ åä¹æ²¡æå®ç°ãuC-libc稳å®å°æ¯æ mï¼ColdFireå没æMMUçARMãå ¶ä¸»è¦è®¾è®¡
ç®æ æ¯âå°âã"è½»"ï¼å¹¶å°½éä¸æ åä¸è´ï¼è½ç¶å®çAPIåå¾å¤libcå ¼å®¹ï¼ä½æ¯ä¼¼ä¹å¹¶
ä¸åå®ææçé£æ ·åæææ åä¸è´ã
uClibcå°±æ¯ä¸ºäºè§£å³è¿ä¸ªé®é¢ä»uC-libcä¸åå±åºæ¥çãå®çææAPIé½æ¯æ åç(æ£ç¡®
çè¿åç±»åï¼åæ°çç)ï¼å®å¼¥è¡¥äºuC-libcä¸æ²¡æå®ç°çlibcæ åï¼ç°å¨å·²ç»è¢«ç§»æ¤å°
å¤ç§æ¶æä¸ãä¸è¬æ¥è®²ï¼å®å°½éå ¼å®¹glibc以便使åºç¨ç¨åºç¨uClibcæ¹ååç容æã
uClibcè½å¤å¨æ åç VM linuxåuClinuxä¸é¢ä½¿ç¨ã为äºåºç¨ç¨åºçç®æ´ï¼å®çè³å¯ä»¥
å¨è®¸å¤æ¯æMMUçå¹³å°ä¸è¢«ç¼è¯æå ±äº«åºãErik Andersonå¨uClibcèååäºå¾å¤çå·¥
ä½ãuClibcæ¯æ许å¤ç³»åçå¤çå¨ï¼mï¼Coldfireï¼ARMï¼MIPSï¼vï¼ xï¼
iï¼Sparcï¼SuperHï¼Alphaï¼PowerPCåHitachi 8ãä¸æå¢å çå¹³å°æ¯ææ¾ç¤ºuClibc
è½å¤å¾å®¹æçéåºæ°çæ¶æãuClinuxåè¡çæä¾äºç¯å¢è½å¤è®©ä½ éæ©ä½¿ç¨uC-libcææ¯
uClibcç¼è¯ã对äºmå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/. try: ./arm-linux-gnueabihf-gcc -print-multi-lib
The default configure is --with-arch=armv7-a --with-tune=cortex-a9
--with-fpu=vfpv3-d --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-./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/.