Next Previous Contents

16. Memory Models

SDCC allows two memory models, modules compiled with different memory models should be combined together, the results would be unpredictable. The support routines supplied with the compiler are compiled in small-model by default, and will need to be recompiled using the large model if the large model is used. In general the use of the large model is discouraged.

When the large model is used all variables declared without a storage class will be allocated into the external ram, this includes all parameters and local variables (for non-reentrant functions). When the small model is used variables without storage class are allocated in the internal ram.

Judicious usage of the processor specific storage classes and the 'reentrant' function type will yield much more efficient code, than using the large-model. Several optimizations are disabled when the program is compiled using the large model, it is therefore strongly recommdended that the small model be used unless absolutely required.


Next Previous Contents