Accesses to far variables are less efficient than accesses to internal variables and extensive accesses to these variables will result in larger code sizes.
Here is an example of an unsigned int object placed into the device’s external code space:
Note that a --RAM option is mandatory to specify the external address range where far
variables will reside. In MPLAB X IDE Project Properties, XC8 Linker Category, Memory Model drop-down menu; add the additional memory into the RAM Ranges field.
For example, specify
into the RAM Ranges field to supply the information to Linker that additional memory is in the Range of 30000-3FFFF.
You may also want to set the --EMI (External Memory Interface) option to select which mode your device will use to access the external memory. In MPLAB X IDE, adjust the External Memory field in the Linker tab of the Build Options dialog -> Memory Model -> External Memory = Wordwrite / Bytewrite/ Byteselect.
Refer to the compiler manual for more information relating to these options.
Configuration bits and SFRs may need to be set up, to configure the device to use the external memory.
Microchip Technology acquires Atmel