Home     News     Contact
ARM Development Suite  Try It Now  Buy It Now 

ARM C/C++ Compiler Details

Compiler  Wizards  Simulator  Debugger  Environment  Tutorials  Variants 

 

The Crossware ARM C/C++ compiler generates code for the microprocessors and microcontrollers based on the ARM7, ARM9 and Cortex M3 cores. It comes as part of the Crossware ARM Development Suite and runs under Windows 2000, Windows XP, Windows Vista and Windows 7.

HIGHLIGHTS

  • Optimising C/C++ compiler with extensions for embedded development.
  • Pre-written library routines including 32-bit and 64-bit floating point arithmetic.
  • Support for 64-bit integer arithmetic
  • Comprehensive source level debug output.
  • Data output for Embedded Development Studio source code browser.
  • Easy location of time-critical functions in high-speed RAM.

C Language Definition

The C compiler conforms to the 1989 ANSI C specification and in addition provides a number of general enhancements including:

  • variables can be any length with all characters significant
  • the _interrupt and _nestedinterrupt keywords declares C functions as interrupt routines

It also supports a number of features from the 1999 ANSI C Standard including:

  • The // characters mark the start of a comment which extends to the end of the line.
  • Variables can be defined anywhere within a block, not just at the beginning.
  • Variables can be defined within the initialising expression of a for loop.

In addition, the compiler supports the C++ feature that allows variables to be defined within the conditional expressions of the for loop, while loop, if statement and switch statement

The support libraries are a subset of the ANSI standard libraries. The supported functions are listed below.


C++ Language Definition

The C++ compiler supports the Embedded C++ language. Embedded C++ is a subset of C++ specifically formulated for embedded systems. It is defined at http://www.caravan.net/ec2plus.

Embedded C++ excludes templates, exceptions, namespaces, run-time type information, localization, file operations and some other features.

Also Embedded C++ does not support multiple-inheritance and virtual base classes. However the Crossware compiler does support multiple-inheritance but does not support virtual base classes.

Since Embedded C++ does not support templates, basic_string is not supported. As an alternative, Embedded C++ provides the string class. The Crossware C++ library includes the string class.

The Crossware C++ library also includes the operators new, delete, new[], delete[], placement new and placement new[].

Other Embedded C++ library features such as streams and complex are not yet available in the Crossware library.


Data Sizes

The compiler uses the following sizes for the various C data types:

 char and unsigned char 1 byte
 short int and unsigned short int 2 bytes
 int and unsigned int 4 bytes
 long and unsigned long 4 bytes
 long long and unsigned long long 8 bytes
 float 4bytes (32 bits)
 double 8 bytes (64 bits)
 long double 8 bytes (64 bits)
 enum 4 bytes
 bit fields up to 32 bits

Optimizations

Optimizations include:

  • constant folding
  • strength reduction
  • algebraic simplification
  • jump/branch optimization
  • global register allocation by graph coloring
  • optional function in-lining
  • stack frame pointer elimination
  • multiple function calling conventions
  • advanced optimizations based upon program and data flow analysis including:
    • Conditional branch elimination
    • Extended common sub-expression elimination
    • Dead code elimination
    • Conditional constant propogation
    • Loop transformation

Function Calling Conventions

The compiler supports three calling conventions:

  • Arguments declared with the register keyword will be passed in registers if an appropriate register is available. Arguments are passed in registers R0, R1, R2 and R3. (Caller pops stack.)
  • As above except that arguments are popped from the stack by the called function before it returns. (Callee pops stack.)
  • If an appropriate register is available, an argument will be passed in a register. Arguments are passed in registers R0, R1, R2 and R3. The register keyword will be ignored. The arguments are popped from the stack by the called function before it returns. (Callee pops stack.)

In-Line Assembler

Assembler code can be embedded in your C source code using two methods.

  • The _asm keyword can be used to embed assembler into C functions.
  • The #asm/#endasm directives allows assembler to be placed anywhere within a C source file, not just within functions.

Strings inserted using the _asm keyword are scanned by the C preprocessor and so assembler statements can be generated using C macros with full macro token replacement. Additionally, the compiler can replace C variable names with the appropriate sub-string allowing easy access to global, static and local variables and parameters.

On the other hand, assembler macros are best defined outside of functions and the #asm/#endasm directive allows this.


Code and data location

Compiler generated code and data are automatically located in appropriate memory sections. Linker options allow these sections to be located at user defined memory locations. String constants and objects declared as const are located in code space. Initialised and uninitialised data are located in separate sections and initialisation of these sections is automatically carried out at run time.

Directives are also available allowing you to tell the compiler to place code and data in your own named sections. This gives you further control on where code and data are placed and how data space is initialised.


Linker scripting

The optional use of linker scripts adds more flexibilty to the location of sections and in particular allows the storage and run-time addresses to be different.

Drag-and-drop linker script editing

A unique drag-and-drop linker script editor simplifies the change to a linker script approach and eliminates the need for an understanding of the linker script language.

Optional section name translation enables the use of linker scripts written for other tool chains.


Source Code Browsing

The compiler optionally generates information on all of the definitions of and references to the identifiers used in your program. This includes functions, function parameters, local variables, global and static variables, enum identifiers, typedefs, goto labels and the tag names of structures, unions and enums. The Embedded Development Studio will then use this information to allow you to quickly navigate through your source code.


Debug Records

Comprehensive debug records are generated by the compiler and embedded in the object files for each module. The linker combines these to produce program wide debugging records.


C Library Routines

abs( ) coshl( ) gets( ) longjmp() sin( ) strrchr( )
acos( ) exit( ) getvect( ) ltoa() sinl( ) strspn( )
acosl( ) exp( ) gmtime() malloc( ) sinh( ) strstr( )
alloca() expl( ) isalnum( ) memchr( ) sinhl( ) tan( )
asctime() fabs( ) isalpha( ) memcmp( ) sprintf( )tanl( )
asin( ) fabsl( ) isascii( ) memcpy( ) sqrt( ) tanh( )
asinl( ) _fcvt( ) iscntrl( ) memmove( )sqrtl( ) tanhl( )
atan( ) ferroe( ) isdigit( ) memset( ) srand( ) time( )
atanl( ) fgetc( ) isgraph( ) mktime() sscanf( ) toascii( )
atoi( ) fgets( ) islower( ) pow( ) strcat( ) tolower( )
atol( ) fileno( ) isprint( ) powl( ) sscanf( ) toupper( )
atoff( ) floor( ) ispuntc( ) printf( ) strchr( ) ultoa()
atolf( ) floorl( ) isspace( ) putc( ) strcmp( ) ungetc( )
calloc() fprintf( )isupper( ) putchar( )strcpy( ) ungetch( )
clearerr( )fputc() isxdigit( )puts( ) strcspn( )vfprintf()
ceil( ) fputs() labs( ) qsort() stricmp() vprintf()
ceill( ) free( ) ldexp() rand( ) strlen( ) vsprintf()
clock() fscanf( ) log( ) sbrk( ) strncat( )
cos( ) getc( ) logl( ) scanf( ) strncmp( )
cosl( ) getchar( )log10( ) setjmp() strncpy( )
cosh( ) getche( ) log10l( ) setvect( )strpbrk( )