11.14 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. |
-mconst-in-auxflash | const qualified objects located in auxiliary Flash; this
option is Device Dependent. |
Values are accessed directly from auxiliary program Flash. |
Note:
|
The command-line options apply globally to the modules being compiled.
Individual variables and functions can be declared as near
,
far
or in eds
to better control the code generation.
For information on setting individual variable or function attributes, see 9.10 Variable Attributes and 14.1.1 Function Specifiers.