5.8.3.2 XC-DSC C Compiler - Memory Model

Notes:
  • N/A means MPLAB X IDE option not available in VS Code.
  • VSC means VS Code option is not available in MPLAB X IDE.
Table 5-21. Memory Model Options
OptionDescriptionCommand Line
Code modelSelect a code (program memory/ROM) model.

- default

- large (>32 K words)

- small (<32 K words)

-msmall-code

-mlarge-code

-msmall-code

Data modelSelect a data (data memory/RAM) model.

- default

- large (device dependent1)

- small (device dependent1)

device dependant2

-mlarge-data

-msmall-scalar

Scalar modelSelect a scalar model.

- default

- large (device dependent1)

- small (device dependent1)

-msmall-scalar

-mlarge-scalar

-msmall-scalar

Location of constant modelSelect a memory location for constants.

- default

- Data

- Code

-mconst-in-code

-mconst-in-data

-mconst-in-code

Place all code in auxiliary flash Place all code from the current translation unit into auxiliary Flash. This option is only available on devices that have auxiliary Flash.-mauxflash
Put constants into auxiliary flashWhen combined with -mconst-in-code, put constants into auxiliary Flash.-mconst-in-auxflash
Put char vars into near data spaceVSC: Place 'char' variables into near data space, regardless of memory model.
Allow arrays larger than 32KAllow arrays that are larger than 32K, regardless of memory model.-menable-large-arrays
Aggregate data modelUse aggregate data model. -mlarge-aggregate
Note:
  1. For most devices 6K of RAM is the near data space, but for some devices it is 4K of RAM.
  2. For devices that have all of their data memory in the near space, the memory model is "small data" "small scalar" so that all memory will be allocated in the near space.

    For all other devices the default memory model is "large data" "small scalar." This will have the effect of allowing the tool chain to place aggregate objects, such as arrays and structure, into the far memory space. This can be over-ridden by explicitly selecting "small data" in the compiler options.