You copied the Doc URL to your clipboard.

Mandatory armclang options

When using armclang, you must specify a target on the command-line. Depending on the target you use, you might also have to specify an architecture or processor.

Specifying a target

To specify a target, use the --target option. The following targets are available:

  • To generate A64 instructions for AArch64 state, specify --target=aarch64-arm-none-eabi.

    Note

    For AArch64, the default architecture is ARMv8-A.
  • To generate A32 and T32 instructions for AArch32 state, specify --target=arm-arm-none-eabi. To specify generation of either A32 or T32 instructions, use -marm or -mthumb respectively.

    Note

    AArch32 has no defaults. You must always specify an architecture or processor.

Specifying an architecture

To generate code for a specific architecture, use the -march option. The supported architectures vary according to the selected target.

To see a list of all the supported architectures for the selected target, use -march=list.

Specifying a processor

To generate code for a specific processor, use the -mcpu option. The supported processors vary according to the selected target.

To see a list of all the supported processors for the selected target, use -mcpu=list.

It is also possible to enable or disable optional architecture features, by using the +[no]feature notation. For a list of the architecture features that your processor supports, see the processor product documentation. See the armclang Reference Guide for a list of architecture features that ARM Compiler supports.

Use +feature or +nofeature to explicitly enable or disable an optional architecture feature.

Note

You do not need to specify both the architecture and processor. The compiler infers the architecture from the processor. If you only want to run code on one particular processor, you can specify the specific processor. Performance is optimized, but code is only guaranteed to run on that processor. If you want your code to run on a range of processors from a particular architecture, you can specify the architecture. The code runs on any processor implementation of the target architecture, but performance might be impacted.

Examples

These examples compile and link the input file helloworld.c:

  • To compile for ARMv8-A in AArch64 state, use:
    armclang --target=aarch64-arm-none-eabi -march=armv8-a helloworld.c
     
  • To compile for ARMv8-R in AArch32 state, use:
    armclang --target=arm-arm-none-eabi -march=armv8-r helloworld.c
     
  • To compile for ARMv8-M mainline profile, use:
    armclang --target=arm-arm-none-eabi -march=armv8-m.main helloworld.c
     
  • To compile for a Cortex-A53 processor in AArch64 state, use:
    armclang --target=aarch64-arm-none-eabi -mcpu=cortex-a53 helloworld.c
     
  • To compile for a Cortex-A53 processor in AArch32 state, use:
    armclang --target=arm-arm-none-eabi -mcpu=cortex-a53 helloworld.c
     
  • To compile for a Cortex-M4 processor, use:
    armclang --target=arm-arm-none-eabi -mcpu=cortex-m4 helloworld.c
     
  • To compile for a Cortex-M33 processor, with DSP disabled, use:
    armclang --target=arm-arm-none-eabi -mcpu=cortex-m33+nodsp helloworld.c
     
Was this page helpful? Yes No