Apple mobile device processor instruction set ARMV6, ARMV7, armv7s, and arm64

Source: Internet
Author: User

I. Summary

In peacetime project development, may use the third party to provide the static library. A, if the. A provider technology is immature, problems can arise when using it, such as:

Compile error on the real machine: No architectures to compile for (Only_active_arch=yes, ACTIVE arch=x86_64, valid_archs=i386).

Compile error on Simulator: No architectures to compile for (Only_active_arch=yes, ACTIVE arch=armv7s, Valid_archs=armv7 armv6).

To solve these problems, you need to know some details about Apple's mobile device processor instruction set.


Ii. several important concepts

1, ARM

ARM processor, characterized by small size, low power consumption, low cost, high performance, so almost all mobile phone processors are based on arm, embedded systems in a wide range of applications.


2. ARM processor Instruction Set

Armv6|armv7|armv7s|arm64 are all ARM processor instruction sets, which are backwards compatible, such as ARMV7 instruction set compatibility ARMv6, only when using ARMV6 can not play its performance, can not use the new ARMV7 features, This can lead to less efficient program execution.

There are two more familiar instruction sets: I386|x86_64 is the instruction set for Mac processors, and i386 is for Intel's Universal microprocessor 32 architecture. The x86_64 is a 64-bit processor for the x86 architecture. So when using the iOS emulator you will encounter the I386|x86_64,ios emulator without an arm instruction set.



The ARM processor, known for its low power consumption and small size, is based on arm for almost all handset processors, and is widely used in embedded systems, and its performance is also excellent in the same power consumption products.

Armv6, ARMv7, armv7s, arm64 are all arm processor instruction sets, all instruction sets are in principle backwards compatible, such as Iphone4s's CPU default instruction set is ARMV7 instruction set, but it is also compatible with ARMV6 instruction set, Only when using the ARMV6 instruction set is it impossible to fully perform its performance, that is, the new features in the ARMV7 instruction set cannot be used, and, similarly, the IPhone5 processor comes standard armv7s instruction set and also supports the ARMV7 instruction set, but is unable to perform related performance optimizations. Thus, the execution efficiency of the program is not so high.

It is important to note that the iOS emulator does not run the arm instruction set and compiles the x86 instruction set, so only the arm instruction set of the device is executed on the iOS device.

Apple mobile device default instruction set so far (2014.8.22)

-------------------------------------------------------------------------------------

ARMV6 devices: IPhone, IPhone2, iphone3g, first generation, second generation IPod Touch

ARMV7 equipment: iphone3gs, IPhone4, iphone4s

ipad, IPad2, IPad3 (the New ipad), ipad Mini

ipod Touch 3G, ipod Touch4

armv7s equipment: IPhone5, IPHONE5C, IPad4 (IPad with Retina Display)

Arm64 devices: iphone5s, ipad Air, ipad mini2 (ipad mini with Retina Display)

-------------------------------------------------------------------------------------

The options associated with the instruction set in Xcode (Build Settings panel architectures):

Architectures:

Indicates that the set of instruction sets supported by the binary package that is required to be compiled by the selected target is implemented by compiling the corresponding binary packets, and if there are multiple supported instruction sets, the packets containing multiple instruction set codes will be compiled, resulting in a large number of packages generated by the final compilation.

Valid architectures:

Indicates that the set of instructions that may be supported is not supported by the instruction set indicated in the architectures list, Valid architectures limits the scope of the set of instructions that may be supported, that is, Valid The intersection of the architectures and architectures lists is the set of instructions supported by the Xcode final generation binary package.

For example, set the architectures support arm instruction set to: armv7,armv7s, the supported instruction set for the corresponding valid architectures is set to: armv7s,arm64, at this point, The set of instructions supported by the Xcode generation binary package is only armv7s.

Build Active Architecture only:

Indicates whether to compile only the set of instructions supported by the current connected device

This option works with two conditions that must be met before it works:

1. Set the value to Yes

2. Xcode successfully connected to the debug device

Suppose we set the build Active Architecture only value to Yes while Xcode connects to the phone iphone5s (matching instruction set arm64)

1. The first case

Architectures:armv7, armv7s, arm64

Validarchitectures:armv6, armv7s, arm64

Generating the instruction set supported by the binary package: arm64

2. The second case

Architectures:armv6, ARMv7, armv7s

Valid architectures:armv6, armv7s, arm64

Generating the instruction set supported by the binary package: armv7s

3. The third case

ARCHITECTURES:ARMV6, ARMv7

Valid architectures:armv6, armv7s, arm64

Generating the instruction set supported by the binary package: ARMV7

4. Fourth Case

Architectures:armv6

Valid architectures:armv6, armv7s, arm64

Generates the instruction set supported by the binary package: Although the compilation was successful, there was no target generation because the ARMV6 instruction set was no longer supported from XCode4.5, so the list was written in white.

5. Fifth Case

Architectures:armv7, armv7s, arm64

Valid architectures:armv7,armv7s

Generating the instruction set supported by the binary package: compilation error message

  
 
   
  
  1. No architectures to compile for (Only_active_arch=yes, ACTIVE arch=arm64, valid_archs=armv7 armv7s)

As you can see, when build Active Architecture only works:

The connected phone instruction set match is from high to low (Arm64 > Armv7s > ARMv7) in turn.

If the phone is connected to iphone5s, its default instruction set is arm64, if the architectures list is ARMV7, armv7s, the armv7s instruction set is selected as the target instruction set, if the valid architectures list contains the instruction set, The successfully generated binary package only supports the armv7s instruction set, and if the Alid architectures list does not contain this instruction set, the compilation will be faulted:

  
 
   
  
  1. No architectures to compile for (Only_active_arch=yes, ACTIVE arch=armv7s, valid_archs=armv7 arm64)

Similarly, if the architectures list is ARMV7, ARMv7 is selected as the target instruction set, and if the architectures instruction set is included in the valid ARMV7 list, the binary package can be successfully generated with only the armv7 of the instruction set supported. If the valid architectures list does not contain ARMV7, the compilation fails.

Recommendation: Usually the debug mode setting value is set to Yes,release mode to No

Apple mobile device processor instruction set ARMV6, ARMV7, armv7s, and arm64

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.