Selecting the target processor
The Arm Compiler 6 lets you target either an architecture or a specific processor when generating code:
- Specifying an architecture provides the greatest code compatibility. The generated code can run on any processor supporting that architecture.
- Specifying a particular processor provides optimum performance. The compiler can use processor-specific features such as instruction scheduling to generate optimized code for that specific processor.
We consider the following
armclang command-line options in this section:
--targetcommand-line option is mandatory and allows you to specify the target triple. The target triple has the form architecture-vendor-OS-abi, for example
aarch64-arm-none-eabi. The available triples are limited by the compiler version (see supported triples).
- Use the
--marchoption to generate code for a specific architecture (for example
armv8-a). The supported architectures vary according to the selected target. To see a list of all the supported architectures for the selected target, use
- Use the
--mcpuoption to generate code for a specific processor (for example
cortex-a53). The supported processors vary according to the selected target. To see a list of all the supported processors for the selected target, use
You must avoid specifying both the architecture (
-march) and the processor (
-mcpu) because it can cause a conflict. The compiler infers the correct architecture from the processor. For example,
-march= armv8-a. We recommend you understand the mandatory armclang options to set these options correctly.
To configure the
-mcpu options in Arm DS:
- Select your project in the Project Explorer view.
- To display the Properties dialog box, select Project > Properties from the main menu. You can also right-click on your project in the Project Explorer view to select Properties.
- Expand C/C++ Build, then Settings in the Properties dialog box.
- On the Tool Settings tab, select Arm C Compiler 6 > Target to display the code generation settings.
- Select Enable tool specific settings.
- Enter a value for Target (--target). In this tutorial, we specify
--target=aarch64-arm-none-eabito generate A64 instructions for AArch64 state.
- Enter a value for Architecture (-march) or CPU (-mcpu). Remember to only include a value for one of these two fields. In the following example, we set CPU (-mcpu) to
cortex-a53to build for a Cortex-A53 processor.
- Click Apply and Close to save the settings.
You can see a list of all supported architectures by specifying
list for the Architecture (-march) setting, then building your project. The console (Window > Show View > Console) shows the list of architecture names.
You can also see a list of all supported processors by specifying
list for the CPU (-mcpu) setting, then building your project.
If the compiled program is to run on a specific Arm architecture-based processor, select the target processor. For example, to compile code to run on a Cortex-A53 processor use the CPU (-mcpu) setting
Alternatively, if the compiled program is to run on different Arm processors, choose the lowest common denominator architecture appropriate for the application. Use the Architecture (-march) setting to set the architecture. For example, if you want your program to compile for Cortex-A53 and Cortex-A57 processors, you must use the