11.9 Memory Models
The compiler supports several memory models. Command-line options are available for selecting the optimum memory model for your application, based on the specific device that you are using and the type of memory usage.
Option | Memory Definition | Description |
---|---|---|
-msmall-data | Place all data in Near Data Space (Notes 1, 2). | Permits the use of direct operations on memory, like PIC18 devices. |
-msmall-scalar | Place scalar variables into Near Data Space. This is the
default (Notes 1, 3). | Scalar variables, single object entities such as int or
float variables, are allocated into Near Data
Space. |
-msmall-code | Use short-calls and branches to transfer control. This is the default (Note 4). | Function calls use the RCALL instruction. |
-mlarge-code | Use long-calls and goto instructions, where possible. | Function calls use the CALL instruction. |
-mconst-in-data | const qualified objects are allocated in data
memory. | Values copied from program memory by startup code. |
-mconst-in-code | const qualified objects located in program memory. | Values accessed are directly from program Flash. |
Note:
|
The command-line options apply globally to the modules being compiled.
Individual variables and functions can be declared as near
or
far
to better control the code generation. For information on setting
individual variable or function attributes, see Variable Attributes and Function Specifiers.