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

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

CrossCompiler crifan 5092浏览 0评论

【背景】

折腾:

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

期间,需要去为xscale配置Target Options,需要搞懂对应的选项:

Architecture level

architecture level in target options

对于xscale来说,到底填写什么。

【折腾过程】

1. 进入Help:

goto help

其说明为:

crosstool-NG v1.9.3 Configuration – .config
Architecture level

CT_ARCH_ARCH:                                                                
                                                                             
GCC uses this name to determine what kind of instructions it can emit        
when generating assembly code. This option can be used in conjunction        
with or instead of the ARCH_CPU option (above), or a (command-line)          
-mcpu= option.                                                               
                                                                             
This is the configuration flag –with-arch=XXXX, and the runtime flag        
-march=XXX.                                                                  
                                                                             
Pick a value from the gcc manual for your choosen gcc version and your       
target CPU.                                                                  
                                                                             
Leave blank if you don’t know, or if your target architecture does not       
offer this option.                                                           
                                                                             
Symbol: ARCH_ARCH [=armv7-a]                                                 
Prompt: Architecture level                                                   
  Defined at config/target.in:164                                            
  Depends on: ARCH_SUPPORT_ARCH                                              
  Location:                                                                  
    -> Target options

for march goto gcc option

2.很明显,对于此处的march,需要自己去找gcc中的march的说明,然后找到针对xscale,然后才知道填写何值。

然后google搜:

gcc ARMv5TE armv7-a

找到:

ARM 指令集版本和ARM 版本

以及arm的官网:

3.17.3 ARM Options

找到了真正的官网解释了:

-mcpu=name
This specifies the name of the target ARM processor. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. Permissible names are:
‘arm2’, ‘arm250’, ‘arm3’, ‘arm6’, ‘arm60’, ‘arm600’, ‘arm610’, ‘arm620’, ‘arm7’, ‘arm7m’, ‘arm7d’, ‘arm7dm’, ‘arm7di’, ‘arm7dmi’, ‘arm70’, ‘arm700’, ‘arm700i’, ‘arm710’, ‘arm710c’, ‘arm7100’, ‘arm720’, ‘arm7500’, ‘arm7500fe’, ‘arm7tdmi’, ‘arm7tdmi-s’, ‘arm710t’, ‘arm720t’, ‘arm740t’, ‘strongarm’, ‘strongarm110’, ‘strongarm1100’, ‘strongarm1110’, ‘arm8’, ‘arm810’, ‘arm9’, ‘arm9e’, ‘arm920’, ‘arm920t’, ‘arm922t’, ‘arm946e-s’, ‘arm966e-s’, ‘arm968e-s’, ‘arm926ej-s’, ‘arm940t’, ‘arm9tdmi’, ‘arm10tdmi’, ‘arm1020t’, ‘arm1026ej-s’, ‘arm10e’, ‘arm1020e’, ‘arm1022e’, ‘arm1136j-s’, ‘arm1136jf-s’, ‘mpcore’, ‘mpcorenovfp’, ‘arm1156t2-s’, ‘arm1156t2f-s’, ‘arm1176jz-s’, ‘arm1176jzf-s’, ‘cortex-a5’, ‘cortex-a7’, ‘cortex-a8’, ‘cortex-a9’, ‘cortex-a15’, ‘cortex-a53’, ‘cortex-r4’, ‘cortex-r4f’, ‘cortex-r5’, ‘cortex-r7’, ‘cortex-m4’, ‘cortex-m3’, ‘cortex-m1’, ‘cortex-m0’, ‘cortex-m0plus’, ‘marvell-pj4’, ‘xscale’, ‘iwmmxt’, ‘iwmmxt2’, ‘ep9312’, ‘fa526’, ‘fa626’, ‘fa606te’, ‘fa626te’, ‘fmp626’, ‘fa726te’.

-mcpu=generic-arch is also permissible, and is equivalent to -march=arch -mtune=generic-arch. See -mtune for more information.

-mcpu=native causes the compiler to auto-detect the CPU of the build computer. At present, this feature is only supported on Linux, and not all architectures are recognized. If the auto-detect is unsuccessful the option has no effect.

-march=name
This specifies the name of the target ARM architecture. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. This option can be used in conjunction with or instead of the -mcpu= option. Permissible names are:
‘armv2’, ‘armv2a’, ‘armv3’, ‘armv3m’, ‘armv4’, ‘armv4t’, ‘armv5’, ‘armv5t’, ‘armv5e’, ‘armv5te’, ‘armv6’, ‘armv6j’, ‘armv6t2’, ‘armv6z’, ‘armv6zk’, ‘armv6-m’, ‘armv7’, ‘armv7-a’, ‘armv7-r’, ‘armv7-m’, ‘armv8-a’, ‘iwmmxt’, ‘iwmmxt2’, ‘ep9312’.

-march=native causes the compiler to auto-detect the architecture of the build computer. At present, this feature is only supported on Linux, and not all architectures are recognized. If the auto-detect is unsuccessful the option has no effect.

所以,此处,针对arm的xscale来说,就是:

-mcpu=xscale
-march=armv5te

所以,此处,针对:

CT_ARCH_ARCH

==Architecture level

==configuration flag –with-arch=XXXX

==runtime flag -march=XXX

==for xscale则是:-march=armv5te

3.类似的,对于:

(1)Emit assembly for CPU

crosstool-NG v1.9.3 Configuration – .config

Emit assembly for CPU
CT_ARCH_CPU:                                                          
                                                                      
This specifies the name of the target processor. GCC uses this name   
to determine what kind of instructions it can emit when generating    
assembly code.                                                        
                                                                      
This is the configuration flag –with-cpu=XXXX, and the runtime flag  
-mcpu=XXX.                                                            
                                                                      
Pick a value from the gcc manual for your choosen gcc version and your
target CPU.                                                           
                                                                      
Leave blank if you don’t know, or if your target architecture does not
offer this option.                                                    
                                                                      
Symbol: ARCH_CPU [=cortex-a8]                                         
Prompt: Emit assembly for CPU                                         
  Defined at config/target.in:201                                     
  Depends on: ARCH_SUPPORT_CPU                                        
  Location:                                                           
    -> Target options

 

emit assembly for cpu

 

(2)Tune for CPU

crosstool-NG v1.9.3 Configuration – .config

Tune for CPU

CT_ARCH_TUNE:                                                            
                                                                         
This option is very similar to the ARCH_CPU option (above), except       
that instead of specifying the actual target processor type, and hence   
restricting which instructions can be used, it specifies that GCC should 
tune the performance of the code as if the target were of the type       
specified in this option, but still choosing the instructions that it    
will generate based on the cpu specified by the ARCH_CPU option          
(above), or a (command-line) -mcpu= option.                              
                                                                         
This is the configuration flag –with-tune=XXXX, and the runtime flag    
-mtune=XXX.                                                              
                                                                         
Pick a value from the gcc manual for your choosen gcc version and your   
target CPU.                                                              
                                                                         
Leave blank if you don’t know, or if your target architecture does not   
offer this option.                                                       
                                                                         
Symbol: ARCH_TUNE [=cortex-a8]                                           
Prompt: Tune for CPU                                                     
  Defined at config/target.in:220                                        
  Depends on: ARCH_SUPPORT_TUNE                                          
  Location:                                                              
    -> Target options                                                   

 

tune for cpu CT_ARCH_TUNE

则分别是,对应的:

 

Emit assembly for CPU

==CT_ARCH_CPU

==configuration flag –with-cpu=XXXX

==the runtime flag  -mcpu=XXX

==for xscale则是:-mcpu=xscale

 

Tune for CPU

==CT_ARCH_TUNE

==configuration flag –with-tune=XXXX

==runtime flag -mtune=XXX

== for xscale则是:-mtune=xscale

4.然后对于xscale,按照上述配置去配置,则是:

set for xscale is armv5te and xscale

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

 

【总结】

crosstool中的三个参数

Architecture level==CT_ARCH_ARCH

Emit assembly for CPU ==CT_ARCH_CPU

Tune for CPU==CT_ARCH_TUNE

分别对应的是,常见的,gcc中的参数:

-march=XXX

-mcpu=XXX

-mtune=XXX

对于xscale则是:

-march=armv5te
-mcpu=xscale

-mtune=xscale

如此设置,应该就对了。

转载请注明:在路上 » 【整理】crosstool中的Architecture level(CT_ARCH_ARCH),Emit assembly for CPU(CT_ARCH_CPU),Tune for CPU(CT_ARCH_TUNE)的值,对于arm的xscale应该是填写什么

发表我的评论
取消评论

表情

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

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