REALVIEW COMPILATION TOOLS

Smallest, Fastest Code, All the Features

The RealView Compilation Tools (RVCT) is part of RVDS, and includes everything you need to build C and C++ applications for ARM processors. It includes the following:

  • Optimising ANSI C Compiler - the best code density and performance available for ARM
  • Optimising Embedded C++ Compiler - full C++ implementation with efficient code
  • Compiler intrinsics for NEON
  • Powerful macro assembler for ARM and Thumb instructions (even better is an embedded assembler in C compiler which supports C expressions)
  • Image Conversion Tool - for producing binaries for ROM, etc.
  • Innovated profile-driven compilation improves performance and code size further
  • ARM Object file Librarian/Archiver
  • C Libraries, including a microlib which can achieve a 50% reduction in code size versus the full library
  • RogueWave C++ Libraries
  • Supports ARM, Thumb and Thumb-2 instruction sets
  • Supports all available ARM architecturee
  • Selectable debug and optimisation levels to trade off debuggability vs performance
  • Supports architecture-specific optimisations for versions 4T, 5, 6 and 7, providing even higher performance for particular targets, but without sacrificing binary compatibility
  • Object files conform to industry standard ELF and DWARF formats

The core compilers have been around for many years and have been progressively refined to offer the best available code size and speed characteristics for a wide range of user code. The compilers provide a full set of warnings and errors as required by ANSI, but also provide option to allow processing of 'old-style' C code which is useful for porting.

The compiler makes full use of the ARM register set, even using load/store multiple instructions where possible to optimise data throughput. The compilers produce images up to 25% smaller than other leading tool suites which translates into less ROM or flash space or more features.

Specific optimisations are provided for the various ARM architecture versions (v3, v4T, v5, v6, v7) with further gains in code speed and size. ARM's detailed knowledge and understanding of the ARM architecture allows it to lead the field in this area. For example, some processors benefit from keeping loads as far after stores as possible. Others benefit from loading a register a few cycles before it us used. While code produced for one processor may not be optimal for another, it will still work (provided it is up to the same architecture level), preserving binary compatibilty.

The profile-driven compilation feature is a major advance. For no additional programmer effort, this uses information obtained from profiling the execution of the program to adjust its compilation. The helps to advise the compiler which branches are typically taken and where to direct its optimisation efforts. The result can be 6% more performance and sometimes 40% smaller code size.

Vectorising C/C++ Compiler

One of the limitations of SIMD machines such as NEON is that programmers must jump through lots of hoops to obtain the massive performance improvements which are available. ARM's state-of-the-art vectorising compiler goes a long way to addressing this complaint. In operation it can appear to work like magic. ARM offers this example:

codegen

Here the compiler has detected that the loop is executed 40 times. It unrolls the loop 4 times, and runs around this new loop 10 times. Each loop processes 4 words at a time using NEON's 128-bit quad-word registers.

Performance increases of 4X can be obtained in multi-media kernels which typically leads to a 2X improvement overall in the application as a whole.

Use of Inline Assembler

10

The compiler's in-built assembler is a wonderful tool when you need it. It allows you to embed 'high-level' assembly code into your C program, and make use of C variables and expressions. The compiler takes care of converting your high-level code into real assembler as efficiently as possible.

Consider the following code fragment:

int start_dsp (dsp_info *area, int code, int x, int y, int z)
   {
   int status;

   __asm
      {
      mov   r6, code
      mov   r7, #area + x + y * 64
      mov   r8, #884392
      str      r0, [area, #0]
      str      r0, DSP_START
      ldr      status, DSP_STATUS
      orr     status, status, z << 8
      };
   return status;
   }

The compiler takes care of evaluation the expressions and accesses to C variables, as well as the large constant move into r8. It ensures that registers used in the function are saved and restored as required by the APCS.

A separate assembler tool is also provided with a more conventional feature set. This can still be useful where large amounts of assembler must be written. The assembler has a good range of high-level directives including declaring areas of memory, looping, powerful macros, variables and conditional statements.

LINKER

The ARM linker is designed for embedded development. It uses the standard ELF and DWARF file formats for object files and debug information.

The linker provides a very flexible scatter-loading facility, allowing placement of code and data anyway in the target memory map on startup. The allows a program in a single ROM (for example) to copy code and/or data  to faster SRAM or SDRAM on startup automatically, just by specifying the relevant memory regions in the scatter loading definition.

The linker can remove unused code area and report those which were removed. This is useful for removing debug or performance testing code for final production builds. and can in some case reduce the resulting image dramatically with very little programmer effort.

IMAGE CONVERTION TOOL (FROMELF)

Fromelf converts from its native ELF format to the following downloadable and ROMable formats:

  • Binary
  • Motorola 32-bit S record
  • Intel Hex-32
  • Byte oriented hex formats

Fromelf can also provide a disassembly or symbol listing for an input file.

ARM OBJECT FILE LIBRARIAN

This allows groups of object files to be combined into libraries for easier use. Various operations are supported on libraries including adding and deleting members, and merging of libraries.

SEMIHOSTING

One of the really nice features of the ARM tools is full semi-hosting. Semi-hosting means that you get some of the host facilities on the target.

For example, if you are using Multi-ICE or a platform supported by uHAL, you can use printf() to output on the host computer, you can open files with fopen(), you can get input from the user with scanf() or even check the time. This allows standard C programs to run on target hardware without needing to be ported.

This can save huge amounts of time during development, as test suites and benchmark programs used on the host can run largely unmodified on the target.

Semihosting even works in the ARMulator simulator.

Of course in the final product, the code must be made stand-alone. uHAL actually provides a facility for printf() and scanf() to redirect to the serial port, for example. But in most cases this code would be taken out by means of '#ifdef DEVELOPMENT' or similar.

C AND ROGUEWAVE C++ LIBRARIES

The full ANSI standard C libraries consist of:

  • Functions defined by the ISO C library standard
  • Target-dependent functions used to implement the C library functions in the semi-hosted execution environment
  • Helper functions used by the C and C++ compilers

Target-dependent C library functions can be re-implemented for any execution environment (see semi-hosting above). The floating-point library uses the ARM floating-point environment, which is an implementation of the IEEE 754 standard for binary floating-point arithmetic.

The C++ libraries include:

  • ISO C++ Standard Template Libraries
  • The RogueWave Standard C++ Library version 2.01.01

ARM C/C++ EABI

EABI is a cross-platform standard developed by ARM, in collaboration with major OS and tools vendors, which specifies how executables and shared objects work together for OS or other execution environments. This standard enables RealView Compilation Tools version 2.0 to be easily integrated with custom development environments and third-party tools that conform to the ARM C/C++ EABI standard. Library developers also benefit as they can create libraries that work with any ARM C/C++ EABI compliant compiler, so increasing the number of compatible standard libraries available for the ARM architecture for many application areas.

In particular this allows the ARM compiler to be used for Linux application compilation, providing performance, stability and code size benefits over using GCC

Intrinsics

The ARM Compiler supports intrinsics, a way of using particular ARM instructions or common code sequences from C. The advance of these is that they will take advantage of whatever hardware support is available.

Intrinsics are defined for:

  • NEON SIMD operations
  • Telecom primitives defined by ETSI, such as saturated arithmetic
  • TI C55 intrinsics to permit easier porting of DSP code to ARM
  • Architecture-specific intrinsics such as CLZ show in the example below

codegen2

 

Applications

rs1

rs_2

rs_3

rs_4