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
NoteFor AArch64, the default architecture is Arm®v8‑A.
NoteAArch32 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
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
It is also possible to enable or disable optional architecture features, by
+[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
+no to explicitly enable or disable
an optional architecture feature.
NoteYou 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.
Specifying an optimization level
The default optimization level is
which does not apply any optimizations. Arm recommends that
you always specify a suitable optimization level. For more information, see Selecting optimization options in the Arm® Compiler User Guide, and see the
option in the Arm® Compiler armclang
These examples compile and link the input file
- To compile for the Armv8‑A architecture in AArch64 state, use:
armclang --target=aarch64-arm-none-eabi -march=armv8-a helloworld.c
- To compile for the Armv8‑R architecture in AArch32 state, use:
armclang --target=arm-arm-none-eabi -march=armv8-r helloworld.c
- To compile for the Armv8‑M architecture 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
- To target the AArch32 state of an Arm Neoverse™ N1 processor, use:
armclang --target=arm-arm-none-eabi -mcpu=neoverse-n1 helloworld.c
- To target the AArch64 state of an Arm
armclang --target=aarch64-arm-none-eabi -mcpu=neoverse-e1 helloworld.c