Using ARM Compiler 6 with Carbon Performance Analysis Kits (CPAKs)

ARM has released DS-5 version 5.19 including the Ultimate Edition for ARMv8 to compile and debug 64-bit software. The The specified item was not found. Performance Analysis Kits (CPAKs) for the ARM Cortex-A57 and Cortex-A53 demonstrate 64-bit bare metal software examples which can be modified and compiled with DS-5. The software in the currently available CPAKs is compiled with ARM Compiler 5, better known as armcc, and not yet configured for ARM Compiler 6, also known as armclang. Fortunately, only a few changes are needed to move from armcc to armclang.

Today, I will provide some tips for using ARM Compiler 6 for those who would like to use the latest compiler from ARM with CPAK example software. In the future, all CPAKs will be updated for ARM Compiler 6, but now is a good time to give it a try and learn about the compiler.

ARM Compiler 6 is based on Clang and the LLVM Compiler Framework, and provides best in class code generation for the ARM Architecture. There are various articles covering the details, but the key takeaway is that ARM Compiler 6 is based on open source which has a flexible license and allows commercial products to be created without making the source code available.

Migration Guide

A good place to understand the differences between armcc and armclang is the ARM Compiler Migration Guide. It explains the command line differences between the two compilers and how to map switches from the old compiler to the new compiler. The migration guide also covers two additional tools provided to aid in switching compilers:

  • Source Compatibility Checker
  • Command-line Translation Wrapper

The compatibility checker helps find issues in the source code that is being migrated, while the translation wrapper provides an automatic way to call armcc as before, but invisibly calls armclang with the equivalent options. I didn’t spend too much time with either tool, but they are worth checking out.

The key point is that migration will involve new compiler invocation and switches, but it may also involve source code changes for things such as pragmas and attributes that are different between the compilers.


Let’s look at the practical steps to use ARM Compiler 6 on a Cortex-A53 CPAK software example. For this exercise I selected the DecrDataMP_v8/ example in the Applications/ directory of the CPAK. The system is a dual-cluster A53 where each cluster has 1 core. It also includes the CCI-400 to demonstrate cache coherency between clusters and the NIC-400 for connecting peripherals. The block diagram is shown below.

Cortex-A53 System

Setting up DS-5 is very easy, I use Linux and bash so I just add the bin/ directory of DS-5 to my PATH environment variable. Adjust the path to match your installation.

$ export PATH=$PATH:/o/tools/linux/ARM/DS5_5.19/64bit/bin

Only the 64-bit version of DS-5 includes ARM Compiler 6, it’s not included in the 32-bit version of DS-5 so make sure you install the 64-bit version and run on a 64-bit Linux machine.

The first step to using ARM Compiler 6 is to edit the Makefile and replace armcc with armclang to compile the C files. Any assembly files can continue to be compiled by armasm and linking done with armlink remains mostly the same. It is possible to compile assembly files and link with armclang, but for this case I decided to leave the flow as is to learn the basics of making the compiler transition.

The Makefile specifies the compiler as the CC variable so make it CC=armclang

The next important change is the specification of the target CPU. With armcc the --cpu option is used. You will see --cpu=8-A.64.no_neon in the Makefile. One tip is to use the command below to get a list of possible targets.

$ armcc --cpu list

With armclang the target CPU selection is done using the -target option. To select AArch64 use -target aarch64-arm-none-eabi in place of the --cpu option.

The invocation command and the target CPU selection are the main differences needed to switch from armcc to armclang.

Other Switches

This particular CPAK software is using –-c90 to specify the version of the C standard to use. For armclang the equivalent option is –xc –std=c90 so make this change in the Makefile also.

The next issue is the use of –-dwarf3 option. This is not supported by armclang and it seems like DWARF4 is the only option with armclang.

The Makefile also uses –Ospace as an option to shrink the program size at the possible expense of runtime speed. For armclang this should be changed to –Os.

The last difference relates to armlink. The armlink commands need --force_scanlib to tell armlink to include the ARM libraries. From the documentation, this option is mandatory when running armlink directly. Add this flag to the armlink commands and the compilation will complete successfully and generate .axf files!

Here is a table summarizing the differences.

ARM Compiler 5

ARM Compiler 6

Invoke using armcc

Invoke using armclang


-target aarch64-arm-none-eabi






I encountered one other quirk when migrating this example to ARM Compiler 6, a compilation error caused by using .h file in the source file retarget.c

  #include <rt_misc.h>

For now I just commented out this line and the application compiled and ran fine. It’s probably something to look into on a rainy day.

Creating an eclipse Project for DS-5

It wouldn’t be DS-5 if we didn’t use the eclipse environment to compile the example. It’s very easy to do so I’ll include a quick tutorial for those who haven’t used it before. Since a Makefile already exists for the software I used a new Makefile project.

First, launch eclipse using

$ eclipse &

Once eclipse is started, use the menu File -> New -> Makefile Project with Existing Code

Pick a name for the a project and fill it into the dialog box, browse to the location of the code, and select ARM Compiler6 as the Toolchain for indexer settings.

DS5 armclang

There are many ways to get the build to start, but once the project is setup I use the Project menu item called Build Project and the code will be compiled.

There is a lot more to explore with DS-5, but this is enough information to get going in the right direction.

ARM Techcon

Now is a great time to start making plans to attend ARM TechCon, October 1-3 at the Santa Clara Convention Center. The schedule has just been published and registration is open. I will present Performance Optimization for an ARM Cortex-A53 System using Software Workloads and Cycle Accurate Models on Friday afternoon.

Jason Andrews

  • Hi Jason

    Nice write up - good to see that the divergence in CLI between armcc and armclang isn't too much of a hurdle for migration.

    If you could raise a Jira defect in the SDCOMP project for the rt_misc.h issue we would be interested to look into it. If you could include commandline, the output from armclang with -v added to the commandline and ideally the preprocessed source (same options as for armcc -E) then that should give us enough info to start with.

    Also FYI, the hard restriction on DWARF-4 will be fixed in the 6.01 release of ARM Compiler 6, ETA December. The -gdwarf-3 option should work in ARM Compiler version 6.00, but not when the input is a .s file.



  • To setup armclang for command line usage there is a utility to setup your shell. The argument can be a shell type and a new sub-shell will be created. I use bash so I setup a new shell using: 


    $ <ds5-install-directory>/64bit/bin/suite_exec_ac6 bash  


    You can also use the utility to run make like this: 


    $ <ds5-install-directory>/64bit/bin/suite_exec_ac6 make 


    If the bin/ directory is already in your PATH as I recommended in the article you can just do: 


    $ suite_exec_ac6 make