Learning Notes-processor instruction set for mobile devices ARMv6 armv7 armv7s arm64

Source: Internet
Author: User

First look at the instruction set of the ARM processor supported by the different models of the Apple phone

The ARM processor is known for its low power consumption and small size, and almost all mobile devices are arm-based, and its application in embedded systems is extensive, and its performance is excellent in the same power consumption products.

1.ARMV6 supports IPhone IPhone2 iphone3g and first generation second-generation ipod Touch

ARMV7 supports IPhone4 and iphone4s

Armv7s supports IPhone5 and iphone5c

ARM64 supports iphone5s. Requires minimum support 5.1.1

2. The machine is backward compatible with the instruction set, that is, the armv7 instruction set can be run on the iPhone5, but the efficiency is not so high

3.xcode inside about ARM options

@1 Architecture: Refers to the set of instructions you want to support.

@2 Valid architectures: Refers to the set of instructions that will be compiled. (the intersection of Architecture and Valid architectures is the set of instructions supported by the binary package generated by the Xcode compilation.) 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, Xcode generates a binary package The supported instruction set is only armv7s. )

@3 Build Active Architecture only: Compiles only the instruction set of the currently connected device.

This option works with two conditions: 1. The value is set to Yes 2. Successfully connected to the device

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

First case

Architectures:armv7, armv7s, arm64

Validarchitectures:armv6, armv7s, arm64

Generating the instruction set supported by the binary package: arm64

The second case

Architectures:armv6, ARMv7, armv7s

Valid architectures:armv6, armv7s, arm64

Generating the instruction set supported by the binary package: armv7s

The third case

ARCHITECTURES:ARMV6, ARMv7

Valid architectures:armv6, armv7s, arm64

Generating the instruction set supported by the binary package: ARMV7

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.

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 valid 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.

4. If you want the app to run efficiently on each machine, you must change the build Active Architecture only to No,valid architectures select the corresponding instruction set as ARMv7 armv7s arm64. This will compile the corresponding code for each instruction set, but finally the IPA package will be 3 times times the volume, release set to No.

5. If you want to keep app volume to a minimum, you should choose valid architectures as arm64 at this stage, Build Active Architecture only select Yes or No.

6. Add a little iOS emulator without running arm instructions, the software will be compiled into x86 can run instructions, so only the Apple device will be compiled to run the arm instruction set. So when you build a static library, it will be two. A, one is i386 for running in the emulator, the other is running on the real device, and then using the command line two. A merge into one.

Therefore, if the static libraries used in some programs do not support armv7s, and your project supports armv7s, "XXXX does not contain a (n) armv7s slice:xxxxx for Architecture armv7s" will appear. Compile error, there are two ways to solve this problem:

1. If the source code can be found, you can use the source code to re-play a support armv7s Libaray, or directly in the project using the source code, rather than the static library.

2. If it's not open source, either wait for support from a third-party library, or temporarily let your project not support armv7s.

Learning Notes-processor instruction set for mobile devices ARMv6 armv7 armv7s 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.