C and C++ update for Arm Compiler 6

As you are hopefully aware, Arm Compiler 6 has been available for 3+ years now, and has grown in maturity, and optimization quality release on release. As I write this, the latest available version is 6.8, and 6.6 has been qualified for use in safety-related development. We offer full support for the latest Arm processors, across the Cortex-A, R, and M, and SecureCore families. Arm Compiler 6 is available within DS-5 and Keil MDK toolchains. Furthermore the qualified version is available for purchase stand-alone.

Arm Compiler 6 is based on the LLVM framework, using the modern Clang compiler front-end, and this is reflected in the name of the executable, Armclang. The compiler is then integrated into the full Arm tools suite, enabling use of legacy assembler code built with Armasm, as well as gas format assembler directly with Armclang. Finally the Arm linker (Armlink) brings in the optimized C and C++ libraries, or if desired the size optimized Arm C MicroLib library, as well as (optionally) implementing link-time optimizations across the source code.

One advantage of using Clang is that this allows for support for the latest C and C++ standards. In particular we are seeing a growing interest in C++11 and C++14 features. We document that C++11 and other standards are supported, and are selected with the -std option. We also allow for additional features, such as C++14, to have beta-quality support. These are features that we have not yet formally productized, but are present within Clang (for example, the --std=c++14 option is not currently mentioned in Arm's documentation, but is consumed by the compiler).

For information on C++ support in Clang, see here.

For information on the source language compatibility in Clang, see here.

C++ threads

We have also been working on C++ threading (std::thread) support. While the top level functionality is supported, their is a requirement on the user to provide the necessary low level support. We are developing an API as defined in arm-tpl.h to facilitate this. Within this header file is an example 'dummy' implementation to allow your code to successfully build (though will not execute), which you can use by pre-defining (-D) the macro _ARMTPL_BUILD_DUMMY_THREADS, and of course including this header (#include <arm-tpl.h>).

A cursory search online found a number of C++ thread code examples. I was able to easily build these by including the above header file in the source(s), and (as per the documentation) compiling with:

  • D_ARM_LIBCPP_EXTERNAL_THREADS -D_ARMTPL_BUILD_DUMMY_THREADS-std=c++11

and linking with:

  • -stdlib=threaded_libc++

Note that C++ threading, while a powerful feature, is not suitable in all use cases, notably in highly memory limited systems, as even relatively simple examples pull in over 100KB of library code to support this.

Anonymous