IBM
Contents Index Previous Next



Adaptation to Compilers


In this section the steps are explained that must be carried out in order to deal with a new C compiler which is not yet in the list of available compilers.

The following parts may be modified manually:

The following parts can be added by using the Targeting Expert:

List of Available C Compilers in ml_typ.h

C compilers are to be selected by the user by choosing from an available list with the help of the Targeting Expert.

The Targeting Expert will generate a C define into the ml_mcf.h file. When compiling Cmicro sources, the right C compiler section in ml_typ.h is selected by using a #ifdef <compilername> construct.

The following <compilername> defines are currently defined in ml_typ.h:

Compilation switch Meaning

_GCC_

The GNU C++ compiler for workstations

GNU80166

The GNU UNIX C compiler for Siemens 80C166 microcontrollers

TCC80166

The BSO/Tasking DOS C compiler for Siemens 80C166 microcontrollers

TCC80C196

The BSO/Tasking DOS C compiler for INTEL 80196 microcontrollers

IARC51

The Archimedes/IAR UNIX C compiler for INTEL 8051 microcontrollers

IARC6301

The Archimedes/IAR DOS C compiler for Hitachi 6301 microcontrollers

KEIL_C51

The Franklin/Keil DOS C compiler for INTEL 8051 microcontrollers

KEIL_C166

The Franklin/Keil DOS C compiler for Siemens 80166 microcontrollers

TMS320

MSP58C80

The Texas Instruments DOS C compiler for TMS 320C2x/C5x microcontrollers

IARC7700

The Archimedes/IAR DOS C compiler for Melps 7700 microcontrollers

HYPERSTONE

Hyperstone 5.07 C compiler with HyRTK real-time kernel

MCC68K

The MicroTech DOS C compiler for Motorola 68k microprocessors

MICROSOFT_C

The Microsoft C++ compiler

ARM_THUMB

The Thumb compiler for ARM microcontrollers

ICC_HC12

The ICC12 5.0 Compiler for HC12 microcontrollers

If none of these compiler flags is defined during compilation the file user_cc.h (generated by the Targeting Expert) will be included in ml_typ.h.

The remaining part of the code of the Cmicro Library should be compilable without performing any modifications. If there are problems with adapting a new compiler or hardware please contact Cmicro technical support.

The user may however decide to define his own C compiler. This is explained in the following subsection.

Introducing a new C Compiler

Adding a new C Compiler to the Project

The first alternative to add a new user defined C compiler, is to add that compiler to a user's project. This can be achieved with the Targeting Expert.

These changes are not stored within the installation, but within the user's project directory (which is the target directory that was chosen when the Targeting Expert was started).

Do the C Compiler Adaptations

Description of user_cc.h

The things that are to be defined by the user are:

Yes

#undef  XNOPROTO

#define XPP(x)     x

#define PROTO(x)   x

No

#define XNOPROTO

#define XPP(x)

#define PROTO(x)

char

#define xmk_OPT_INT char

integer

#define xmk_OPT_INT integer

Yes

#undef  X_REGISTER

#define X_REGISTER >register<

No

/* Nothing to do for X_REGISTER */

>register< is the compiler specific command to store variables in registers.

Yes

#define XCONST const

No

#undef XCONST

In general, the compilers which are able to produce ROM-able code, can handle the keyword const. Compilers may generate false object code, if using const.

Yes

#define XMK_UNIX

No



Yes

#define XMK_WINDOWS

No



Defining the SDL System Time Functions in mk_stim.c

The following functions exist in the module mk_stim.c:

Usually, the above functions are conditionally compiled. To make the functions available in the target system, at least one timer in SDL must be declared. The functions are not included if there is no timer declared but duration, time or now is used in SDL. This will lead to compilation errors.

To make timers in SDL operable, absolute time must be implemented. This can be reached by using a hardware free running counter or by using a timer interrupt service routine, which clocks a global variable containing the absolute time.


http://www.ibm.com/rational
Contents Index Previous Next