最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】为arm的xscale配置crosstool-ng

CrossCompiler crifan 4690浏览 0评论

【背景】

折腾:

【记录】在Cygwin下编译gcc-3.4.5-glibc-2.3.6的arm-xscale-linux-gnu交叉编译器

期间,去为arm的xscale配置crosstool。

【折腾过程】

1.进入Paths and misc options:

config for paths and misc options_thumb
然后是:

【整理】crosstool中的Architecture level(CT_ARCH_ARCH),Emit assembly for CPU(CT_ARCH_CPU),Tune for CPU(CT_ARCH_TUNE)的值,对于arm的xscale应该是填写什么

然后对应的配置是:

(armv5te) Architecture level
(xscale) Emit assembly for CPU
(xscale) Tune for CPU

2.再去看看对应的:

Use specific FPU

Floating point: (software)

是如何配置的。

然后参考:

http://en.wikipedia.org/wiki/XScale

可知:

The XScale architecture is based on the ARMv5TE ISA without the floating point instructions.

即,xscale是无浮点处理器的,所以,此处用默认的配置:

()  Use specific FPU
Floating point: (software)  —>

3.另外,顺带看到了:

All the generations of XScale are 32-bit ARMv5TE processors manufactured with a 0.18 µm or 0.13 µm (as in IXP43x parts) process and have a 32 kB data cache and a 32 kB instruction cache. First and second generation XScale cores also have a 2 kB mini-data cache. Products based on the 3rd generation XScale have up to 512 kB unified L2 cache.[2]

得知上面别处的配置,是32bit的arm的armv5te,是正确无误的。

4.然后再去看看Target CFLAGS:

【整理】crosstool中Target CFLAGS参数的含义和如何设置

然后使用参数是-O:

(-O) Target CFLAGS

5.对于:

()  Target LDFLAGS

暂时就用默认的,不加参数。

crosstool-NG v1.9.3 Configuration – .config
──────────────────────────────────────────────────────────────────────────────
Target LDFLAGS
│ CT_TARGET_LDFLAGS:                                                        
│                                                                           
│ Used to add specific options when linking libraries of the toolchain,     
│ that will run on your target.                                             
│                                                                           
│ Leave blank if you don’t know better.                                     
│                                                                           
│ Symbol: TARGET_LDFLAGS [=]                                                
│ Prompt: Target LDFLAGS                                                    
│   Defined at config/target.in:306                                         
│   Location:                                                               
│     -> Target options

最后,Target options配置如下:

crosstool-NG v1.9.3 Configuration – .config
Target options
  │ │     *** General target options ***         
  │ │     Target Architecture (arm)  —>        
  │ │ [*] Use the MMU                            
  │ │     Endianness: (Little endian)  —>      
  │ │     Bitness: (32-bit)  —>                
  │ │     *** arm other options ***              
  │ │     Default instruction set mode (arm)  —>
  │ │ [*] Use EABI                               
  │ │     *** Target optimisations ***           
  │ │ (armv5te) Architecture level               
  │ │ (xscale) Emit assembly for CPU             
  │ │ (xscale) Tune for CPU                      
  │ │ ()  Use specific FPU                       
  │ │     Floating point: (software)  —>       
  │ │ (-O) Target CFLAGS                         
  │ │ ()  Target LDFLAGS

target options for xscale_thumb

6.再去配置Toolchain options:

其中,先去折腾vendor:

【整理】crosstool中如何设置xscale的Tuple’s vendor string(CT_TARGET_VENDOR)

对应设置为:

(xscale) Tuple’s vendor string

最后的设置如下:

toolchain options settings_thumb

Toolchain options
    *** General toolchain options ***    
[*] Use sysroot’ed toolchain             
()    sysroot prefix dir (READ HELP)     
    *** Tuple completion and aliasing ***
(xscale) Tuple’s vendor string
()  Tuple’s sed transform    
()  Tuple’s alias            
    *** Toolchain type ***   
    Type (Cross)  —>       
    *** Build system ***     
()    Tuple        (READ HELP!)
()    Tools prefix (READ HELP!)
()    Tools suffix (READ HELP!)

7.再去看Operating System:

其中,此处的Linux,用的是:

Linux kernel version (2.6.36)  —>

好像和我之前的调查的:

linux-2.6.8

linux-2.6.9

都不一样,不知道是否会有问题。

还是尝试去改为linux-2.6.8吧,结果还要自己自定义tarball:

Linux kernel version (custom tarball)  —>
    custom tarball                        
    ()          Path to custom tarball    

算了,还是参考:

Cygwin下用crosstool-ng 编译交叉工具链

其用linux-2.6.33.7.tar.bz2,我随便去用默认的2.6.36吧。

最后的配置如下:

── Operating System
Target OS (linux)  —> 
Get kernel headers from: (kernel’s ‘headers_install’)  —>
  kernel’s ‘headers_install’             
    Linux kernel version (2.6.36)  —>  
    Kernel verbosity: (Simplified)  —> 
[*]     Check installed headers          
    *** Common kernel options ***        
[*] Build shared libraries

operation system settings_thumb
8.再去看看Binary utilities,然后使用默认的配置:

default settings for binary utilities_thumb

9.再去看看C compiler:

其他好像都是默认,个别需要改的:

(1) [*] Enable GRAPHITE loop optimisations

去掉,变成:

[ ] Enable GRAPHITE loop optimisations

因为其说:

────────────────── Enable GRAPHITE loop optimisations ───
CT_CC_GCC_USE_GRAPHITE:                                 
                                                        
Enable the GRAPHITE loop optimsations.                  
                                                        
This requires the PPL and CLooG companion libraries, and
those will be automatically build for you.              
                                                        
On some systems (eg. Cygwin), PPL and/or CLooG may not  
build properly (yet), so you’ll have to say ‘N’ here.   
                                                        
Symbol: CC_GCC_USE_GRAPHITE [=n]                        
Prompt: Enable GRAPHITE loop optimisations              
  Defined at config/cc/gcc.in.2:12                      
  Depends on: CC_gcc && CC_GCC_HAS_GRAPHITE             
  Location:                                             
    -> C compiler                                       
  Selects: CC_GCC_USE_PPL_CLOOG                      

即,对于我此处的Cygwin,最好不要选。

(2) [*] Use __cxa_atexit

看了其说明:

─────────────────────────── Use __cxa_atexit ───────────────────────────
CT_CC_CXA_ATEXIT:                                                      
                                                                       
If you get the missing symbol "__cxa_atexit" when building C++ programs,
you might want to try disabling this option.                           
                                                                       
Symbol: CC_CXA_ATEXIT [=y]                                             
Prompt: Use __cxa_atexit                                               
  Defined at config/cc/gcc.in.2:90                                     
  Depends on: CC_gcc && !BARE_METAL                                    
  Location:                                                            
    -> C compiler                                                      

觉得也去掉比较好:

[ ] Use __cxa_atexit

最后的选项如下:

for c compiler options_thumb

───────────────────────── C compiler ────────────
    C compiler (gcc)  —>                      
    gcc version (4.4.3)  —>                   
(crosstool-NG-${CT_VERSION}) gcc ID string      
()  gcc bug URL                                 
()  Flags to pass to –enable-cxx-flags         
()  Core gcc extra config                       
()  gcc extra config                            
    *** Additional supported languages: ***     
[*] C++                                         
[ ] Fortran                                     
[ ] Java                                        
    *** gcc other options ***                   
[*] Optimize gcc libs for size                  
[ ] Enable GRAPHITE loop optimisations          
[*] Link libstdc++ statically into the gcc binary
[ ] Compile libmudflap                          
[ ] Compile libgomp                             
[ ] Compile libssp                              
    *** Misc. obscure options. ***              
[ ] Use __cxa_atexit                            
[ ] Do not build PCH                            
<M> Use sjlj for exceptions                     
<M> Enable 128-bit long doubles

 

10.再去看看C-library:

然后用默认配置:

use default setting for c library_thumb

────────────────────────────── C-library ────────────────────────────────────
    C library (glibc)  —>                                                 
    Retrieval method (Released tarball)  —>                               
    glibc version (2.9)  —>                                               
    *** glibc/eglibc common options ***                                     
()  extra config                                                            
()  Extra config params (READ HELP)                                         
()  extra target CFLAGS                                                     
()  gcc extra flags                                                         
-*- Use the ports addon                                                     
()  Extra addons                                                            
      *** WARNING !!!                                             ***       
      ***   For glibc >= 2.8, it can happen that the tarballs     ***       
      ***   for the addons are not available for download.        ***       
      ***   If that happens, bad luck… Try a previous version   ***       
      ***   or try again later… :-(                             ***       
    Minimum supported kernel version (Same as kernel headers (default))  —>
    *** Common C library options ***                                        
    Threading implementation to use: (nptl)  —>                           
[*] Install a cross ldd-like helper

11.再去看看Debug facilities:

针对其中的duma,去查了下:

D.U.M.A. – Detect Unintended Memory Access

发现是个检测内存访问异常的工具,所以,此处可以暂不选。

然后再把ltrace也去掉。

配置如下:

settings for debug facilities_thumb

Debug facilities
[*] strace  —>
[*] dmalloc  —>
[ ] duma  —>  
[*] gdb  —>   
[ ] ltrace  —>

12.再去看看Companion libraries:

用默认配置:

use default setting for companion libraries_thumb

──── Companion libraries
     GMP version (4.3.2)  —>                             
     MPFR version (2.4.2)  —>                            
     *** Companion libraries common options ***            
[ ] Check the companion libraries builds (!!! READ HELP!!!)
[ ] Build shared companion libraries

13.然后保存所有配置:

Save an Alternate Configuration File->.config->OK

Save an Alternate Configuration File_thumb

use config ok_thumb

 

【总结】

配置crosstool的话,主要就是参考别人的配置,一点点为xscale去做相应的改动。


【后记 2013-07-24】

后来在crosstool-ng官网看到了配置截图,其中巧了,有xscale的例子:

crosstool ng target options for xscale

所以,再次确认,之前自己填写的:

(armv5te) Architecture level
(xscale) Emit assembly for CPU
(xscale) Tune for CPU

是对的。

2.但是另外看到了,该例子中,对于xscale,设置的endianness设置为Big endian

而自己之前设置的是little endian

所以,要搞清楚:

xscale,到底是little endian还是big endian,还是两者都支持。

然后是参考:

Intel XScale Microarchitecture Programmer Model for Big Endian Application Note

中的解释:

Intel XScale Microarchitecture has the option to operate in either little or big endian mode.

即,都支持的,所以,可以根据自己需要去设置xscale是用little endian还是big endian。

转载请注明:在路上 » 【记录】为arm的xscale配置crosstool-ng

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.202 seconds, using 22.21MB memory