Go to 8051 Development Suite order page
The Crossware 8051 C compiler is an ANSI-standard compiler that generates code for the 8051 family of microcontrollers. It provides numerous extensions that allow access to 8051-specific features so that you can write your code completely in the C language without the need to resort to assembler code. It supports both small and large memory models so you can create code for all 8051 variants whether or not they have external RAM.
- The ANSI C compiler protects your investment by ensuring future portability of your C source.
- 8051-specific extensions enable you to access all of the resources of the 8051 and its variants from C.
- Smart pointers that can work out for themselves which memory area they are pointing to. This enables you to avoid inefficient 3-byte pointers yet still write ANSI C compatible code.
- Generates fast in-line code with a minimum of library calls for high-speed performance on your target board, or optionally uses library routines to minimize code size for those parts of your program where speed is less important.
- Full type checking across modules traps programming errors and ensures that your C variables, function arguments, structure members, etc. are consistent across your source files and with the appropriate libraries.
- Source-level debug output in IEEE695 format.
- Pre-written library routines, including high-speed 32-bit and 64-bit floating-point arithmetic.
- Register bank independent code.
- Easy-to-use C interrupt support with optional register bank switching.
- Small and large memory models.
- Place variables in any memory area.
- Supports all 8051 variants.
- Wide range of output formats.
- Integrated relocatable assembler.
- Highly user-friendly Embedded Development Studio integrated development environment (see separate data sheet).
- Data output for Embedded Development Studio browser.
OPTIMIZING 8051 C COMPILER
The compiler conforms to the ANSI C specification and provides a number of general enhancements including:
- variables can be any length with all characters significant
- the C++ commenting convention "//" is supported
- the _interrupt keyword declares a C function as an interrupt routine
- the _persist keyword declares that a variable will retain its contents (e.g. in battery backed up RAM) during power down and therefore should not be initialized.
The support libraries are a subset of the ANSI standard libraries. The supported functions are listed below.
8051-specific language extensions are described below.
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 byte |
|int and unsigned int: ||2 bytes |
|long and unsigned long: ||4 bytes|
|float: ||4 bytes (32 bits) |
|double: ||8 bytes (64 bits) |
|long double: ||8 bytes (64 bits) |
|enum: ||up to 4 bytes (minimum size to |
|bit fields: ||up to 32 bits |
|bit: ||1 bit |
- constant folding
- dead code elimination
- strength reduction
- algebraic simplification
- jump/branch optimization
- suppression of integral promotion
- global register allocation
- common code merging
- removal of unreferenced local data
8051 Language Extensions
In addition to the general extensions described above, the compiler supports numerous 8051-specific extensions which enable you to maximise your use of the internal resources of the 8051 and its variants. These include:
- Qualifiers to enable you to place variables in bit, data, idata, bdata and xdata memory areas irrespective of the memory model being used (variables declared as const are automatically in code space).
- Direct access to the bits of variables located in the bdata memory area.
- Direct access to 8-bit sfr's, 16-bit sfr's and sfr bits to which you can allocate any C variable name.
- Additional interrupt qualifiers to allow you to specify the interrupt vector that a function will use (the compiler optionally generates all vectoring code) and an optional register bank for register bank switching.
The compiler supports pointers that point to any specific memory area and generic 3-byte pointers that can point to all memory areas. Some 8051 C compilers default to generic 3-byte pointers unless you declare a memory specific pointer using a qualifying keyword. It is then necessary to decorate your source code with non-ANSI keywords in order to avoid program inefficiency. This decoration may be memory model specific; if you switch memory models, you have to change your source code too. The Crossware 8051 ANSI C compiler avoids this problem. Although it supports these pointer qualifiers, in most cases it is not necessary to use them. Instead, any pointer that is not qualified is a smart pointer. It then will work out for itself from the way it is used what type of pointer it should be. This leaves you free to write memory model independent source code without any unnecessary loss of efficiency.
The Crossware 8051 ANSI C compiler supports both 32-bit and 64-bit floating-point objects.
32-bit floating-point objects contain only 23 bits of precision (the rest is used by the exponent and sign) and are therefore less precise than 32-bit long integers. They are however ideal for the application where low-precision floating-point arithmetic is all that is required. 64-bit floating-point objects contain 53 bits of precision and are therefore ideal where arithmetic accuracy is an important issue.
All floating-point arithmetic and normalisation routines are hand-coded in 8051 assembler to provide fast and compact library code.
The compiler supports a small memory model for use with chips that do not have any external RAM, and a large memory model for chips with external RAM. Functions can be either re-entrant or non-reentrant. A non-reentrant function is faster and smaller but cannot be called either directly or indirectly from within itself.
The compiler supports all 8051 variants including those that require the use of the ACALL and AJMP instructions.
The compiler generates full IEEE695 debug records. These records provide full information to a simulator or debugger that supports this IEEE695 format, allowing you to single-step through your C source code and watch all of your C variables. The Crossware 8051 simulator for Windows provides complete support for this format. The assembler that is included with the Development Suite package also generates IEEE695 debug records; you can single-step through your assembler code too.
The compiler provides numerous features that give you access to the 8051 features at the C source level. Nevertheless, you still can embed assembler in your C code if you wish using the #asm/#endasm directives.
C Library Support Routines:
|abs( ), ||coshl( ), ||fscanf( ), ||ldexp( ), ||rand( ), ||strncat( ), |
|acos( ), ||exit( ), ||getc( ), ||ldexpl( ), ||sbrk( ), ||strncmp( ),|
|acosl( ), ||exp( ), ||getchar( ), ||log( ), ||scanf( ), ||strncpy( ),|
|asin( ), ||expl( ), ||getche( ), ||logl( ), ||sin( ), ||strpbrk( ),|
|asinl( ), ||fabs( ), ||gets( ), ||log10( ), ||sinl( ), ||strrchr( ),|
|atan( ), ||fabsl( ), ||isalnum( ), ||log10l( ), ||sinh( ), ||strspn( ),|
|atanl( ), ||_fcvt( ), ||isalpha( ), ||ltoa( ), ||sinhl( ), ||strstr( ),|
|atan2( ), ||ferror( ), ||isacii( ), ||malloc( ), ||sprintf( ), ||tan( ),|
|atan2l( ), ||fgetc( ), ||iscntrl( ), ||memchr( ), ||sqrt( ), ||tanl( ), |
|atof( ), ||fgets( ), ||isdigit( ), ||memcmp( ), ||sqrtl( ), ||tanh( ),|
|atofl( ), ||fileno( ), ||isgraph( ), ||memcpy( ), ||srand( ), ||tanhl( ),|
|atoi( ), ||floor( ), ||islower( ), ||memmove( ), ||sscanf( ), ||time( ),|
|atol( ), ||floorl( ), ||isprintf( ), ||memset( ), ||strcat( ), ||toascii( ), |
|clearerr( ), ||fprintf( ), ||ispunct( ), ||pow( ), ||scanf( ), ||tolower( ),|
|ceil( ), ||fputc( ), ||isspace( ), ||powl( ), ||strchr( ), ||toupper( ),|
|ceill( ), ||fputs( ), ||isupper( ), ||printf( ), ||strcmp( ), ||ultoa( ),|
|cos( ), ||free( ), ||isxdigit( ), ||putc( ), ||strcpy( ), ||ungetc( ),|
|cosl( ), ||frexp( ), ||itoa( ), ||putchar( ), ||strcspn( ), ||ungetch( ), |
|cosh( ), ||frexpl( ), ||labs( ), ||puts( ), ||strlen( ), || |
The linker combines object modules created with the compiler and/or the assembler to create the final code that will run on your target system. It carries out the following functions:
- scans each module to collect segment and variable information
- arranges and positions segments at appropriate memory locations to suit the memory organisation of the target system and any specific location information supplied by the user
- finalises the values of all variables and calculates the results of any incomplete expressions
- extracts and relocates the code from each module to produce the final target program
- optionally updates the listing files produced by the compiler and/or assembler, adding the final absolute address information
- carries out a complete type check across all modules, examining global variables, functions (return type, parameter types and numbers, re-entrant attributes, interrupt attributes, and memory model type) and structure and union member types to ensure total program integrity
The linker also will construct a call tree of your C functions. It will use this to perform an overlay analysis of the local data areas of any non-reentrant functions, sharing memory wherever possible. It will report potential recursion of non-reentrant functions. At the same time, the parameter space for non-reentrant functions with variable numbers of arguments will be sized to the maximum required by any of the calls to that function.
The target program can be produced in a number of different formats including Intel hex, Intel OMF51, Motorola 'S' record, HP/Microtec IEEE695 format, or as a binary ROM image. No conversion utility has to be used; the linker directly outputs the program in the specified format.
An optional link map will show the final location and sizes of all segments and the values of all global variables.
Instead of being used to create a final target program, the object modules produced by the compiler and assembler can be integrated into a library. The library manager performs the tasks of:
- combining object modules into a library
- adding modules to an existing library
- removing or extracting modules from an existing library
- listing the contents of a library
The MAKE utility simplifies the task of keeping object files, libraries and target programs up to date. It detects if any source or dependency files have changed since the last build, and runs the appropriate tools (compiler, assembler, linker or library manager) to rebuild out-of-date files. It supports many advanced features including macros, inference rules, conditional inclusion and other preprocessing directives and in-line files with automatic temporary file creation.
Although the Embedded Development Studio uses its own integrated routines to keep projects up to date, this stand-alone MAKE utility can be used to build projects from the command line or from within another application. The Embedded Development Studio automatically will create a makefile that is fully compatible with this stand-alone MAKE utility.
RELOCATABLE 8051 MACRO CROSS ASSEMBLER
- High-speed assembly to create relocatable object modules.
- Intel 8051 standard segment directives allow segments to be aligned to page and block boundaries, contained within a page or block, positioned at the highest in memory location or positioned above all other segments.
- Intel 8051 standard assembler mnemonics
- Nestable macros with full argument passing
- Nestable conditional assembly
- Comprehensive range of assembler directives and pseudo ops
- Complex expression evaluation with Intel standard operators
- Intel standard 8051 and 8052 predefined symbols
- Upper and lower case labels with up to 255 significant characters
- Upper and lower case opcode mnemonics
- Upper and lower case macro names with up to 255 significant characters
- Comprehensive error checking with descriptive error messages
- Debug output of symbolic information
- User definable listing format
- Run from the command line or from within the editor
HOST SYSTEM REQUIREMENTS
IBM compatible PC with an Intel Pentium-class CPU or above running Windows 9x, Windows NT 4.0, Windows 2000 or Windows XP.
Go to 8051 Development Suite order page