C– – Compiler

Although we have tried to keep the differences between regular C and C– – to a minimum, there are still a few that require explanation.

5.5.6Function Prototypes and Declarations

C– – function prototypes and declarations MUST be preceded with the

keyword cmm_func.

Since all functions return through accumulator A0, all functions are of type integer. The function type may be omitted in the function declaration. If present, it is ignored anyway. Trying to typecast a function as returning a pointer will result in a compiler error.

Note: To change a C– – program back into a regular C program (at least from the point of view of function prototypes and declarations), the following line can be inserted at the beginning of the C– –program:

#define cmm_func

A library of regular C functions to substitute for the special MSP50C6xx functions is supplied with the C– – compiler, allowing the user to compare the results of regular C programs with those of C– –programs. The library is contained in the C source file cmm_func.c .It should be linked with the C equivalent of the C– – program, and run in Borland C.

Note:

To use external functions in C– –, a function prototype should be placed in the file that calls the external function.

5.5.7Initializations

Due (in part) to the architecture of the MSP50C6xx processors, initialization is only allowed for global variables. As a side effect, local static variables are not allowed. For example, a global array can be declared and initialized as follows:

int int_array[5]={1,2,3,4,5};

Initialization values are stored in program memory.

5.5.8RAM Usage

RAM location 0 is reserved (and used intensively) by the compiler. The choice of location 0 does not conflict with the usual definition of a NULL pointer.

Code Development Tools

5-21

Page 317
Image 317
Texas Instruments MSP50C6xx manual Function Prototypes and Declarations, Initializations, RAM Usage